# @alga-psa/ui-kit Zero-dependency React component library for Alga extensions. All components use CSS custom properties for theming and work seamlessly inside extension iframes. > See the **showcase extension** (`ee/extensions/showcase`) for interactive demos of every component. ## Install Import the theme stylesheet once at the root of your app: ```ts import '@alga-psa/ui-kit/theme.css'; ``` --- ## Theme Tokens Tokens are exposed as CSS variables. When running inside an extension iframe the host automatically injects them into `:root`. | Variable | Light | Dark | Purpose | |----------|-------|------|---------| | `--alga-bg` | `#ffffff` | `#0b0f14` | Background | | `--alga-fg` | `#111111` | `#e5e7eb` | Foreground / text | | `--alga-muted` | `#f5f5f7` | `#0f1720` | Muted background | | `--alga-muted-fg` | `#4b5563` | `#9ca3af` | Muted text | | `--alga-primary` | `#9855ee` | `#8a4dea` | Primary (purple) | | `--alga-primary-foreground` | `#ffffff` | `#ffffff` | Text on primary | | `--alga-secondary` | `#53d7fa` | `#40cff9` | Secondary (blue) | | `--alga-secondary-foreground` | `#111111` | `#0b0f14` | Text on secondary | | `--alga-border` | `#e5e7eb` | `#1f2937` | Borders | | `--alga-radius` | `8px` | `8px` | Border radius | | `--alga-danger` | `#dc2626` | `#ef4444` | Danger / error | | `--alga-warning` | `#d97706` | `#f59e0b` | Warning | | `--alga-success` | `#16a34a` | `#22c55e` | Success | You can also access tokens programmatically: ```ts import { tokens } from '@alga-psa/ui-kit'; tokens.primary // 'var(--alga-primary)' tokens.bg // 'var(--alga-bg)' ``` --- ## Components ### Core #### `Button` Themed button with multiple variants and sizes. | Prop | Type | Default | Description | |------|------|---------|-------------| | `variant` | `'primary' \| 'secondary' \| 'destructive' \| 'outline' \| 'ghost' \| 'link' \| 'soft' \| 'dashed'` | `'primary'` | Visual style | | `size` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'icon'` | `'md'` | Controls padding and font size | ```tsx ``` #### `Text` Typography component with size, tone, and weight presets. | Prop | Type | Default | Description | |------|------|---------|-------------| | `as` | `'span' \| 'p' \| 'label' \| 'strong'` | `'span'` | HTML element to render | | `size` | `'xs' \| 'sm' \| 'md' \| 'lg'` | `'md'` | Font size preset | | `tone` | `'default' \| 'muted' \| 'danger' \| 'warning' \| 'success'` | `'default'` | Text colour | | `weight` | `400 \| 500 \| 600 \| 700` | `400` | Font weight | ```tsx Hello ``` #### `Card` Bordered container with background, shadow, and rounded corners. Extends standard `
` attributes. ```tsx Content here ``` #### `Badge` Small pill-shaped label for status indicators. | Prop | Type | Default | Description | |------|------|---------|-------------| | `tone` | `'default' \| 'info' \| 'success' \| 'warning' \| 'danger'` | `'default'` | Colour scheme | ```tsx Active ``` #### `Alert`, `AlertTitle`, `AlertDescription` Contextual alert banner with optional icon. | Prop | Type | Default | Description | |------|------|---------|-------------| | `tone` | `'info' \| 'success' \| 'warning' \| 'danger'` | `'info'` | Visual tone | | `showIcon` | `boolean` | `true` | Show tone-specific icon | ```tsx Heads up This action cannot be undone. ``` #### `Separator` Thin divider line for separating content. | Prop | Type | Default | Description | |------|------|---------|-------------| | `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Direction of the line | | `style` | `CSSProperties` | — | Additional inline styles | --- ### Form #### `Input` Text input with error state support. | Prop | Type | Default | Description | |------|------|---------|-------------| | `error` | `boolean` | — | Show error styling | | `errorMessage` | `string` | — | Error message displayed below input | ```tsx ``` #### `TextArea` Multi-line text input. Extends `