Skip to content

Style React Aria Slots with Tailwind. #6400

Answered by snowystinger
brenotx asked this question in Q&A
Discussion options

You must be logged in to vote

Have you had a look through our Tailwind examples? https://react-spectrum.adobe.com/react-aria/examples/contact-list.html
You could avoid the need for the slot selector by doing it this way and just place the classes directly on the element. If you want to generalize it a bit more, you could use a context to pass classnames from a parent to a child, we do this in our React Spectrum implementation using the precursor to RAC's slots https://github.com/adobe/react-spectrum/blob/main/rfcs/2019-v3-slots.md

The RAC one is type safe and an iteration on that RFC. You can also make use of it by creating your own Contexts for your own components.

@reidbarber I know you have some more experience wit…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@reidbarber
Comment options

Answer selected by brenotx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants