Skip to content

Questions about SlotProps.slot in Slots.tsx implementation #3449

Answered by LFDanLu
bstro asked this question in Q&A
Discussion options

You must be logged in to vote

What is SlotProps.slot intended for? Is it so that I could declare the child's slot from the parent?

Yes that is correct, here is an example of this. As you can see in this story, there are two Text elements, one without a slot prop defined (and thus has the default "text" slot) and one with slot="description". This allows us to send the proper classNames/props to each so that one renders as the main ListBox's option's text and the other as the option's description:

View doesn't have a default slot since it is a more generic container rather than a commonly used component that is slotted within one of our components.

Replies: 1 comment 1 reply

Comment options

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

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