Button Component

A versatile button component with various styles, sizes, and states.

Installation

pnpmpnpm dlx pacmanui add button
npm  → npx pacmanui add button

Usage

import { Button } from '@/components/pacmanui/button'

export default function MyComponent() {
  return (
    <Button>Click me</Button>
  )
}

API Reference

PROPTYPEDEFAULTDESCRIPTION
variant'primary' | 'secondary' | 'outline' | 'ghost' | 'link''primary'The visual style of the button
size'sm' | 'md' | 'lg''md'The size of the button
state'default' | 'loading' | 'success' | 'error' | 'warning' | 'disabled''default'The current state of the button
fullWidthbooleanfalseWhether the button should take up the full width of its container
iconReact.ReactNodeundefinedOptional icon to display before the button text
classNamestring''Additional CSS classes to apply to the button
onClick(event: React.MouseEvent) => voidundefinedFunction called when the button is clicked
disabledbooleanfalseWhether the button is disabled
type'button' | 'submit' | 'reset''button'The type of button

Examples

Button Variants

Different button variants available

import { Button } from '@/components/pacmanui/button'

// Different variants
<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<Button variant="outline">Outline</Button>
<Button variant="ghost">Ghost</Button>
<Button variant="link">Link</Button>

Button Sizes

Buttons in different sizes

import { Button } from '@/components/pacmanui/button'

// Different sizes
<Button size="sm">Small</Button>
<Button size="md">Medium</Button>
<Button size="lg">Large</Button>

Button States

Different button states including loading, success, error, and warning

import { Button } from '@/components/pacmanui/button'

// Different states
<Button state="default">Default</Button>
<Button state="loading">Loading</Button>
<Button state="success">Success</Button>
<Button state="error">Error</Button>
<Button state="warning">Warning</Button>
<Button state="disabled">Disabled</Button>