You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently some component have fixed variant. For example: const badgeVariants = cva(, const buttonVariants = cva( so I find some solution to add dynamic variant with minimum cost to modify ShadCN UI code.
I don't know if this is a good idea before proceeding to modify the code and create a pull request.
This solution need update any component in /components/ui that used = cva(. So the end-user (developer) cant override variant by update ONLY 1 file custom-vars.ts. It need shadcn tool (npx shadcn@latest) create/update (question) /components/ui/custom-vars.ts if file not exits.
This is example for update component button
Add merge variant function / customVars
For example customVars.button is override button variants. I use chat GPT, so maybe _deepMerge fn work not correctly.
Feature description
Problem
Currently some component have fixed variant. For example:
const badgeVariants = cva(
,const buttonVariants = cva(
so I find some solution to add dynamic variant withminimum cost
to modify ShadCN UI code.I don't know if this is a good idea before proceeding to modify the code and create a pull request.
This solution need update any component in
/components/ui
that used= cva(
. So the end-user (developer) cant override variant by update ONLY 1 filecustom-vars.ts
. It needshadcn tool (npx shadcn@latest)
create/update (question)/components/ui/custom-vars.ts
if file not exits.This is example for update component button
Add merge variant function / customVars
For example
customVars.button
is overridebutton
variants. I use chat GPT, so maybe_deepMerge
fn work not correctly.Modify button.tsx
Usage button
Expected: Code should not throw error for
variant='success'
Update CSS
Update tailwind.config.js
Affected component/components
Alert, Badge, Button, Label, Sheet, Toast, Toggle
Additional Context
Additional details here...
Before submitting
The text was updated successfully, but these errors were encountered: