button
shipbase-ui/buttonFreeComponent
shipbase/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/shipbase/ui/next/apps/www/public/r/react/button.jsonSource
1"use client"23import * as React from "react"45import { createAnatomy } from "@ark-ui/react/anatomy"6import { type HTMLArkProps, ark } from "@ark-ui/react/factory"7import { type VariantProps, cva } from "class-variance-authority"89import { cn } from "@/lib/utils"1011const anatomy = createAnatomy("button").parts("root")12const parts = anatomy.build()1314const buttonVariants = cva(15 "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",16 {17 variants: {18 variant: {19 default:20 "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",21 destructive:22 "bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40",23 outline:24 "border border-input bg-background shadow-xs hover:bg-accent hover:text-accent-foreground",25 secondary:26 "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",27 ghost: "hover:bg-accent hover:text-accent-foreground",28 link: "text-primary underline-offset-4 hover:underline",29 },30 size: {31 default: "h-9 px-4 py-2",32 sm: "h-8 rounded-md px-3 text-xs",33 lg: "h-10 rounded-md px-8",34 icon: "size-9",35 },36 },37 defaultVariants: {38 variant: "default",39 size: "default",40 },41 }42)4344export interface ButtonProps45 extends HTMLArkProps<"button">,46 VariantProps<typeof buttonVariants> {}4748const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(49 ({ className, variant, size, ...props }, ref) => {50 return (51 <ark.button52 ref={ref}53 {...parts.root.attrs}54 className={cn(buttonVariants({ variant, size, className }))}55 {...props}56 />57 )58 }59)60Button.displayName = "Button"6162export { Button, buttonVariants }
What it pulls in
npm packages
Files it writes
More from shipbase/ui
All 32 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shipbase/ui | Components | Free | 2 deps | |
| avataravatar | shipbase/ui | Components | Free | 1 dep | |
| badgebadge | shipbase/ui | Components | Free | 2 deps | |
| cardcard | shipbase/ui | Components | Free | 1 dep | |
| checkboxcheckbox | shipbase/ui | Components | Free | 2 deps | |
| collapsiblecollapsible | shipbase/ui | Components | Free | 1 dep | |
| comboboxcombobox | shipbase/ui | Components | Free | 2 deps | |
| dialogdialog | shipbase/ui | Components | Free | 2 deps |
