-
Notifications
You must be signed in to change notification settings - Fork 808
/
Copy pathbutton.json
22 lines (22 loc) · 2.46 KB
/
button.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{
"dependencies": [
"@radix-ui/react-slot"
],
"doc": {
"description": "Displays a button or a component that looks like a button.",
"links": {
"doc": "https://ui.shadcn.com/docs/components/button"
}
},
"files": [
{
"content": "import * as React from 'react';\n\nimport { Slot } from '@radix-ui/react-slot';\nimport { cn, withRef } from '@udecode/cn';\nimport { type VariantProps, cva } from 'class-variance-authority';\n\nexport const buttonVariants = cva(\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0',\n {\n defaultVariants: {\n size: 'sm',\n variant: 'default',\n },\n variants: {\n isMenu: {\n true: 'w-full cursor-pointer justify-start',\n },\n size: {\n icon: 'size-[28px] rounded-md px-1.5',\n lg: 'h-9 rounded-md px-4',\n md: 'h-8 px-3 text-sm',\n none: '',\n sm: 'h-[28px] rounded-md px-2.5',\n xs: 'h-8 rounded-md px-3 text-xs',\n },\n variant: {\n default: 'bg-primary text-primary-foreground hover:bg-primary/90',\n destructive:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/90',\n ghost: 'hover:bg-accent hover:text-accent-foreground',\n inlineLink: 'text-base text-primary underline underline-offset-4',\n link: 'text-primary underline-offset-4 hover:underline',\n outline:\n 'border border-input bg-background hover:bg-accent hover:text-accent-foreground',\n secondary:\n 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n },\n },\n }\n);\n\nexport const Button = withRef<\n 'button',\n {\n asChild?: boolean;\n } & VariantProps<typeof buttonVariants>\n>(({ asChild = false, className, isMenu, size, variant, ...props }, ref) => {\n const Comp = asChild ? Slot : 'button';\n\n return (\n <Comp\n ref={ref}\n className={cn(buttonVariants({ className, isMenu, size, variant }))}\n {...props}\n />\n );\n});\n",
"path": "plate-ui/button.tsx",
"target": "components/plate-ui/button.tsx",
"type": "registry:ui"
}
],
"name": "button",
"registryDependencies": [],
"type": "registry:ui"
}