Skip to content

What is the reason behind the two different APIs returned by tv depending if there are slots or not? #37

Answered by jrgarciadev
sebald asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @sebald the difference is intended since the idea when you use slots is to control all the slots on top of the same variants that's why you can only pass the variants to the main tv function and not to the returned ones.

you can see more information about slots here

https://www.tailwind-variants.org/docs/slots

https://www.tailwind-variants.org/docs/api-reference

Edit:

Regarding why we return functions when using slots instead of the string result is because the idea is that you can still modify the slot by passing a custom class/className to the slot function

Here's an example

https://github.com/nextui-org/nextui/blob/feat/v2/packages/components/avatar/src/use-avatar.ts#L185

Replies: 1 comment 1 reply

Comment options

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

Answer selected by jrgarciadev
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