-
Notifications
You must be signed in to change notification settings - Fork 80
feat: add requiredVariants option for mandatory variant enforcement #277
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
base: main
Are you sure you want to change the base?
Conversation
|
@wingkwong please check |
|
@tianenpang @wingkwong please check |
wingkwong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- please resolve conflicts.
- if a default is provided, then the variant must be there. required variant for this case seems counterintuitive.
| }): TVReturnType<V, S, B, EV, ES, E>; | ||
| /** | ||
| * Required variants that must be provided at runtime and are required in the type system. | ||
| * @see https://www.tailwind-variants.org/docs/variants#required-variants |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please supplement in docs. Currently this section doesn't exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a PR in the docs repo: heroui-inc/tailwind-variants-docs#48
What would be the expected behavior when both |
Description
This PR adds the
requiredVariantsoption for mandatory variants, that is an array of strings representing a part of defined variants, they are checked at runtime and will throw if the user did not provide them.Usage example:
What is the purpose of this pull request?