Composing components while adding extra slots #21
Answered
by
jrgarciadev
lewebsimple
asked this question in
Q&A
-
As the title says, is it possible to add extra slots when extending a component ? Consider the following: import { tv } from "tailwind-variants";
const section = tv({
slots: {
wrapper: '',
inner: '',
},
});
const extended = tv({
extend: section,
slots: {
inner: 'py-12',
extraSlot: '',
}
});
// This doesn't work as extended().extraSlot is undefined, but commenting out `extend: section` makes it work
console.log(extended().extraSlot()) Of course adding the missing slots in the parent component with empty values would fix the problem, but this means we have to know every possible slot name in advance ... which is not very convenient DX or downright impossible for packaged libraries. Am I missing something ? |
Beta Was this translation helpful? Give feedback.
Answered by
jrgarciadev
Mar 11, 2023
Replies: 1 comment 2 replies
-
Hey @lewebsimple thank you for reporting it, I just sent a PR to fix it #22 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
jrgarciadev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @lewebsimple thank you for reporting it, I just sent a PR to fix it #22