Button
animate-ui/components-buttons-buttonFreeComponent
A button component with a variety of styles and animations.
Install it
npx shadcn@latest add https://animate-ui.com/r/components-buttons-button.jsonSource
1'use client';23import * as React from 'react';4import { cva, type VariantProps } from 'class-variance-authority';56import {7 Button as ButtonPrimitive,8 type ButtonProps as ButtonPrimitiveProps,9} from '@/components/animate-ui/primitives/buttons/button';10import { cn } from '@/lib/utils';1112const buttonVariants = cva(13 "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-[box-shadow,_color,_background-color,_border-color,_outline-color,_text-decoration-color,_fill,_stroke] disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",14 {15 variants: {16 variant: {17 default:18 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',19 accent: 'bg-accent text-accent-foreground shadow-xs hover:bg-accent/90',20 destructive:21 'bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',22 outline:23 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',24 secondary:25 'bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80',26 ghost:27 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',28 link: 'text-primary underline-offset-4 hover:underline',29 },30 size: {31 default: 'h-9 px-4 py-2 has-[>svg]:px-3',32 sm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',33 lg: 'h-10 rounded-md px-6 has-[>svg]:px-4',34 icon: 'size-9',35 'icon-sm': 'size-8 rounded-md',36 'icon-lg': 'size-10 rounded-md',37 },38 },39 defaultVariants: {40 variant: 'default',41 size: 'default',42 },43 },44);4546type ButtonProps = ButtonPrimitiveProps & VariantProps<typeof buttonVariants>;4748function Button({ className, variant, size, ...props }: ButtonProps) {49 return (50 <ButtonPrimitive51 className={cn(buttonVariants({ variant, size, className }))}52 {...props}53 />54 );55}5657export { Button, buttonVariants, type ButtonProps };
What it pulls in
npm packages
Other registry items
Files it writes
More from Animate UI
All 580 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Avatar Groupcomponents-animate-avatar-group | Animate UI | Components | Free | 1 dep | |
| Codecomponents-animate-code | Animate UI | Components | Free | 1 dep | |
| Code Tabscomponents-animate-code-tabs | Animate UI | Components | Free | 1 dep | |
| Cursorcomponents-animate-cursor | Animate UI | Components | Free | no deps | |
| GitHub Stars Wheelcomponents-animate-github-stars-wheel | Animate UI | Components | Free | 1 dep | |
| Tabscomponents-animate-tabs | Animate UI | Components | Free | no deps | |
| Tooltipcomponents-animate-tooltip | Animate UI | Components | Free | 1 dep | |
| Bubble Backgroundcomponents-backgrounds-bubble | Animate UI | Components | Free | 1 dep |
