Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left align Radio Card #486

Open
penx opened this issue May 2, 2024 · 1 comment
Open

Left align Radio Card #486

penx opened this issue May 2, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@penx
Copy link
Contributor

penx commented May 2, 2024

In the first example for the Checkbox Card and Radio Card in the docs, the text is left aligned because it has a Flex child that sets this.

Screenshot 2024-05-02 at 15 37 05

https://www.radix-ui.com/themes/docs/components/checkbox-cards

Screenshot 2024-05-02 at 15 37 48

https://www.radix-ui.com/themes/docs/components/radio-cards

By default the alignment of contents within a checkbox/radio card is centered.

If the intention is to support left alignment of text in a checkbox/radio card item, could it be given a prop to set this, rather than requiring nesting a Flex within it?

If the intention is to discourage left alignment, could the example at the top of the docs be changed to something centre aligned? 😄

@penx penx changed the title Left align Checkbox Card Left align Checkbox and Radio Card May 2, 2024
@vladmoroz vladmoroz changed the title Left align Checkbox and Radio Card Left align Radio Card May 6, 2024
@vladmoroz vladmoroz added the documentation Improvements or additions to documentation label May 6, 2024
@vladmoroz
Copy link
Contributor

The alignment choice is by design:

  • The checkbox card is left aligned by default because of the checkbox on the right.
  • The radio card was made center aligned by default because it's the most vanilla / good-looking option out of the box for simple one-liners.
    • That Flex example in the docs should probably be moved to the Examples section, and the base example should be simpler.
    • Using composition to achieve a different layout is encouraged. Not sure how we'd feel about a layout prop there as some common layouts are just too different and can't be covered with props reasonably well compared to composition (namely: a single center-aligned line of text (works out of the box), text + icon horizontally (works out of the box), 2+ lines of text left-aligned (needs composition)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants