-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Description
ui/apps/v4/registry/new-york-v4/ui/toggle-group.tsx
Lines 10 to 43 in 4f617d5
| const ToggleGroupContext = React.createContext< | |
| VariantProps<typeof toggleVariants> & { | |
| spacing?: number | |
| } | |
| >({ | |
| size: "default", | |
| variant: "default", | |
| spacing: 0, | |
| }) | |
| function ToggleGroup({ | |
| className, | |
| variant, | |
| size, | |
| spacing = 0, | |
| children, | |
| ...props | |
| }: React.ComponentProps<typeof ToggleGroupPrimitive.Root> & | |
| VariantProps<typeof toggleVariants> & { | |
| spacing?: number | |
| }) { | |
| return ( | |
| <ToggleGroupPrimitive.Root | |
| data-slot="toggle-group" | |
| data-variant={variant} | |
| data-size={size} | |
| data-spacing={spacing} | |
| style={{ "--gap": spacing } as React.CSSProperties} | |
| className={cn( | |
| "group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs", | |
| className | |
| )} | |
| {...props} | |
| > |
Observations
data-spacingis referenced bydata-[spacing=default]:data-[variant=outline]:shadow-xsdata-spacing={spacing}spacing = 0by default
Question
Should data-spacing={spacing} be:
defaultwhen0orundefined
- data-spacing={spacing}
+ data-spacing={spacing || 'default'}defaultwhenundefined
- data-spacing={spacing}
+ data-spacing={spacing ?? 'default'}Metadata
Metadata
Assignees
Labels
No labels