button
example-react/buttonFreeComponent
@example/react publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/jsrepojs/jsrepo/main/examples/react/public/r/shadcn/button.jsonSource
1import type React from 'react';2import { tv, type VariantProps } from 'tailwind-variants';3import { cn } from '@/registry/lib/utils';45export const buttonVariants = tv({6 base: 'flex items-center rounded-md active:scale-98 transition-all',7 variants: {8 variant: {9 default: 'bg-primary text-primary-foreground',10 destructive: 'bg-destructive text-destructive-foreground',11 outline: 'border border-border hover:bg-accent',12 },13 size: {14 default: 'h-8 px-2.5',15 sm: 'h-7 px-2',16 },17 },18});1920export type Variant = VariantProps<typeof buttonVariants>['variant'];21export type Size = VariantProps<typeof buttonVariants>['size'];2223export function Button({24 variant = 'default',25 size = 'default',26 className,27 ...props28}: React.ComponentProps<'button'> & { variant?: Variant; size?: Size }) {29 return <button {...props} className={cn(buttonVariants({ variant, size }), className)} />;30}
What it pulls in
npm packages
Other registry items
