@alkimi.org/ui-kit 0.12.5 → 0.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/COMPONENTS.md +1922 -0
- package/dist/chunk-372VUZFE.js.map +1 -1
- package/dist/chunk-3BVMHDYA.js.map +1 -1
- package/dist/chunk-3PEPOFYU.js.map +1 -1
- package/dist/chunk-3TLCOZ5R.js.map +1 -1
- package/dist/chunk-5L5DM2X5.js.map +1 -1
- package/dist/chunk-5X26XR44.js.map +1 -1
- package/dist/chunk-7J2ETVGK.js.map +1 -1
- package/dist/chunk-7SOZ6MOV.js.map +1 -1
- package/dist/chunk-ALSJLUSL.js +3 -0
- package/dist/chunk-ALSJLUSL.js.map +1 -0
- package/dist/chunk-AQZWRJVJ.mjs +3 -0
- package/dist/chunk-AQZWRJVJ.mjs.map +1 -0
- package/dist/chunk-BV7RXRSL.js.map +1 -1
- package/dist/chunk-C4GUY2JQ.js +3 -0
- package/dist/chunk-C4GUY2JQ.js.map +1 -0
- package/dist/chunk-CT2CRYC2.js.map +1 -1
- package/dist/chunk-DEWWZMYC.js.map +1 -1
- package/dist/chunk-DHHZMQ72.js.map +1 -1
- package/dist/chunk-DMMKR6TY.js.map +1 -1
- package/dist/chunk-EBNJXPHG.js.map +1 -1
- package/dist/chunk-EIM5R7AJ.js.map +1 -1
- package/dist/chunk-EJTY2ABY.js.map +1 -1
- package/dist/chunk-ETE5IUMO.js +3 -0
- package/dist/chunk-ETE5IUMO.js.map +1 -0
- package/dist/chunk-FUYXCJOQ.js.map +1 -1
- package/dist/chunk-GRXC46JC.js.map +1 -1
- package/dist/chunk-GTHJWD33.js +3 -0
- package/dist/chunk-GTHJWD33.js.map +1 -0
- package/dist/chunk-I5INE4KG.js.map +1 -1
- package/dist/chunk-JOEQLSHD.js +32 -0
- package/dist/chunk-JOEQLSHD.js.map +1 -0
- package/dist/chunk-K4GMCVHO.js.map +1 -1
- package/dist/chunk-LQMOWEA7.js.map +1 -1
- package/dist/chunk-NHM7DO42.mjs +3 -0
- package/dist/chunk-NHM7DO42.mjs.map +1 -0
- package/dist/chunk-ODXDXJ72.js.map +1 -1
- package/dist/chunk-RJMIOBXZ.js.map +1 -1
- package/dist/chunk-RKRTEMMZ.js.map +1 -1
- package/dist/chunk-RRAIGAHU.js.map +1 -1
- package/dist/chunk-TDMRUCR6.js.map +1 -1
- package/dist/chunk-TUADTU4Z.mjs +32 -0
- package/dist/chunk-TUADTU4Z.mjs.map +1 -0
- package/dist/chunk-UJZP6L4S.js.map +1 -1
- package/dist/chunk-ULIOO55I.js.map +1 -1
- package/dist/chunk-UNR6ATUH.js.map +1 -1
- package/dist/chunk-USPGZYMV.js.map +1 -1
- package/dist/chunk-VBPIXXIA.js.map +1 -1
- package/dist/chunk-VGPTOLNX.mjs +3 -0
- package/dist/chunk-VGPTOLNX.mjs.map +1 -0
- package/dist/chunk-WFD523CV.js.map +1 -1
- package/dist/chunk-WYRD4UAK.js.map +1 -1
- package/dist/chunk-XQILGD5B.js.map +1 -1
- package/dist/chunk-XY6RUEAT.mjs +3 -0
- package/dist/chunk-XY6RUEAT.mjs.map +1 -0
- package/dist/chunk-XYO4VLMF.js.map +1 -1
- package/dist/chunk-Z5V4P3EC.js.map +1 -1
- package/dist/components/GeometricFluidGrid.js.map +1 -1
- package/dist/components/GlitchLink.js.map +1 -1
- package/dist/components/PixelLoad.js.map +1 -1
- package/dist/components/TextDecoder.js.map +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/breadcrumb.js +2 -2
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/breadcrumb.mjs +1 -1
- package/dist/components/breadcrumb.mjs.map +1 -1
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.js +2 -31
- package/dist/components/card.js.map +1 -1
- package/dist/components/card.mjs +1 -30
- package/dist/components/card.mjs.map +1 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.js.map +1 -1
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-upload.js.map +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/label.js.map +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress.js +2 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progress.mjs +1 -1
- package/dist/components/progress.mjs.map +1 -1
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/separator.js.map +1 -1
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.js +2 -2
- package/dist/components/slider.js.map +1 -1
- package/dist/components/slider.mjs +1 -1
- package/dist/components/slider.mjs.map +1 -1
- package/dist/components/switch.js +2 -2
- package/dist/components/switch.js.map +1 -1
- package/dist/components/switch.mjs +1 -1
- package/dist/components/switch.mjs.map +1 -1
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toast.js.map +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/tree-select.js.map +1 -1
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,1922 @@
|
|
|
1
|
+
# @alkimi.org/ui-kit v0.12.7
|
|
2
|
+
|
|
3
|
+
AI-readable component documentation for the Alkimi UI Kit.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @alkimi.org/ui-kit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Button } from "@alkimi.org/ui-kit"
|
|
13
|
+
import "@alkimi.org/ui-kit/styles.css"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Button
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { Button, buttonVariants, type ButtonProps } from "@alkimi.org/ui-kit"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Components:** `Button`, `buttonVariants`
|
|
25
|
+
|
|
26
|
+
A versatile button component with multiple variants, sizes, and states.
|
|
27
|
+
|
|
28
|
+
### Usage
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
<Button>Click me</Button>
|
|
32
|
+
<Button variant="outline" size="sm">Small outline</Button>
|
|
33
|
+
<Button loading>Loading...</Button>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Variants
|
|
37
|
+
|
|
38
|
+
- **default**: Primary action button with accent color
|
|
39
|
+
- **destructive**: For dangerous actions (delete, remove)
|
|
40
|
+
- **outline**: Secondary actions with border
|
|
41
|
+
- **secondary**: Alternative secondary style
|
|
42
|
+
- **ghost**: Minimal style for subtle actions
|
|
43
|
+
- **link**: Text-only button styled as a link
|
|
44
|
+
|
|
45
|
+
### Sizes
|
|
46
|
+
|
|
47
|
+
- **default**: Standard button size
|
|
48
|
+
- **sm**: Smaller button for compact layouts
|
|
49
|
+
- **lg**: Larger button for emphasis
|
|
50
|
+
- **icon**: Square button for icons only
|
|
51
|
+
- **none**: No padding or text size — useful for fully custom sizing
|
|
52
|
+
|
|
53
|
+
### States
|
|
54
|
+
|
|
55
|
+
- **loading**: Shows a loading spinner, automatically disables interaction
|
|
56
|
+
- **disabled**: Disables the button and reduces opacity
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Props
|
|
60
|
+
|
|
61
|
+
| Prop | Type | Default | Description |
|
|
62
|
+
|------|------|---------|-------------|
|
|
63
|
+
| asChild? | `boolean` | `false` | - |
|
|
64
|
+
| loading? | `boolean` | `false` | - |
|
|
65
|
+
| icon? | `React.ReactNode` | - | - |
|
|
66
|
+
| variant? | `"default" \| "destructive" \| "outline" \| "secondary" \| "ghost" \| "link"` | `"default"` | - |
|
|
67
|
+
| size? | `"default" \| "sm" \| "lg" \| "icon" \| "none"` | `"default"` | - |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Tabs
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent } from "@alkimi.org/ui-kit"
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Components:** `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`
|
|
78
|
+
|
|
79
|
+
A tabs component for organizing content into separate views that users can switch between.
|
|
80
|
+
|
|
81
|
+
### Component Structure
|
|
82
|
+
|
|
83
|
+
- **Tabs**: Root container that manages tab state
|
|
84
|
+
- **TabsList**: Container for tab triggers (usually styled as a button group)
|
|
85
|
+
- **TabsTrigger**: Individual tab button to switch between content
|
|
86
|
+
- **TabsContent**: Content panel for each tab
|
|
87
|
+
|
|
88
|
+
### Usage
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<Tabs defaultValue="account">
|
|
92
|
+
<TabsList>
|
|
93
|
+
<TabsTrigger value="account">Account</TabsTrigger>
|
|
94
|
+
<TabsTrigger value="password">Password</TabsTrigger>
|
|
95
|
+
</TabsList>
|
|
96
|
+
<TabsContent value="account">Account content</TabsContent>
|
|
97
|
+
<TabsContent value="password">Password content</TabsContent>
|
|
98
|
+
</Tabs>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Key Props
|
|
102
|
+
|
|
103
|
+
- **defaultValue**: Initial active tab (uncontrolled)
|
|
104
|
+
- **value**: Controlled active tab state
|
|
105
|
+
- **onValueChange**: Callback when active tab changes
|
|
106
|
+
- **disabled**: Can be added to individual TabsTrigger components
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## TextDecoder
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { TextDecoder, type TextDecoderProps } from "@alkimi.org/ui-kit"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
An animated text component that reveals content through a decoding/decryption effect. Characters scramble through random symbols before settling into the final text. Supports a continuous glitch mode for loading states.
|
|
117
|
+
|
|
118
|
+
### Usage
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
<TextDecoder delay={0}>Hello World</TextDecoder>
|
|
122
|
+
<TextDecoder delay={1000} symbols="01">Binary decode</TextDecoder>
|
|
123
|
+
<TextDecoder isLoading={isLoading}>Data loaded</TextDecoder>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Props
|
|
127
|
+
|
|
128
|
+
- **children**: The text content to decode (can be string or nested elements)
|
|
129
|
+
- **delay**: Delay before starting animation in milliseconds (default: 0)
|
|
130
|
+
- **duration**: Controls the animation speed in frames (default: 40)
|
|
131
|
+
- **symbols**: Custom symbols for scrambling (default: `!<>-_\\\\/[]{}—=+*^?#________`)
|
|
132
|
+
- **isLoading**: When true, runs a continuous glitch animation. When set to false, the text decodes and reveals the children content
|
|
133
|
+
- **speed**: Controls how fast characters change during animation (0.01 = slow, 1 = instant, default: 0.28)
|
|
134
|
+
- **hoverContent**: When provided, enables tooltip-like hover behavior. Text animates to hoverContent on mouse enter, animates back to children on mouse leave
|
|
135
|
+
- **className**: Additional CSS classes for styling
|
|
136
|
+
|
|
137
|
+
### Use Cases
|
|
138
|
+
|
|
139
|
+
- Animated headers and titles
|
|
140
|
+
- Loading states with continuous glitch effect
|
|
141
|
+
- Sequential text reveals with `delay` prop
|
|
142
|
+
- Tooltip-like hover reveals with `hoverContent` prop
|
|
143
|
+
- Cyberpunk/tech aesthetic interfaces
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Props
|
|
147
|
+
|
|
148
|
+
| Prop | Type | Default | Description |
|
|
149
|
+
|------|------|---------|-------------|
|
|
150
|
+
| children | `ReactNode` | - | - |
|
|
151
|
+
| className? | `string` | `"absolute inset-0 flex items-center justify-center opacity-50 font-mono leading-none"` | - |
|
|
152
|
+
| duration? | `number` | `40` | - |
|
|
153
|
+
| symbols? | `string` | - | - |
|
|
154
|
+
| delay? | `number` | `0` | - |
|
|
155
|
+
| isLoading? | `boolean` | `false` | - |
|
|
156
|
+
| speed? | `number` | `0.28` | - |
|
|
157
|
+
| hoverContent? | `ReactNode` | - | - |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## GlitchLink
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
import { GlitchLink } from "@alkimi.org/ui-kit"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
An interactive link component with a cyberpunk-style glitch effect on hover. Characters randomly cycle through symbols before settling back to the original text.
|
|
168
|
+
|
|
169
|
+
### Usage
|
|
170
|
+
|
|
171
|
+
```tsx
|
|
172
|
+
<GlitchLink href="/about">About Us</GlitchLink>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Props
|
|
176
|
+
|
|
177
|
+
- **href**: The URL the link points to
|
|
178
|
+
- **children**: The text content of the link
|
|
179
|
+
- **symbols**: Array of symbols for the glitch effect (default: numbers, letters, special characters)
|
|
180
|
+
- **className**: Additional CSS classes for styling
|
|
181
|
+
- **asChild**: When true, passes props to child element instead of rendering a Link
|
|
182
|
+
|
|
183
|
+
### Use Cases
|
|
184
|
+
|
|
185
|
+
- Navigation links with futuristic aesthetic
|
|
186
|
+
- Call-to-action links that need attention
|
|
187
|
+
- In-text links that need visual interest
|
|
188
|
+
- Can wrap buttons using `asChild` prop
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## PixelLoad
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
import { PixelLoad, type PixelLoadProps } from "@alkimi.org/ui-kit"
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
An animated image component that reveals content through a pixelated depixelation effect. The image starts heavily pixelated and gradually becomes clear.
|
|
199
|
+
|
|
200
|
+
### Usage
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
<PixelLoad
|
|
204
|
+
src="/image.jpg"
|
|
205
|
+
alt="Description"
|
|
206
|
+
duration={600}
|
|
207
|
+
steps={15}
|
|
208
|
+
/>
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Key Props
|
|
212
|
+
|
|
213
|
+
- **src**: Image source URL or Next.js StaticImageData
|
|
214
|
+
- **alt**: Alternative text for accessibility
|
|
215
|
+
- **duration**: Animation duration in milliseconds (default: 600)
|
|
216
|
+
- **steps**: Number of pixelation steps (default: 15)
|
|
217
|
+
- **objectFit**: How image fits container (cover, contain, etc.)
|
|
218
|
+
- **onAnimationComplete**: Callback when animation finishes
|
|
219
|
+
|
|
220
|
+
### Animation Control
|
|
221
|
+
|
|
222
|
+
- Lower `duration` = faster animation
|
|
223
|
+
- More `steps` = smoother transition (but slower)
|
|
224
|
+
- Fewer `steps` = chunkier effect (but faster)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
### Props
|
|
228
|
+
|
|
229
|
+
| Prop | Type | Default | Description |
|
|
230
|
+
|------|------|---------|-------------|
|
|
231
|
+
| src | `ImageSrc` | - | - |
|
|
232
|
+
| alt | `string` | - | - |
|
|
233
|
+
| duration? | `number` | `600` | - |
|
|
234
|
+
| steps? | `number` | `15` | - |
|
|
235
|
+
| className? | `string` | `"sr-only"` | - |
|
|
236
|
+
| onAnimationComplete? | `() =\> void` | - | - |
|
|
237
|
+
| objectFit? | `"contain" \| "cover" \| "fill" \| "none" \| "scale-down"` | `"cover"` | - |
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## GeometricFluidGrid
|
|
242
|
+
|
|
243
|
+
```tsx
|
|
244
|
+
import { GeometricFluidGrid } from "@alkimi.org/ui-kit"
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
An animated background component featuring a fluid grid with glowing orbs and optional glitch effects.
|
|
248
|
+
|
|
249
|
+
### Usage
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
<GeometricFluidGrid variant="animated" />
|
|
253
|
+
<GeometricFluidGrid variant="static" />
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Variants
|
|
257
|
+
|
|
258
|
+
- **animated** (default): Full animations with glowing orbs, glitch effects, and mouse trail interactions
|
|
259
|
+
- **static**: Static dots only, no animations or interactions (better performance)
|
|
260
|
+
|
|
261
|
+
The component uses fixed positioning with z-index: -999, making it perfect for background usage.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Sidebar
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
import { Sidebar, SidebarBanner, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar } from "@alkimi.org/ui-kit"
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Components:** `Sidebar`, `SidebarBanner`, `SidebarContent`, `SidebarFooter`, `SidebarGroup`, `SidebarGroupAction`, `SidebarGroupContent`, `SidebarGroupLabel`, `SidebarHeader`, `SidebarInput`, `SidebarInset`, `SidebarMenu`, `SidebarMenuAction`, `SidebarMenuBadge`, `SidebarMenuButton`, `SidebarMenuItem`, `SidebarMenuSkeleton`, `SidebarMenuSub`, `SidebarMenuSubButton`, `SidebarMenuSubItem`, `SidebarProvider`, `SidebarRail`, `SidebarSeparator`, `SidebarTrigger`, `useSidebar`
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Drawer
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
import { Drawer, DrawerHeader, DrawerTitle, DrawerBody, DrawerFooter, useDrawer } from "@alkimi.org/ui-kit"
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Components:** `Drawer`, `DrawerHeader`, `DrawerTitle`, `DrawerBody`, `DrawerFooter`, `useDrawer`
|
|
282
|
+
|
|
283
|
+
A fully responsive drawer component that automatically adapts to screen size.
|
|
284
|
+
|
|
285
|
+
### Features
|
|
286
|
+
|
|
287
|
+
- **Responsive by Default**: Automatically switches between mobile and desktop modes at the `md` breakpoint
|
|
288
|
+
- **Mobile Behavior**: Slides from left with overlay backdrop and swipe-to-close gestures
|
|
289
|
+
- **Desktop Behavior**: Slides from right and pushes layout content (no overlay)
|
|
290
|
+
- **Single Component**: No need to manually handle `variant` or screen size detection
|
|
291
|
+
- **Customizable Width**: Desktop width is configurable (default: 24rem)
|
|
292
|
+
|
|
293
|
+
### Usage
|
|
294
|
+
|
|
295
|
+
```tsx
|
|
296
|
+
import {
|
|
297
|
+
Drawer,
|
|
298
|
+
DrawerHeader,
|
|
299
|
+
DrawerTitle,
|
|
300
|
+
DrawerBody,
|
|
301
|
+
DrawerFooter
|
|
302
|
+
} from '@alkimi/ui-kit'
|
|
303
|
+
|
|
304
|
+
function MyComponent() {
|
|
305
|
+
const [isOpen, setIsOpen] = useState(false)
|
|
306
|
+
|
|
307
|
+
return (
|
|
308
|
+
<>
|
|
309
|
+
<button onClick={() => setIsOpen(true)}>Open Drawer</button>
|
|
310
|
+
|
|
311
|
+
<Drawer isOpen={isOpen} onClose={() => setIsOpen(false)} width="28rem">
|
|
312
|
+
<DrawerHeader>
|
|
313
|
+
<DrawerTitle>Settings</DrawerTitle>
|
|
314
|
+
</DrawerHeader>
|
|
315
|
+
|
|
316
|
+
<DrawerBody>
|
|
317
|
+
<p>Drawer content goes here...</p>
|
|
318
|
+
</DrawerBody>
|
|
319
|
+
|
|
320
|
+
<DrawerFooter>
|
|
321
|
+
<button onClick={() => setIsOpen(false)}>Close</button>
|
|
322
|
+
</DrawerFooter>
|
|
323
|
+
</Drawer>
|
|
324
|
+
</>
|
|
325
|
+
)
|
|
326
|
+
}
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Components
|
|
330
|
+
|
|
331
|
+
- **Drawer**: Main container component
|
|
332
|
+
- **DrawerHeader**: Header with optional close button (`showCloseButton` prop)
|
|
333
|
+
- **DrawerTitle**: Styled title for the header
|
|
334
|
+
- **DrawerBody**: Scrollable content area
|
|
335
|
+
- **DrawerFooter**: Footer for actions/buttons
|
|
336
|
+
|
|
337
|
+
### Responsive Behavior
|
|
338
|
+
|
|
339
|
+
- **Mobile (< md)**: Slides from left, full overlay, swipe gestures
|
|
340
|
+
- **Desktop (≥ md)**: Slides from right, pushes content, no overlay
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## Input
|
|
345
|
+
|
|
346
|
+
```tsx
|
|
347
|
+
import { Input, type InputProps } from "@alkimi.org/ui-kit"
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
A versatile input component for text, email, password, and other input types.
|
|
351
|
+
|
|
352
|
+
### Usage
|
|
353
|
+
|
|
354
|
+
```tsx
|
|
355
|
+
<Input type="text" placeholder="Enter your name" />
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### Features
|
|
359
|
+
|
|
360
|
+
- Supports all standard HTML input types
|
|
361
|
+
- Accessible with proper focus states
|
|
362
|
+
- Disabled state support
|
|
363
|
+
- File input support
|
|
364
|
+
- Customizable with className prop
|
|
365
|
+
- Works with Field component for labels and descriptions
|
|
366
|
+
|
|
367
|
+
### Input Types
|
|
368
|
+
|
|
369
|
+
- **text**: Standard text input
|
|
370
|
+
- **email**: Email input with validation
|
|
371
|
+
- **password**: Password input (masked)
|
|
372
|
+
- **number**: Numeric input
|
|
373
|
+
- **search**: Search input
|
|
374
|
+
- **tel**: Telephone number input
|
|
375
|
+
- **url**: URL input
|
|
376
|
+
- **file**: File upload input
|
|
377
|
+
|
|
378
|
+
### Field Component
|
|
379
|
+
|
|
380
|
+
Use the Field component pattern for consistent form layouts with labels and descriptions:
|
|
381
|
+
|
|
382
|
+
```tsx
|
|
383
|
+
<Field>
|
|
384
|
+
<FieldLabel htmlFor="email">Email</FieldLabel>
|
|
385
|
+
<Input type="email" id="email" placeholder="name@example.com" />
|
|
386
|
+
<FieldDescription>We'll never share your email.</FieldDescription>
|
|
387
|
+
</Field>
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
### Props
|
|
392
|
+
|
|
393
|
+
| Prop | Type | Default | Description |
|
|
394
|
+
|------|------|---------|-------------|
|
|
395
|
+
| error? | `boolean` | - | - |
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## Textarea
|
|
400
|
+
|
|
401
|
+
```tsx
|
|
402
|
+
import { Textarea, type TextareaProps } from "@alkimi.org/ui-kit"
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
A multi-line text input component for longer text content.
|
|
406
|
+
|
|
407
|
+
### Usage
|
|
408
|
+
|
|
409
|
+
```tsx
|
|
410
|
+
<Textarea placeholder="Enter your message" />
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
### Features
|
|
414
|
+
|
|
415
|
+
- Multi-line text input
|
|
416
|
+
- Accessible with proper focus states
|
|
417
|
+
- Disabled state support
|
|
418
|
+
- Error state support
|
|
419
|
+
- Customizable with className prop
|
|
420
|
+
- Works with Field component for labels and descriptions
|
|
421
|
+
|
|
422
|
+
### Field Component
|
|
423
|
+
|
|
424
|
+
Use the Field component pattern for consistent form layouts with labels and descriptions:
|
|
425
|
+
|
|
426
|
+
```tsx
|
|
427
|
+
<Field>
|
|
428
|
+
<FieldLabel htmlFor="message">Message</FieldLabel>
|
|
429
|
+
<Textarea id="message" placeholder="Enter your message" />
|
|
430
|
+
<FieldDescription>Maximum 500 characters.</FieldDescription>
|
|
431
|
+
</Field>
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
### Props
|
|
436
|
+
|
|
437
|
+
| Prop | Type | Default | Description |
|
|
438
|
+
|------|------|---------|-------------|
|
|
439
|
+
| error? | `boolean` | - | - |
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
## FileUpload
|
|
444
|
+
|
|
445
|
+
```tsx
|
|
446
|
+
import { FileUpload, type FileUploadProps } from "@alkimi.org/ui-kit"
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
A drag-and-drop file upload component with format validation and file size limits.
|
|
450
|
+
|
|
451
|
+
### Usage
|
|
452
|
+
|
|
453
|
+
```tsx
|
|
454
|
+
<FileUpload
|
|
455
|
+
accept=".png,.jpg,.pdf"
|
|
456
|
+
maxSize={10 * 1024 * 1024}
|
|
457
|
+
onFilesChange={(files) => console.log(files)}
|
|
458
|
+
/>
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Features
|
|
462
|
+
|
|
463
|
+
- Drag and drop support
|
|
464
|
+
- Click to browse files
|
|
465
|
+
- File format filtering with `accept` prop (automatically displayed)
|
|
466
|
+
- Maximum file size validation with `maxSize` prop (automatically displayed)
|
|
467
|
+
- Multiple file upload support
|
|
468
|
+
- File list with remove option
|
|
469
|
+
- Error state support
|
|
470
|
+
- Disabled state support
|
|
471
|
+
- Accessible keyboard navigation
|
|
472
|
+
|
|
473
|
+
### Props
|
|
474
|
+
|
|
475
|
+
- **accept**: Accepted file formats (e.g., ".png,.jpg,.pdf" or "image/*") - automatically displayed below the upload text
|
|
476
|
+
- **maxSize**: Maximum file size in bytes - automatically displayed as "up to X MB/KB"
|
|
477
|
+
- **multiple**: Allow multiple files (default: false)
|
|
478
|
+
- **onFilesChange**: Callback when files are selected
|
|
479
|
+
- **error**: Show error state
|
|
480
|
+
- **disabled**: Disable the component
|
|
481
|
+
- **description**: Additional description text
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
### Props
|
|
485
|
+
|
|
486
|
+
| Prop | Type | Default | Description |
|
|
487
|
+
|------|------|---------|-------------|
|
|
488
|
+
| accept? | `string` | - | Accepted file formats (e.g., ".png,.jpg,.pdf" or "image/*") |
|
|
489
|
+
| maxSize? | `number` | - | Maximum file size in bytes |
|
|
490
|
+
| multiple? | `boolean` | `false` | Allow multiple files |
|
|
491
|
+
| onFilesChange? | `(files: File[]) =\> void` | - | Callback when files are selected |
|
|
492
|
+
| error? | `boolean` | - | Error state |
|
|
493
|
+
| disabled? | `boolean` | - | Disabled state |
|
|
494
|
+
| className? | `string` | `"h-4 w-4 text-secondary-text"` | Custom class name |
|
|
495
|
+
| placeholder? | `string` | - | Placeholder text |
|
|
496
|
+
| description? | `string` | - | Description text (e.g., "PNG, JPG up to 10MB") |
|
|
497
|
+
|
|
498
|
+
---
|
|
499
|
+
|
|
500
|
+
## Label
|
|
501
|
+
|
|
502
|
+
```tsx
|
|
503
|
+
import { Label } from "@alkimi.org/ui-kit"
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## Calendar
|
|
509
|
+
|
|
510
|
+
```tsx
|
|
511
|
+
import { Calendar } from "@alkimi.org/ui-kit"
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
---
|
|
515
|
+
|
|
516
|
+
## DatePicker
|
|
517
|
+
|
|
518
|
+
```tsx
|
|
519
|
+
import { DatePicker, type DatePickerProps } from "@alkimi.org/ui-kit"
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
A date picker component built with react-day-picker and date-fns, following the Shadcn pattern.
|
|
523
|
+
|
|
524
|
+
### Usage
|
|
525
|
+
|
|
526
|
+
```tsx
|
|
527
|
+
import { DatePicker } from "@alkimi.org/ui-kit"
|
|
528
|
+
import { useState } from "react"
|
|
529
|
+
|
|
530
|
+
function MyComponent() {
|
|
531
|
+
const [date, setDate] = useState<Date>()
|
|
532
|
+
|
|
533
|
+
return (
|
|
534
|
+
<DatePicker
|
|
535
|
+
date={date}
|
|
536
|
+
onDateChange={setDate}
|
|
537
|
+
placeholder="Pick a date"
|
|
538
|
+
/>
|
|
539
|
+
)
|
|
540
|
+
}
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### Features
|
|
544
|
+
|
|
545
|
+
- Beautiful calendar UI with month/year navigation
|
|
546
|
+
- Date selection with visual feedback
|
|
547
|
+
- Modal popover that closes when a date is selected
|
|
548
|
+
- Keyboard navigation support
|
|
549
|
+
- Accessible (ARIA compliant)
|
|
550
|
+
- Customizable date format
|
|
551
|
+
- Disabled state support
|
|
552
|
+
- Min/max date restrictions
|
|
553
|
+
- Integrates with Field component for labels and descriptions
|
|
554
|
+
|
|
555
|
+
### Date Formatting
|
|
556
|
+
|
|
557
|
+
Uses date-fns for formatting. Default format is "PPP" (e.g., "April 29, 2023").
|
|
558
|
+
Common formats:
|
|
559
|
+
- "PPP": Long format (April 29, 2023)
|
|
560
|
+
- "PP": Medium format (Apr 29, 2023)
|
|
561
|
+
- "P": Short format (04/29/2023)
|
|
562
|
+
- "yyyy-MM-dd": ISO format (2023-04-29)
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
### Props
|
|
566
|
+
|
|
567
|
+
| Prop | Type | Default | Description |
|
|
568
|
+
|------|------|---------|-------------|
|
|
569
|
+
| date? | `Date` | - | - |
|
|
570
|
+
| onDateChange? | `(date: Date \| undefined) =\> void` | - | - |
|
|
571
|
+
| placeholder? | `string` | `"Pick a date"` | - |
|
|
572
|
+
| disabled? | `boolean` | `false` | - |
|
|
573
|
+
| className? | `string` | `"w-auto p-0 rounded-3xl"` | - |
|
|
574
|
+
| calendarProps? | `Omit\<` | - | - |
|
|
575
|
+
| formatStr? | `string` | `"PPP"` | - |
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
## DateRangePicker
|
|
580
|
+
|
|
581
|
+
```tsx
|
|
582
|
+
import { DateRangePicker, type DateRangePickerProps } from "@alkimi.org/ui-kit"
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
A date range picker component built with react-day-picker and date-fns, following the Shadcn pattern.
|
|
586
|
+
|
|
587
|
+
### Usage
|
|
588
|
+
|
|
589
|
+
```tsx
|
|
590
|
+
import { DateRangePicker } from "@alkimi.org/ui-kit"
|
|
591
|
+
import { useState } from "react"
|
|
592
|
+
import type { DateRange } from "react-day-picker"
|
|
593
|
+
|
|
594
|
+
function MyComponent() {
|
|
595
|
+
const [dateRange, setDateRange] = useState<DateRange>()
|
|
596
|
+
|
|
597
|
+
return (
|
|
598
|
+
<DateRangePicker
|
|
599
|
+
dateRange={dateRange}
|
|
600
|
+
onDateRangeChange={setDateRange}
|
|
601
|
+
placeholder="Select date range"
|
|
602
|
+
/>
|
|
603
|
+
)
|
|
604
|
+
}
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### Features
|
|
608
|
+
|
|
609
|
+
- Beautiful calendar UI with month/year navigation
|
|
610
|
+
- Date range selection with visual feedback
|
|
611
|
+
- Modal popover that stays open until both dates are selected
|
|
612
|
+
- Keyboard navigation support
|
|
613
|
+
- Accessible (ARIA compliant)
|
|
614
|
+
- Customizable date format
|
|
615
|
+
- Disabled state support
|
|
616
|
+
- Min/max date restrictions
|
|
617
|
+
- Configurable number of months to display
|
|
618
|
+
- Integrates with Field component for labels and descriptions
|
|
619
|
+
|
|
620
|
+
### Date Formatting
|
|
621
|
+
|
|
622
|
+
Uses date-fns for formatting. Default format is "LLL dd, y" (e.g., "Apr 29, 2023").
|
|
623
|
+
Common formats:
|
|
624
|
+
- "LLL dd, y": Medium format (Apr 29, 2023)
|
|
625
|
+
- "PP": Medium format (Apr 29, 2023)
|
|
626
|
+
- "P": Short format (04/29/2023)
|
|
627
|
+
- "yyyy-MM-dd": ISO format (2023-04-29)
|
|
628
|
+
|
|
629
|
+
|
|
630
|
+
### Props
|
|
631
|
+
|
|
632
|
+
| Prop | Type | Default | Description |
|
|
633
|
+
|------|------|---------|-------------|
|
|
634
|
+
| dateRange? | `DateRange` | - | - |
|
|
635
|
+
| onDateRangeChange? | `(dateRange: DateRange \| undefined) =\> void` | - | - |
|
|
636
|
+
| placeholder? | `string` | `"Pick a date range"` | - |
|
|
637
|
+
| disabled? | `boolean` | `false` | - |
|
|
638
|
+
| className? | `string` | `"w-auto p-0"` | - |
|
|
639
|
+
| calendarProps? | `Omit\<` | - | - |
|
|
640
|
+
| formatStr? | `string` | `"LLL dd, y"` | - |
|
|
641
|
+
| numberOfMonths? | `number` | `2` | - |
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
## Field
|
|
646
|
+
|
|
647
|
+
```tsx
|
|
648
|
+
import { Field, FieldLabel, FieldDescription, type FieldProps, type FieldLabelProps, type FieldDescriptionProps } from "@alkimi.org/ui-kit"
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
**Components:** `Field`, `FieldLabel`, `FieldDescription`
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
### Props
|
|
655
|
+
|
|
656
|
+
| Prop | Type | Default | Description |
|
|
657
|
+
|------|------|---------|-------------|
|
|
658
|
+
| error? | `boolean` | - | - |
|
|
659
|
+
|
|
660
|
+
---
|
|
661
|
+
|
|
662
|
+
## Separator
|
|
663
|
+
|
|
664
|
+
```tsx
|
|
665
|
+
import { Separator } from "@alkimi.org/ui-kit"
|
|
666
|
+
```
|
|
667
|
+
|
|
668
|
+
---
|
|
669
|
+
|
|
670
|
+
## Skeleton
|
|
671
|
+
|
|
672
|
+
```tsx
|
|
673
|
+
import { Skeleton } from "@alkimi.org/ui-kit"
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
---
|
|
677
|
+
|
|
678
|
+
## ScrollArea
|
|
679
|
+
|
|
680
|
+
```tsx
|
|
681
|
+
import { ScrollArea, ScrollBar } from "@alkimi.org/ui-kit"
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
**Components:** `ScrollArea`, `ScrollBar`
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
## Sheet
|
|
689
|
+
|
|
690
|
+
```tsx
|
|
691
|
+
import { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription } from "@alkimi.org/ui-kit"
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
**Components:** `Sheet`, `SheetPortal`, `SheetOverlay`, `SheetTrigger`, `SheetClose`, `SheetContent`, `SheetHeader`, `SheetFooter`, `SheetTitle`, `SheetDescription`
|
|
695
|
+
|
|
696
|
+
---
|
|
697
|
+
|
|
698
|
+
## Tooltip
|
|
699
|
+
|
|
700
|
+
```tsx
|
|
701
|
+
import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "@alkimi.org/ui-kit"
|
|
702
|
+
```
|
|
703
|
+
|
|
704
|
+
**Components:** `Tooltip`, `TooltipTrigger`, `TooltipContent`, `TooltipProvider`
|
|
705
|
+
|
|
706
|
+
A popup tooltip component that displays additional information on hover.
|
|
707
|
+
|
|
708
|
+
### Usage
|
|
709
|
+
|
|
710
|
+
```tsx
|
|
711
|
+
<TooltipProvider>
|
|
712
|
+
<Tooltip>
|
|
713
|
+
<TooltipTrigger asChild>
|
|
714
|
+
<Button>Hover me</Button>
|
|
715
|
+
</TooltipTrigger>
|
|
716
|
+
<TooltipContent>
|
|
717
|
+
<p>Tooltip message</p>
|
|
718
|
+
</TooltipContent>
|
|
719
|
+
</Tooltip>
|
|
720
|
+
</TooltipProvider>
|
|
721
|
+
```
|
|
722
|
+
|
|
723
|
+
### Component Structure
|
|
724
|
+
|
|
725
|
+
- **TooltipProvider**: Must wrap app root or parent component (controls delay)
|
|
726
|
+
- **Tooltip**: Individual tooltip wrapper
|
|
727
|
+
- **TooltipTrigger**: Element that triggers the tooltip (use `asChild` to pass props)
|
|
728
|
+
- **TooltipContent**: The tooltip message (supports `asChild` to render custom components)
|
|
729
|
+
|
|
730
|
+
### Props
|
|
731
|
+
|
|
732
|
+
- **side**: Position (top, bottom, left, right)
|
|
733
|
+
- **delayDuration**: Hover delay in ms (set on TooltipProvider)
|
|
734
|
+
- **asChild**: Use on TooltipContent to render a Button or custom component as the tooltip content
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
## DropdownMenu
|
|
739
|
+
|
|
740
|
+
```tsx
|
|
741
|
+
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuGroup, DropdownMenuPortal, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuRadioGroup } from "@alkimi.org/ui-kit"
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
**Components:** `DropdownMenu`, `DropdownMenuTrigger`, `DropdownMenuContent`, `DropdownMenuItem`, `DropdownMenuCheckboxItem`, `DropdownMenuRadioItem`, `DropdownMenuLabel`, `DropdownMenuSeparator`, `DropdownMenuShortcut`, `DropdownMenuGroup`, `DropdownMenuPortal`, `DropdownMenuSub`, `DropdownMenuSubContent`, `DropdownMenuSubTrigger`, `DropdownMenuRadioGroup`
|
|
745
|
+
|
|
746
|
+
A dropdown menu component that displays a list of actions or options when triggered.
|
|
747
|
+
|
|
748
|
+
### Usage
|
|
749
|
+
|
|
750
|
+
```tsx
|
|
751
|
+
<DropdownMenu>
|
|
752
|
+
<DropdownMenuTrigger asChild>
|
|
753
|
+
<Button>Open Menu</Button>
|
|
754
|
+
</DropdownMenuTrigger>
|
|
755
|
+
<DropdownMenuContent>
|
|
756
|
+
<DropdownMenuItem>Profile</DropdownMenuItem>
|
|
757
|
+
<DropdownMenuItem>Settings</DropdownMenuItem>
|
|
758
|
+
<DropdownMenuSeparator />
|
|
759
|
+
<DropdownMenuItem>Logout</DropdownMenuItem>
|
|
760
|
+
</DropdownMenuContent>
|
|
761
|
+
</DropdownMenu>
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
### Component Structure
|
|
765
|
+
|
|
766
|
+
- **DropdownMenu**: Root container
|
|
767
|
+
- **DropdownMenuTrigger**: Button or element that opens the menu
|
|
768
|
+
- **DropdownMenuContent**: Container for menu items
|
|
769
|
+
- **DropdownMenuItem**: Individual menu action
|
|
770
|
+
- **DropdownMenuLabel**: Section label
|
|
771
|
+
- **DropdownMenuSeparator**: Visual divider
|
|
772
|
+
- **DropdownMenuCheckboxItem**: Checkbox menu item
|
|
773
|
+
- **DropdownMenuRadioGroup**: Radio button group
|
|
774
|
+
- **DropdownMenuRadioItem**: Radio menu item
|
|
775
|
+
- **DropdownMenuShortcut**: Keyboard shortcut display
|
|
776
|
+
- **DropdownMenuSub**: Submenu container
|
|
777
|
+
- **DropdownMenuSubTrigger**: Opens a submenu
|
|
778
|
+
- **DropdownMenuSubContent**: Submenu content
|
|
779
|
+
|
|
780
|
+
### Features
|
|
781
|
+
|
|
782
|
+
- Keyboard navigation support
|
|
783
|
+
- Checkbox and radio button items
|
|
784
|
+
- Nested submenus
|
|
785
|
+
- Keyboard shortcuts display
|
|
786
|
+
- Separator and label support
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
## Table
|
|
791
|
+
|
|
792
|
+
```tsx
|
|
793
|
+
import { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCellAction, TableCaption } from "@alkimi.org/ui-kit"
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
**Components:** `Table`, `TableHeader`, `TableBody`, `TableFooter`, `TableHead`, `TableRow`, `TableCell`, `TableCellAction`, `TableCaption`
|
|
797
|
+
|
|
798
|
+
A flexible table component with multiple sub-components for structured data display.
|
|
799
|
+
|
|
800
|
+
### Usage
|
|
801
|
+
|
|
802
|
+
```tsx
|
|
803
|
+
<Table>
|
|
804
|
+
<TableHeader>
|
|
805
|
+
<TableRow>
|
|
806
|
+
<TableHead>Name</TableHead>
|
|
807
|
+
<TableHead>Status</TableHead>
|
|
808
|
+
<TableHead>Role</TableHead>
|
|
809
|
+
</TableRow>
|
|
810
|
+
</TableHeader>
|
|
811
|
+
<TableBody>
|
|
812
|
+
<TableRow>
|
|
813
|
+
<TableCell>John Doe</TableCell>
|
|
814
|
+
<TableCell>Active</TableCell>
|
|
815
|
+
<TableCell>Admin</TableCell>
|
|
816
|
+
</TableRow>
|
|
817
|
+
</TableBody>
|
|
818
|
+
</Table>
|
|
819
|
+
```
|
|
820
|
+
|
|
821
|
+
### Component Structure
|
|
822
|
+
|
|
823
|
+
- **Table**: Root container with overflow handling
|
|
824
|
+
- **TableHeader**: Header section containing column headers
|
|
825
|
+
- **TableBody**: Main content area with table rows
|
|
826
|
+
- **TableFooter**: Footer section for summary data
|
|
827
|
+
- **TableRow**: Individual table row
|
|
828
|
+
- **TableHead**: Header cell (used in TableHeader)
|
|
829
|
+
- **TableCell**: Data cell (used in TableBody and TableFooter)
|
|
830
|
+
- **TableCaption**: Caption text below the table
|
|
831
|
+
|
|
832
|
+
### Features
|
|
833
|
+
|
|
834
|
+
- Responsive overflow handling
|
|
835
|
+
- Hover states on rows
|
|
836
|
+
- Clickable rows with isClickable prop
|
|
837
|
+
- Action icons in first column (eye or more menu)
|
|
838
|
+
- Selected state support
|
|
839
|
+
- Flexible styling with className props
|
|
840
|
+
- Sticky first column for horizontal scrolling tables
|
|
841
|
+
### Props
|
|
842
|
+
|
|
843
|
+
- **stickyFirstColumn**: When true, keeps the first column fixed while scrolling horizontally
|
|
844
|
+
- **rounded**: Controls border-radius size — `"default"` (20px) or `"sm"` (16px)
|
|
845
|
+
|
|
846
|
+
### Clickable Rows
|
|
847
|
+
|
|
848
|
+
Set isClickable={true} on TableRow to enable enhanced hover effects and cursor pointer styling. Clickable rows automatically get:
|
|
849
|
+
- Cursor pointer styling
|
|
850
|
+
- Enhanced hover effects (hover:bg-secondary/50)
|
|
851
|
+
|
|
852
|
+
### Action Icons
|
|
853
|
+
|
|
854
|
+
Add action icons to table rows using the actionIcon prop. Set actionIcon="eye" for an eye icon or actionIcon="more" for three vertical dots. The icon appears in the first column.
|
|
855
|
+
|
|
856
|
+
To maintain alignment when some rows have icons and others don't, set actionIcon={null} for rows without icons. This ensures all rows have the first column space reserved. Remember to add an empty TableHead in the header row to align the action column.
|
|
857
|
+
|
|
858
|
+
### Cell Actions
|
|
859
|
+
|
|
860
|
+
Use `TableCellAction` to add clickable action buttons inside table cells that work independently from row clicks. The component automatically stops event propagation, so clicking an action won't trigger the row's onClick handler.
|
|
861
|
+
|
|
862
|
+
```tsx
|
|
863
|
+
<TableRow isClickable onClick={() => selectRow(id)}>
|
|
864
|
+
<TableCell>Name</TableCell>
|
|
865
|
+
<TableCell>
|
|
866
|
+
<TableCellAction onClick={() => openLink(url)}>
|
|
867
|
+
<ExternalLink className="h-4 w-4" />
|
|
868
|
+
</TableCellAction>
|
|
869
|
+
</TableCell>
|
|
870
|
+
<TableCell className="text-right">
|
|
871
|
+
<div className="flex justify-end gap-1">
|
|
872
|
+
<TableCellAction onClick={() => handleEdit(id)}>
|
|
873
|
+
<Pencil className="h-4 w-4" />
|
|
874
|
+
</TableCellAction>
|
|
875
|
+
<TableCellAction onClick={() => handleDelete(id)}>
|
|
876
|
+
<Trash2 className="h-4 w-4" />
|
|
877
|
+
</TableCellAction>
|
|
878
|
+
</div>
|
|
879
|
+
</TableCell>
|
|
880
|
+
</TableRow>
|
|
881
|
+
```
|
|
882
|
+
|
|
883
|
+
TableCellAction features:
|
|
884
|
+
- Stops event propagation (won't trigger row click)
|
|
885
|
+
- Hover styles with background and text color change
|
|
886
|
+
- Focus-visible ring for keyboard navigation
|
|
887
|
+
- Works with all row types (hoverable, with icons, plain)
|
|
888
|
+
- Supports `asChild` prop for custom elements (like anchor tags)
|
|
889
|
+
|
|
890
|
+
### Sticky First Column
|
|
891
|
+
|
|
892
|
+
For tables with many columns that require horizontal scrolling, you can keep the first column fixed in place using the `stickyFirstColumn` prop on the Table component. This ensures the first column remains visible while scrolling through other columns.
|
|
893
|
+
|
|
894
|
+
```tsx
|
|
895
|
+
<Table stickyFirstColumn>
|
|
896
|
+
<TableHeader>
|
|
897
|
+
<TableRow>
|
|
898
|
+
<TableHead>Name</TableHead>
|
|
899
|
+
<TableHead>Column 2</TableHead>
|
|
900
|
+
<TableHead>Column 3</TableHead>
|
|
901
|
+
{/* ... more columns */}
|
|
902
|
+
</TableRow>
|
|
903
|
+
</TableHeader>
|
|
904
|
+
<TableBody>
|
|
905
|
+
<TableRow>
|
|
906
|
+
<TableCell>Row 1</TableCell>
|
|
907
|
+
<TableCell>Data</TableCell>
|
|
908
|
+
<TableCell>Data</TableCell>
|
|
909
|
+
</TableRow>
|
|
910
|
+
</TableBody>
|
|
911
|
+
</Table>
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
The `stickyFirstColumn` prop automatically makes the first column sticky - no additional props needed on individual cells.
|
|
915
|
+
|
|
916
|
+
For more granular control, you can use the `isSticky` prop on individual `TableHead` or `TableCell` components.
|
|
917
|
+
|
|
918
|
+
### Sticky Column with Action Icons
|
|
919
|
+
|
|
920
|
+
When combining `stickyFirstColumn` with `actionIcon`, the table automatically makes both the action icon column and the first data column sticky. The action icon column stays at the left edge, and the data column is pinned right next to it.
|
|
921
|
+
|
|
922
|
+
To align the header row correctly, set `actionIcon={null}` on the header `TableRow`. This reserves the space for the icon column without rendering an icon, keeping all columns properly aligned.
|
|
923
|
+
|
|
924
|
+
```tsx
|
|
925
|
+
<Table stickyFirstColumn>
|
|
926
|
+
<TableHeader>
|
|
927
|
+
<TableRow actionIcon={null}>
|
|
928
|
+
<TableHead>Name</TableHead>
|
|
929
|
+
<TableHead>Column 2</TableHead>
|
|
930
|
+
</TableRow>
|
|
931
|
+
</TableHeader>
|
|
932
|
+
<TableBody>
|
|
933
|
+
<TableRow actionIcon="eye" isClickable>
|
|
934
|
+
<TableCell>Row 1</TableCell>
|
|
935
|
+
<TableCell>Data</TableCell>
|
|
936
|
+
</TableRow>
|
|
937
|
+
</TableBody>
|
|
938
|
+
</Table>
|
|
939
|
+
```
|
|
940
|
+
|
|
941
|
+
Sticky columns with action icons feature:
|
|
942
|
+
- Both the icon and first data column stay fixed while scrolling
|
|
943
|
+
- Hover highlights apply to both sticky columns with an opaque background to prevent content bleeding through
|
|
944
|
+
- The header row is excluded from hover effects
|
|
945
|
+
- A vertical divider separates the sticky columns from the scrollable area
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
### Props
|
|
949
|
+
|
|
950
|
+
| Prop | Type | Default | Description |
|
|
951
|
+
|------|------|---------|-------------|
|
|
952
|
+
| stickyFirstColumn? | `boolean` | - | - |
|
|
953
|
+
| rounded? | `"default" \| "sm"` | `"default"` | - |
|
|
954
|
+
| isClickable? | `boolean` | - | - |
|
|
955
|
+
| actionIcon? | `"eye" \| "more" \| null` | - | - |
|
|
956
|
+
| isSticky? | `boolean` | - | - |
|
|
957
|
+
| isSticky? | `boolean` | - | - |
|
|
958
|
+
| asChild? | `boolean` | `false` | - |
|
|
959
|
+
|
|
960
|
+
---
|
|
961
|
+
|
|
962
|
+
## Popover
|
|
963
|
+
|
|
964
|
+
```tsx
|
|
965
|
+
import { Popover, PopoverTrigger, PopoverContent } from "@alkimi.org/ui-kit"
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
**Components:** `Popover`, `PopoverTrigger`, `PopoverContent`
|
|
969
|
+
|
|
970
|
+
---
|
|
971
|
+
|
|
972
|
+
## Dialog
|
|
973
|
+
|
|
974
|
+
```tsx
|
|
975
|
+
import { Dialog, DialogPortal, DialogOverlay, DialogClose, DialogTrigger, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription } from "@alkimi.org/ui-kit"
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
**Components:** `Dialog`, `DialogPortal`, `DialogOverlay`, `DialogClose`, `DialogTrigger`, `DialogContent`, `DialogHeader`, `DialogFooter`, `DialogTitle`, `DialogDescription`
|
|
979
|
+
|
|
980
|
+
A modal dialog component built on Radix UI Dialog primitive.
|
|
981
|
+
|
|
982
|
+
### Features
|
|
983
|
+
|
|
984
|
+
- **Accessible**: Built with Radix UI primitives for full keyboard navigation and screen reader support
|
|
985
|
+
- **Responsive**: Automatically renders as a centered dialog on desktop and a bottom drawer on mobile
|
|
986
|
+
- **Customizable**: Style with Tailwind CSS classes
|
|
987
|
+
- **Animated**: Smooth enter/exit animations with backdrop blur
|
|
988
|
+
- **Focus Management**: Automatically traps focus within the dialog
|
|
989
|
+
- **Escape to Close**: Press Escape key to close the dialog
|
|
990
|
+
- **Click Outside**: Click the backdrop to close the dialog
|
|
991
|
+
|
|
992
|
+
### Usage
|
|
993
|
+
|
|
994
|
+
```tsx
|
|
995
|
+
import {
|
|
996
|
+
Dialog,
|
|
997
|
+
DialogTrigger,
|
|
998
|
+
DialogContent,
|
|
999
|
+
DialogHeader,
|
|
1000
|
+
DialogTitle,
|
|
1001
|
+
DialogDescription,
|
|
1002
|
+
DialogFooter
|
|
1003
|
+
} from '@alkimi.org/ui-kit/dialog'
|
|
1004
|
+
|
|
1005
|
+
function MyComponent() {
|
|
1006
|
+
return (
|
|
1007
|
+
<Dialog>
|
|
1008
|
+
<DialogTrigger asChild>
|
|
1009
|
+
<button>Open Dialog</button>
|
|
1010
|
+
</DialogTrigger>
|
|
1011
|
+
<DialogContent>
|
|
1012
|
+
<DialogHeader>
|
|
1013
|
+
<DialogTitle>Dialog Title</DialogTitle>
|
|
1014
|
+
<DialogDescription>
|
|
1015
|
+
Dialog description goes here
|
|
1016
|
+
</DialogDescription>
|
|
1017
|
+
</DialogHeader>
|
|
1018
|
+
|
|
1019
|
+
<div>Dialog content...</div>
|
|
1020
|
+
|
|
1021
|
+
<DialogFooter>
|
|
1022
|
+
<button>Cancel</button>
|
|
1023
|
+
<button>Confirm</button>
|
|
1024
|
+
</DialogFooter>
|
|
1025
|
+
</DialogContent>
|
|
1026
|
+
</Dialog>
|
|
1027
|
+
)
|
|
1028
|
+
}
|
|
1029
|
+
```
|
|
1030
|
+
|
|
1031
|
+
### Components
|
|
1032
|
+
|
|
1033
|
+
- **Dialog**: Root component that manages open/close state
|
|
1034
|
+
- **DialogTrigger**: Button that opens the dialog (use `asChild` to pass custom trigger)
|
|
1035
|
+
- **DialogContent**: The modal content container
|
|
1036
|
+
- Props:
|
|
1037
|
+
- `showCloseButton?: boolean` - Show/hide the X close button (default: `true`)
|
|
1038
|
+
- `closeOnOverlayClick?: boolean` - Allow closing via clicking outside or Escape key (default: `true`)
|
|
1039
|
+
- **DialogHeader**: Header section for title and description
|
|
1040
|
+
- **DialogTitle**: Accessible title for the dialog
|
|
1041
|
+
- **DialogDescription**: Optional description text
|
|
1042
|
+
- **DialogFooter**: Footer section for action buttons
|
|
1043
|
+
- **DialogClose**: Wrapper for buttons that should close the dialog
|
|
1044
|
+
|
|
1045
|
+
---
|
|
1046
|
+
|
|
1047
|
+
## Command
|
|
1048
|
+
|
|
1049
|
+
```tsx
|
|
1050
|
+
import { Command, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandGroup, CommandItem, CommandShortcut, CommandSeparator } from "@alkimi.org/ui-kit"
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
**Components:** `Command`, `CommandDialog`, `CommandInput`, `CommandList`, `CommandEmpty`, `CommandGroup`, `CommandItem`, `CommandShortcut`, `CommandSeparator`
|
|
1054
|
+
|
|
1055
|
+
---
|
|
1056
|
+
|
|
1057
|
+
## Combobox
|
|
1058
|
+
|
|
1059
|
+
```tsx
|
|
1060
|
+
import { Combobox, type ComboboxOption, type ComboboxGroup, type ComboboxProps } from "@alkimi.org/ui-kit"
|
|
1061
|
+
```
|
|
1062
|
+
|
|
1063
|
+
A searchable select component that combines a button trigger with a command palette for filtering options. Supports both single and multiple selection modes.
|
|
1064
|
+
|
|
1065
|
+
### Usage
|
|
1066
|
+
|
|
1067
|
+
### Single Selection
|
|
1068
|
+
|
|
1069
|
+
```tsx
|
|
1070
|
+
const frameworks = [
|
|
1071
|
+
{ value: "next.js", label: "Next.js" },
|
|
1072
|
+
{ value: "react", label: "React" },
|
|
1073
|
+
{ value: "vue", label: "Vue" },
|
|
1074
|
+
]
|
|
1075
|
+
|
|
1076
|
+
const [value, setValue] = React.useState("")
|
|
1077
|
+
|
|
1078
|
+
<Combobox
|
|
1079
|
+
options={frameworks}
|
|
1080
|
+
value={value}
|
|
1081
|
+
onValueChange={setValue}
|
|
1082
|
+
placeholder="Select framework..."
|
|
1083
|
+
/>
|
|
1084
|
+
```
|
|
1085
|
+
|
|
1086
|
+
### Multiple Selection
|
|
1087
|
+
|
|
1088
|
+
```tsx
|
|
1089
|
+
const [values, setValues] = React.useState<string[]>([])
|
|
1090
|
+
|
|
1091
|
+
<Combobox
|
|
1092
|
+
options={frameworks}
|
|
1093
|
+
multiple
|
|
1094
|
+
values={values}
|
|
1095
|
+
onValuesChange={setValues}
|
|
1096
|
+
placeholder="Select frameworks..."
|
|
1097
|
+
/>
|
|
1098
|
+
```
|
|
1099
|
+
|
|
1100
|
+
### With Error State
|
|
1101
|
+
|
|
1102
|
+
```tsx
|
|
1103
|
+
<Combobox
|
|
1104
|
+
options={frameworks}
|
|
1105
|
+
value={value}
|
|
1106
|
+
onValueChange={setValue}
|
|
1107
|
+
error={!value}
|
|
1108
|
+
placeholder="Select framework..."
|
|
1109
|
+
/>
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
### Grouped Options
|
|
1113
|
+
|
|
1114
|
+
```tsx
|
|
1115
|
+
const groups = [
|
|
1116
|
+
{
|
|
1117
|
+
label: "Frontend",
|
|
1118
|
+
options: [
|
|
1119
|
+
{ value: "react", label: "React" },
|
|
1120
|
+
{ value: "vue", label: "Vue" },
|
|
1121
|
+
],
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
label: "Backend",
|
|
1125
|
+
options: [
|
|
1126
|
+
{ value: "node", label: "Node.js" },
|
|
1127
|
+
{ value: "django", label: "Django" },
|
|
1128
|
+
],
|
|
1129
|
+
},
|
|
1130
|
+
]
|
|
1131
|
+
|
|
1132
|
+
<Combobox
|
|
1133
|
+
groups={groups}
|
|
1134
|
+
value={value}
|
|
1135
|
+
onValueChange={setValue}
|
|
1136
|
+
placeholder="Select framework..."
|
|
1137
|
+
/>
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
### Metrics Variant
|
|
1141
|
+
|
|
1142
|
+
```tsx
|
|
1143
|
+
const metrics = [
|
|
1144
|
+
{ value: "revenue", label: "Revenue", color: "#4ade80" },
|
|
1145
|
+
{ value: "buyback", label: "Buyback", color: "#facc15" },
|
|
1146
|
+
{ value: "mcap", label: "Mcap", color: "#f87171" },
|
|
1147
|
+
]
|
|
1148
|
+
|
|
1149
|
+
const [values, setValues] = React.useState<string[]>([])
|
|
1150
|
+
|
|
1151
|
+
<Combobox
|
|
1152
|
+
options={metrics}
|
|
1153
|
+
variant="metrics"
|
|
1154
|
+
values={values}
|
|
1155
|
+
onValuesChange={setValues}
|
|
1156
|
+
placeholder="Add Metrics"
|
|
1157
|
+
/>
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
### Features
|
|
1161
|
+
|
|
1162
|
+
- **Single & Multiple Selection**: Choose between single or multi-select mode
|
|
1163
|
+
- **Grouped Options**: Organize items under labeled headings with the `groups` prop
|
|
1164
|
+
- **Searchable Dropdown**: Filter options with keyboard navigation
|
|
1165
|
+
- **Error State**: Built-in validation styling for forms
|
|
1166
|
+
- **Badge Display**: Multiple selections shown as removable badges
|
|
1167
|
+
- **Smart Display**: Shows count badge when multiple items selected (e.g., "3 selected")
|
|
1168
|
+
- **Customizable Messages**: Customize placeholder, search, and empty state text
|
|
1169
|
+
- **Controlled State**: Full control over selected value(s)
|
|
1170
|
+
- **Accessible**: Proper ARIA attributes and keyboard support
|
|
1171
|
+
- **Disabled State**: Disable interaction when needed
|
|
1172
|
+
- **Auto-width**: Dropdown matches trigger button width
|
|
1173
|
+
- **Metrics Variant**: External colored chips with custom colors per option
|
|
1174
|
+
|
|
1175
|
+
### Props
|
|
1176
|
+
|
|
1177
|
+
- `options`: Array of `{ value: string, label: string, color?: string }` objects
|
|
1178
|
+
- `groups`: Array of `{ label: string, options: ComboboxOption[] }` objects for grouped display
|
|
1179
|
+
- `value`: Current selected value (single mode)
|
|
1180
|
+
- `onValueChange`: Callback when value changes (single mode)
|
|
1181
|
+
- `values`: Array of selected values (multiple mode)
|
|
1182
|
+
- `onValuesChange`: Callback when values change (multiple mode)
|
|
1183
|
+
- `multiple`: Enable multiple selection mode
|
|
1184
|
+
- `variant`: Visual variant - `"default"` or `"metrics"` (external colored chips)
|
|
1185
|
+
- `error`: Show error state styling
|
|
1186
|
+
- `disabled`: Disable the combobox
|
|
1187
|
+
- `placeholder`: Button placeholder text
|
|
1188
|
+
- `searchPlaceholder`: Search input placeholder
|
|
1189
|
+
- `emptyMessage`: Message shown when no results found
|
|
1190
|
+
- `searchable`: Enable/disable search input (default: `true`)
|
|
1191
|
+
- `showChipRemoveIcon`: Show/hide remove icon on metric chips (default: `true`)
|
|
1192
|
+
- `className`: Additional CSS classes
|
|
1193
|
+
|
|
1194
|
+
### When to Use
|
|
1195
|
+
|
|
1196
|
+
Use a Combobox when:
|
|
1197
|
+
- You have a list of options that users need to search through
|
|
1198
|
+
- The list is too long for a standard select dropdown
|
|
1199
|
+
- You want to provide keyboard-driven navigation
|
|
1200
|
+
- You need both search and selection capabilities
|
|
1201
|
+
- You need single or multiple selection with validation
|
|
1202
|
+
|
|
1203
|
+
### Anatomy
|
|
1204
|
+
|
|
1205
|
+
The Combobox is composed of:
|
|
1206
|
+
- **Button**: The trigger that opens the popover
|
|
1207
|
+
- **Popover**: The container for the command palette
|
|
1208
|
+
- **Command**: The searchable list component
|
|
1209
|
+
- **CommandInput**: The search input field
|
|
1210
|
+
- **CommandList**: The scrollable list of options
|
|
1211
|
+
- **CommandItem**: Individual selectable items
|
|
1212
|
+
- **Badge Display**: Selected items shown as removable badges (multiple mode)
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
### Props
|
|
1216
|
+
|
|
1217
|
+
| Prop | Type | Default | Description |
|
|
1218
|
+
|------|------|---------|-------------|
|
|
1219
|
+
| options? | `ComboboxOption[]` | `[]` | - |
|
|
1220
|
+
| groups? | `ComboboxGroup[]` | - | - |
|
|
1221
|
+
| value? | `string` | - | - |
|
|
1222
|
+
| onValueChange? | `(value: string) =\> void` | - | - |
|
|
1223
|
+
| placeholder? | `string` | `"Select option..."` | - |
|
|
1224
|
+
| searchPlaceholder? | `string` | `"Search..."` | - |
|
|
1225
|
+
| emptyMessage? | `string` | `"No option found."` | - |
|
|
1226
|
+
| disabled? | `boolean` | `false` | - |
|
|
1227
|
+
| disableLabelControls? | `boolean` | `false` | - |
|
|
1228
|
+
| className? | `string` | `"flex flex-wrap items-center gap-2"` | - |
|
|
1229
|
+
| error? | `boolean` | `false` | - |
|
|
1230
|
+
| multiple? | `boolean` | `false` | - |
|
|
1231
|
+
| values? | `string[]` | `[]` | - |
|
|
1232
|
+
| onValuesChange? | `(values: string[]) =\> void` | - | - |
|
|
1233
|
+
| variant? | `"default" \| "metrics"` | `"default"` | - |
|
|
1234
|
+
| searchable? | `boolean` | `true` | - |
|
|
1235
|
+
| onTriggerClick? | `() =\> void` | - | - |
|
|
1236
|
+
| showChipRemoveIcon? | `boolean` | `true` | - |
|
|
1237
|
+
| triggerProps? | `React.ButtonHTMLAttributes\<HTMLButtonElement\>` | - | - |
|
|
1238
|
+
|
|
1239
|
+
### ComboboxOption
|
|
1240
|
+
|
|
1241
|
+
```typescript
|
|
1242
|
+
interface ComboboxOption {
|
|
1243
|
+
value: string
|
|
1244
|
+
label: string
|
|
1245
|
+
color?: string
|
|
1246
|
+
}
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
### ComboboxGroup
|
|
1250
|
+
|
|
1251
|
+
```typescript
|
|
1252
|
+
interface ComboboxGroup {
|
|
1253
|
+
label: string
|
|
1254
|
+
options: ComboboxOption[]
|
|
1255
|
+
}
|
|
1256
|
+
```
|
|
1257
|
+
|
|
1258
|
+
---
|
|
1259
|
+
|
|
1260
|
+
## Checkbox
|
|
1261
|
+
|
|
1262
|
+
```tsx
|
|
1263
|
+
import { Checkbox } from "@alkimi.org/ui-kit"
|
|
1264
|
+
```
|
|
1265
|
+
|
|
1266
|
+
A checkbox component for selecting one or multiple options from a list.
|
|
1267
|
+
|
|
1268
|
+
### Usage
|
|
1269
|
+
|
|
1270
|
+
```tsx
|
|
1271
|
+
<div className="flex items-center space-x-2">
|
|
1272
|
+
<Checkbox id="terms" />
|
|
1273
|
+
<Label htmlFor="terms">Accept terms and conditions</Label>
|
|
1274
|
+
</div>
|
|
1275
|
+
```
|
|
1276
|
+
|
|
1277
|
+
### Modes
|
|
1278
|
+
|
|
1279
|
+
- **Uncontrolled**: Use `defaultChecked` prop
|
|
1280
|
+
- **Controlled**: Use `checked` and `onCheckedChange` props
|
|
1281
|
+
|
|
1282
|
+
### Props
|
|
1283
|
+
|
|
1284
|
+
- **checked**: Controlled state (can be `true`, `false`, or `'indeterminate'`)
|
|
1285
|
+
- **defaultChecked**: Default state for uncontrolled mode
|
|
1286
|
+
- **onCheckedChange**: Callback when state changes
|
|
1287
|
+
- **disabled**: Prevents user interaction
|
|
1288
|
+
|
|
1289
|
+
Fully accessible with proper labeling support.
|
|
1290
|
+
|
|
1291
|
+
---
|
|
1292
|
+
|
|
1293
|
+
## TreeSelect
|
|
1294
|
+
|
|
1295
|
+
```tsx
|
|
1296
|
+
import { TreeSelect, type TreeSelectNode, type TreeSelectProps } from "@alkimi.org/ui-kit"
|
|
1297
|
+
```
|
|
1298
|
+
|
|
1299
|
+
A hierarchical tree select component that supports arbitrary nesting depth, searchable options, and both single and multiple selection modes. Ideal for selecting from categorized data like IAB content taxonomies.
|
|
1300
|
+
|
|
1301
|
+
### Usage
|
|
1302
|
+
|
|
1303
|
+
### Single Selection
|
|
1304
|
+
|
|
1305
|
+
```tsx
|
|
1306
|
+
const categories: TreeSelectNode[] = [
|
|
1307
|
+
{
|
|
1308
|
+
value: "tech",
|
|
1309
|
+
label: "Technology",
|
|
1310
|
+
children: [
|
|
1311
|
+
{ value: "web", label: "Web Development" },
|
|
1312
|
+
{ value: "mobile", label: "Mobile Development" },
|
|
1313
|
+
],
|
|
1314
|
+
},
|
|
1315
|
+
]
|
|
1316
|
+
|
|
1317
|
+
const [value, setValue] = React.useState("")
|
|
1318
|
+
|
|
1319
|
+
<TreeSelect
|
|
1320
|
+
nodes={categories}
|
|
1321
|
+
value={value}
|
|
1322
|
+
onValueChange={setValue}
|
|
1323
|
+
placeholder="Select category..."
|
|
1324
|
+
/>
|
|
1325
|
+
```
|
|
1326
|
+
|
|
1327
|
+
### Multiple Selection
|
|
1328
|
+
|
|
1329
|
+
```tsx
|
|
1330
|
+
const [values, setValues] = React.useState<string[]>([])
|
|
1331
|
+
|
|
1332
|
+
<TreeSelect
|
|
1333
|
+
nodes={categories}
|
|
1334
|
+
multiple
|
|
1335
|
+
values={values}
|
|
1336
|
+
onValuesChange={setValues}
|
|
1337
|
+
placeholder="Select categories..."
|
|
1338
|
+
/>
|
|
1339
|
+
```
|
|
1340
|
+
|
|
1341
|
+
### Features
|
|
1342
|
+
|
|
1343
|
+
- **Arbitrary Nesting Depth**: Supports any number of levels in the tree hierarchy
|
|
1344
|
+
- **Single & Multiple Selection**: Toggle between single and multi-select modes
|
|
1345
|
+
- **Cascading Selection**: Selecting a parent automatically selects/deselects all children
|
|
1346
|
+
- **Indeterminate State**: Parent checkboxes show indeterminate state when partially selected
|
|
1347
|
+
- **Smart Chips**: Multi-select shows minimal chip set (parent chip replaces individual children when all selected)
|
|
1348
|
+
- **Searchable**: Filter nodes by typing with automatic ancestor path preservation
|
|
1349
|
+
- **Keyboard Navigation**: Full arrow key, Enter, Space, Home, End support
|
|
1350
|
+
- **Expand/Collapse**: Individually toggle node expansion or expand all by default
|
|
1351
|
+
- **Error State**: Built-in validation styling for forms
|
|
1352
|
+
- **Accessible**: WAI-ARIA treeview pattern with proper roles and attributes
|
|
1353
|
+
|
|
1354
|
+
### Props
|
|
1355
|
+
|
|
1356
|
+
- `nodes`: Array of `TreeSelectNode` objects (recursive: `{ value, label, children? }`)
|
|
1357
|
+
- `value`: Current selected value (single-select mode)
|
|
1358
|
+
- `onValueChange`: Callback when value changes (single-select mode)
|
|
1359
|
+
- `values`: Array of selected values (multi-select mode)
|
|
1360
|
+
- `onValuesChange`: Callback when values change (multi-select mode)
|
|
1361
|
+
- `multiple`: Enable multiple selection mode with checkboxes
|
|
1362
|
+
- `error`: Show error state styling
|
|
1363
|
+
- `disabled`: Disable the tree select
|
|
1364
|
+
- `placeholder`: Button placeholder text
|
|
1365
|
+
- `searchPlaceholder`: Search input placeholder
|
|
1366
|
+
- `emptyMessage`: Message shown when no results found
|
|
1367
|
+
- `className`: Additional CSS classes
|
|
1368
|
+
- `defaultExpandedValues`: Array of node values to expand initially
|
|
1369
|
+
- `expandAll`: Expand all nodes initially
|
|
1370
|
+
|
|
1371
|
+
### Keyboard Navigation
|
|
1372
|
+
|
|
1373
|
+
- **Arrow Down/Up**: Move focus between visible nodes
|
|
1374
|
+
- **Arrow Right**: Expand a collapsed node, or move to first child
|
|
1375
|
+
- **Arrow Left**: Collapse an expanded node
|
|
1376
|
+
- **Enter/Space**: Toggle selection of focused node
|
|
1377
|
+
- **Home/End**: Move to first/last visible node
|
|
1378
|
+
|
|
1379
|
+
|
|
1380
|
+
### Props
|
|
1381
|
+
|
|
1382
|
+
| Prop | Type | Default | Description |
|
|
1383
|
+
|------|------|---------|-------------|
|
|
1384
|
+
| nodes | `TreeSelectNode[]` | - | - |
|
|
1385
|
+
| value? | `string` | - | - |
|
|
1386
|
+
| onValueChange? | `(value: string) =\> void` | - | - |
|
|
1387
|
+
| multiple? | `boolean` | `false` | - |
|
|
1388
|
+
| values? | `string[]` | `[]` | - |
|
|
1389
|
+
| onValuesChange? | `(values: string[]) =\> void` | - | - |
|
|
1390
|
+
| placeholder? | `string` | `"Select..."` | - |
|
|
1391
|
+
| searchPlaceholder? | `string` | `"Search..."` | - |
|
|
1392
|
+
| emptyMessage? | `string` | `"No results found."` | - |
|
|
1393
|
+
| disabled? | `boolean` | `false` | - |
|
|
1394
|
+
| className? | `string` | `"py-6 text-center text-sm text-muted-foreground"` | - |
|
|
1395
|
+
| error? | `boolean` | `false` | - |
|
|
1396
|
+
| defaultExpandedValues? | `string[]` | - | - |
|
|
1397
|
+
| expandAll? | `boolean` | `false` | - |
|
|
1398
|
+
|
|
1399
|
+
### TreeSelectNode
|
|
1400
|
+
|
|
1401
|
+
```typescript
|
|
1402
|
+
interface TreeSelectNode {
|
|
1403
|
+
value: string
|
|
1404
|
+
label: string
|
|
1405
|
+
children?: TreeSelectNode[]
|
|
1406
|
+
}
|
|
1407
|
+
```
|
|
1408
|
+
|
|
1409
|
+
---
|
|
1410
|
+
|
|
1411
|
+
## RadioGroup
|
|
1412
|
+
|
|
1413
|
+
```tsx
|
|
1414
|
+
import { RadioGroup, RadioGroupItem } from "@alkimi.org/ui-kit"
|
|
1415
|
+
```
|
|
1416
|
+
|
|
1417
|
+
**Components:** `RadioGroup`, `RadioGroupItem`
|
|
1418
|
+
|
|
1419
|
+
A radio group component for selecting a single option from a list.
|
|
1420
|
+
|
|
1421
|
+
### Usage
|
|
1422
|
+
|
|
1423
|
+
```tsx
|
|
1424
|
+
<RadioGroup defaultValue="option-1">
|
|
1425
|
+
<div className="flex items-center space-x-2">
|
|
1426
|
+
<RadioGroupItem value="option-1" id="option-1" />
|
|
1427
|
+
<label htmlFor="option-1">Option 1</label>
|
|
1428
|
+
</div>
|
|
1429
|
+
<div className="flex items-center space-x-2">
|
|
1430
|
+
<RadioGroupItem value="option-2" id="option-2" />
|
|
1431
|
+
<label htmlFor="option-2">Option 2</label>
|
|
1432
|
+
</div>
|
|
1433
|
+
</RadioGroup>
|
|
1434
|
+
```
|
|
1435
|
+
|
|
1436
|
+
### Modes
|
|
1437
|
+
|
|
1438
|
+
- **Uncontrolled**: Use `defaultValue` prop
|
|
1439
|
+
- **Controlled**: Use `value` and `onValueChange` props
|
|
1440
|
+
|
|
1441
|
+
### Props
|
|
1442
|
+
|
|
1443
|
+
- **value**: Controlled selected value
|
|
1444
|
+
- **defaultValue**: Default selected value for uncontrolled mode
|
|
1445
|
+
- **onValueChange**: Callback when selection changes
|
|
1446
|
+
- **disabled**: Prevents user interaction on all items
|
|
1447
|
+
|
|
1448
|
+
Fully accessible with keyboard navigation and proper ARIA roles.
|
|
1449
|
+
|
|
1450
|
+
---
|
|
1451
|
+
|
|
1452
|
+
## Accordion
|
|
1453
|
+
|
|
1454
|
+
```tsx
|
|
1455
|
+
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "@alkimi.org/ui-kit"
|
|
1456
|
+
```
|
|
1457
|
+
|
|
1458
|
+
**Components:** `Accordion`, `AccordionItem`, `AccordionTrigger`, `AccordionContent`
|
|
1459
|
+
|
|
1460
|
+
A vertically stacked set of interactive headings that each reveal an associated section of content, built on Radix UI Accordion primitive.
|
|
1461
|
+
|
|
1462
|
+
### Features
|
|
1463
|
+
|
|
1464
|
+
- **Accessible**: Full keyboard navigation and screen reader support via Radix UI
|
|
1465
|
+
- **Single or Multiple**: Supports opening one item at a time or multiple simultaneously
|
|
1466
|
+
- **Animated**: Smooth expand/collapse animations
|
|
1467
|
+
- **Collapsible**: In single mode, the open item can be collapsed by clicking it again
|
|
1468
|
+
- **Customizable**: Style with Tailwind CSS classes
|
|
1469
|
+
|
|
1470
|
+
### Usage
|
|
1471
|
+
|
|
1472
|
+
```tsx
|
|
1473
|
+
import {
|
|
1474
|
+
Accordion,
|
|
1475
|
+
AccordionItem,
|
|
1476
|
+
AccordionTrigger,
|
|
1477
|
+
AccordionContent,
|
|
1478
|
+
} from '@alkimi/ui-kit'
|
|
1479
|
+
|
|
1480
|
+
function MyComponent() {
|
|
1481
|
+
return (
|
|
1482
|
+
<Accordion type="single" collapsible>
|
|
1483
|
+
<AccordionItem value="item-1">
|
|
1484
|
+
<AccordionTrigger>Section 1</AccordionTrigger>
|
|
1485
|
+
<AccordionContent>
|
|
1486
|
+
Content for section 1
|
|
1487
|
+
</AccordionContent>
|
|
1488
|
+
</AccordionItem>
|
|
1489
|
+
</Accordion>
|
|
1490
|
+
)
|
|
1491
|
+
}
|
|
1492
|
+
```
|
|
1493
|
+
|
|
1494
|
+
### Components
|
|
1495
|
+
|
|
1496
|
+
- **Accordion**: Root component. Props:
|
|
1497
|
+
- `type: "single" | "multiple"` - Whether one or multiple items can be open
|
|
1498
|
+
- `collapsible?: boolean` - When `type="single"`, allows closing the open item
|
|
1499
|
+
- `defaultValue?: string | string[]` - Default open item(s)
|
|
1500
|
+
- **AccordionItem**: Wraps a trigger and content pair. Requires a unique `value` prop
|
|
1501
|
+
- **AccordionTrigger**: The clickable heading that toggles the content
|
|
1502
|
+
- **AccordionContent**: The collapsible content section
|
|
1503
|
+
|
|
1504
|
+
---
|
|
1505
|
+
|
|
1506
|
+
## Toaster
|
|
1507
|
+
|
|
1508
|
+
```tsx
|
|
1509
|
+
import { Toaster, toast } from "@alkimi.org/ui-kit"
|
|
1510
|
+
```
|
|
1511
|
+
|
|
1512
|
+
**Components:** `Toaster`, `toast`
|
|
1513
|
+
|
|
1514
|
+
A toast notification component built on top of [Sileo](https://sileo.aaryan.design). Provides physics-based, animated notifications for user feedback.
|
|
1515
|
+
|
|
1516
|
+
### Usage
|
|
1517
|
+
|
|
1518
|
+
First, import the library's CSS in your app entry point (e.g. `layout.tsx` or `globals.css`):
|
|
1519
|
+
|
|
1520
|
+
```tsx
|
|
1521
|
+
// layout.tsx or _app.tsx
|
|
1522
|
+
import "@alkimi.org/ui-kit/styles.css"
|
|
1523
|
+
```
|
|
1524
|
+
|
|
1525
|
+
Or via CSS:
|
|
1526
|
+
|
|
1527
|
+
```css
|
|
1528
|
+
/* globals.css */
|
|
1529
|
+
@import "@alkimi.org/ui-kit/styles.css";
|
|
1530
|
+
```
|
|
1531
|
+
|
|
1532
|
+
Then add the `Toaster` component to your app's root layout:
|
|
1533
|
+
|
|
1534
|
+
```tsx
|
|
1535
|
+
import { Toaster } from "@alkimi.org/ui-kit"
|
|
1536
|
+
|
|
1537
|
+
export default function RootLayout({ children }) {
|
|
1538
|
+
return (
|
|
1539
|
+
<html>
|
|
1540
|
+
<body>
|
|
1541
|
+
{children}
|
|
1542
|
+
<Toaster />
|
|
1543
|
+
</body>
|
|
1544
|
+
</html>
|
|
1545
|
+
)
|
|
1546
|
+
}
|
|
1547
|
+
```
|
|
1548
|
+
|
|
1549
|
+
Then use the `toast` function anywhere in your app:
|
|
1550
|
+
|
|
1551
|
+
```tsx
|
|
1552
|
+
import { toast } from "@alkimi.org/ui-kit"
|
|
1553
|
+
|
|
1554
|
+
function MyComponent() {
|
|
1555
|
+
return (
|
|
1556
|
+
<button onClick={() => toast.success({ title: "Hello!" })}>
|
|
1557
|
+
Show Toast
|
|
1558
|
+
</button>
|
|
1559
|
+
)
|
|
1560
|
+
}
|
|
1561
|
+
```
|
|
1562
|
+
|
|
1563
|
+
### Toast Types
|
|
1564
|
+
|
|
1565
|
+
```tsx
|
|
1566
|
+
toast.success({ title: "Changes saved" })
|
|
1567
|
+
|
|
1568
|
+
toast.error({
|
|
1569
|
+
title: "Something went wrong",
|
|
1570
|
+
description: "Please try again later.",
|
|
1571
|
+
})
|
|
1572
|
+
|
|
1573
|
+
toast.warning({ title: "Storage almost full" })
|
|
1574
|
+
|
|
1575
|
+
toast.info({ title: "New update available" })
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
### Action Toast
|
|
1579
|
+
|
|
1580
|
+
Use `toast.action()` to include an interactive button:
|
|
1581
|
+
|
|
1582
|
+
```tsx
|
|
1583
|
+
toast.action({
|
|
1584
|
+
title: "File uploaded",
|
|
1585
|
+
description: "Share it with your team?",
|
|
1586
|
+
button: {
|
|
1587
|
+
title: "Share",
|
|
1588
|
+
onClick: () => console.log("Shared!"),
|
|
1589
|
+
},
|
|
1590
|
+
})
|
|
1591
|
+
```
|
|
1592
|
+
|
|
1593
|
+
### Promise Toast
|
|
1594
|
+
|
|
1595
|
+
Chain loading, success, and error states from a single promise:
|
|
1596
|
+
|
|
1597
|
+
```tsx
|
|
1598
|
+
toast.promise(fetchData(), {
|
|
1599
|
+
loading: { title: "Loading..." },
|
|
1600
|
+
success: { title: "Done!" },
|
|
1601
|
+
error: { title: "Failed" },
|
|
1602
|
+
})
|
|
1603
|
+
```
|
|
1604
|
+
|
|
1605
|
+
The `promise` method returns the original promise, so you can chain further.
|
|
1606
|
+
|
|
1607
|
+
You can also pass functions to `success` and `error` to access the resolved/rejected value:
|
|
1608
|
+
|
|
1609
|
+
```tsx
|
|
1610
|
+
toast.promise(createUser(data), {
|
|
1611
|
+
loading: { title: "Creating account..." },
|
|
1612
|
+
success: (user) => ({ title: `Welcome, ${user.name}!` }),
|
|
1613
|
+
error: (err) => ({ title: "Signup failed", description: err.message }),
|
|
1614
|
+
})
|
|
1615
|
+
```
|
|
1616
|
+
|
|
1617
|
+
### Custom Icons
|
|
1618
|
+
|
|
1619
|
+
```tsx
|
|
1620
|
+
// Default state icon is shown automatically
|
|
1621
|
+
toast.success({ title: "Saved" })
|
|
1622
|
+
|
|
1623
|
+
// Override with a custom React node
|
|
1624
|
+
toast.success({ title: "Saved", icon: <YourIcon /> })
|
|
1625
|
+
```
|
|
1626
|
+
|
|
1627
|
+
### Options
|
|
1628
|
+
|
|
1629
|
+
```tsx
|
|
1630
|
+
toast.success({
|
|
1631
|
+
title: "Message", // required
|
|
1632
|
+
description: "Optional",
|
|
1633
|
+
duration: 5000, // ms — default 6000, null = persistent
|
|
1634
|
+
icon: <YourIcon />, // custom React node
|
|
1635
|
+
position: "bottom-center", // overrides Toaster default
|
|
1636
|
+
fill: "var(--toast-bg, #27272a)", // falls back to #27272a if CSS not imported
|
|
1637
|
+
styles: { // Tailwind classes per element
|
|
1638
|
+
title: "text-white!",
|
|
1639
|
+
description: "text-white/75!",
|
|
1640
|
+
badge: "bg-white/20!",
|
|
1641
|
+
button: "bg-white/10!",
|
|
1642
|
+
},
|
|
1643
|
+
button: {
|
|
1644
|
+
title: "Undo",
|
|
1645
|
+
onClick: () => console.log("Undo clicked"),
|
|
1646
|
+
},
|
|
1647
|
+
})
|
|
1648
|
+
```
|
|
1649
|
+
|
|
1650
|
+
### Theming
|
|
1651
|
+
|
|
1652
|
+
The toast badge/icon fill color is controlled by a single CSS variable:
|
|
1653
|
+
|
|
1654
|
+
```css
|
|
1655
|
+
:root {
|
|
1656
|
+
--toast-bg: #27272a; /* SVG badge/icon fill color */
|
|
1657
|
+
}
|
|
1658
|
+
```
|
|
1659
|
+
|
|
1660
|
+
This variable is set by the library after importing `@alkimi.org/ui-kit/styles.css`.
|
|
1661
|
+
If the CSS is **not** imported, `var(--toast-bg)` falls back to `#27272a` automatically — so the toast still renders correctly.
|
|
1662
|
+
|
|
1663
|
+
Override it globally in your own CSS:
|
|
1664
|
+
|
|
1665
|
+
```css
|
|
1666
|
+
:root {
|
|
1667
|
+
--toast-bg: #1a1a2e;
|
|
1668
|
+
}
|
|
1669
|
+
```
|
|
1670
|
+
|
|
1671
|
+
Or scope it to a specific page or component:
|
|
1672
|
+
|
|
1673
|
+
```css
|
|
1674
|
+
.my-page {
|
|
1675
|
+
--toast-bg: #1a1a2e;
|
|
1676
|
+
}
|
|
1677
|
+
```
|
|
1678
|
+
|
|
1679
|
+
To override on a single toast call, pass the value directly via `fill`:
|
|
1680
|
+
|
|
1681
|
+
```tsx
|
|
1682
|
+
toast.success({
|
|
1683
|
+
title: "Custom color",
|
|
1684
|
+
fill: "#1a1a2e",
|
|
1685
|
+
})
|
|
1686
|
+
```
|
|
1687
|
+
|
|
1688
|
+
### Position
|
|
1689
|
+
|
|
1690
|
+
Set the default position on `Toaster`, or override per toast:
|
|
1691
|
+
|
|
1692
|
+
```tsx
|
|
1693
|
+
<Toaster position="top-right" />
|
|
1694
|
+
|
|
1695
|
+
toast.success({ title: "Saved", position: "bottom-center" })
|
|
1696
|
+
```
|
|
1697
|
+
|
|
1698
|
+
Available positions: `top-left`, `top-center`, `top-right`, `bottom-left`, `bottom-center`, `bottom-right`
|
|
1699
|
+
|
|
1700
|
+
---
|
|
1701
|
+
|
|
1702
|
+
## Card
|
|
1703
|
+
|
|
1704
|
+
```tsx
|
|
1705
|
+
import { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from "@alkimi.org/ui-kit"
|
|
1706
|
+
```
|
|
1707
|
+
|
|
1708
|
+
**Components:** `Card`, `CardHeader`, `CardFooter`, `CardTitle`, `CardDescription`, `CardContent`
|
|
1709
|
+
|
|
1710
|
+
A flexible card container component with multiple sub-components for structured content.
|
|
1711
|
+
|
|
1712
|
+
### Usage
|
|
1713
|
+
|
|
1714
|
+
```tsx
|
|
1715
|
+
<Card>
|
|
1716
|
+
<CardHeader>
|
|
1717
|
+
<CardTitle>Card Title</CardTitle>
|
|
1718
|
+
<CardDescription>Card Description</CardDescription>
|
|
1719
|
+
</CardHeader>
|
|
1720
|
+
<CardContent>
|
|
1721
|
+
<p>Card Content</p>
|
|
1722
|
+
</CardContent>
|
|
1723
|
+
<CardFooter>
|
|
1724
|
+
<Button>Action</Button>
|
|
1725
|
+
</CardFooter>
|
|
1726
|
+
</Card>
|
|
1727
|
+
```
|
|
1728
|
+
|
|
1729
|
+
### Component Structure
|
|
1730
|
+
|
|
1731
|
+
- **Card**: Root container
|
|
1732
|
+
- **CardHeader**: Header section for title and description
|
|
1733
|
+
- **CardTitle**: Title text
|
|
1734
|
+
- **CardDescription**: Subtitle or description text
|
|
1735
|
+
- **CardContent**: Main content area
|
|
1736
|
+
- **CardFooter**: Footer section for actions
|
|
1737
|
+
|
|
1738
|
+
### Props
|
|
1739
|
+
|
|
1740
|
+
- **hoverable**: When true, adds hover effect with bg-secondary and cursor-pointer
|
|
1741
|
+
- **rounded**: Controls border-radius size — `"default"` (20px) or `"sm"` (16px)
|
|
1742
|
+
- **isAnimated**: When true, shows animated blurred blobs behind the card content
|
|
1743
|
+
|
|
1744
|
+
All sub-components are optional and can be used in any combination.
|
|
1745
|
+
|
|
1746
|
+
---
|
|
1747
|
+
|
|
1748
|
+
## Progress
|
|
1749
|
+
|
|
1750
|
+
```tsx
|
|
1751
|
+
import { Progress } from "@alkimi.org/ui-kit"
|
|
1752
|
+
```
|
|
1753
|
+
|
|
1754
|
+
A progress bar component for visualizing task completion or loading states.
|
|
1755
|
+
|
|
1756
|
+
### Usage
|
|
1757
|
+
|
|
1758
|
+
```tsx
|
|
1759
|
+
<Progress value={60} />
|
|
1760
|
+
<Progress value={100} className="h-4" />
|
|
1761
|
+
```
|
|
1762
|
+
|
|
1763
|
+
### Props
|
|
1764
|
+
|
|
1765
|
+
- **value**: Progress percentage (0-100)
|
|
1766
|
+
- **className**: Customize height using Tailwind (e.g., `h-1`, `h-4`)
|
|
1767
|
+
|
|
1768
|
+
### Use Cases
|
|
1769
|
+
|
|
1770
|
+
- File uploads
|
|
1771
|
+
- Form completion tracking
|
|
1772
|
+
- Skill level indicators
|
|
1773
|
+
- Any percentage-based metric visualization
|
|
1774
|
+
|
|
1775
|
+
---
|
|
1776
|
+
|
|
1777
|
+
## Slider
|
|
1778
|
+
|
|
1779
|
+
```tsx
|
|
1780
|
+
import { Slider } from "@alkimi.org/ui-kit"
|
|
1781
|
+
```
|
|
1782
|
+
|
|
1783
|
+
A slider component for selecting a value or range of values from a continuous range.
|
|
1784
|
+
|
|
1785
|
+
### Component Structure
|
|
1786
|
+
|
|
1787
|
+
The Slider component is built on top of Radix UI's Slider primitive and supports both single-value and range selections.
|
|
1788
|
+
|
|
1789
|
+
### Key Features
|
|
1790
|
+
|
|
1791
|
+
- **Single Value**: Select a single value from a range
|
|
1792
|
+
- **Range Selection**: Select a range with two thumbs (min and max)
|
|
1793
|
+
- **Vertical Orientation**: Display slider vertically
|
|
1794
|
+
- **Customizable Range**: Set custom min and max values
|
|
1795
|
+
- **Controlled/Uncontrolled**: Works with both controlled and uncontrolled patterns
|
|
1796
|
+
- **Accessible**: Full keyboard navigation and screen reader support
|
|
1797
|
+
|
|
1798
|
+
### Usage Example
|
|
1799
|
+
|
|
1800
|
+
```tsx
|
|
1801
|
+
// Single value (uncontrolled)
|
|
1802
|
+
<Slider defaultValue={[50]} min={0} max={100} />
|
|
1803
|
+
|
|
1804
|
+
// Single value (controlled)
|
|
1805
|
+
const [value, setValue] = React.useState([50])
|
|
1806
|
+
<Slider value={value} onValueChange={setValue} />
|
|
1807
|
+
|
|
1808
|
+
// Range selection
|
|
1809
|
+
<Slider defaultValue={[20, 80]} min={0} max={100} />
|
|
1810
|
+
|
|
1811
|
+
// Vertical slider
|
|
1812
|
+
<Slider defaultValue={[50]} orientation="vertical" className="h-64" />
|
|
1813
|
+
```
|
|
1814
|
+
|
|
1815
|
+
### Props
|
|
1816
|
+
|
|
1817
|
+
- **defaultValue**: Initial value(s) as an array (e.g., `[50]` or `[20, 80]`)
|
|
1818
|
+
- **value**: Controlled value(s) as an array
|
|
1819
|
+
- **onValueChange**: Callback when value changes
|
|
1820
|
+
- **min**: Minimum value (default: 0)
|
|
1821
|
+
- **max**: Maximum value (default: 100)
|
|
1822
|
+
- **step**: Step size for increments (default: 1)
|
|
1823
|
+
- **orientation**: `"horizontal"` or `"vertical"` (default: horizontal)
|
|
1824
|
+
- **disabled**: Disable the slider
|
|
1825
|
+
- **className**: Custom CSS classes
|
|
1826
|
+
|
|
1827
|
+
### Use Cases
|
|
1828
|
+
|
|
1829
|
+
- Volume controls
|
|
1830
|
+
- Price range filters
|
|
1831
|
+
- Time range selectors
|
|
1832
|
+
- Brightness/contrast adjustments
|
|
1833
|
+
- Any numeric input with visual feedback
|
|
1834
|
+
|
|
1835
|
+
---
|
|
1836
|
+
|
|
1837
|
+
## Switch
|
|
1838
|
+
|
|
1839
|
+
```tsx
|
|
1840
|
+
import { Switch } from "@alkimi.org/ui-kit"
|
|
1841
|
+
```
|
|
1842
|
+
|
|
1843
|
+
A toggle switch component for binary on/off states.
|
|
1844
|
+
|
|
1845
|
+
### Usage
|
|
1846
|
+
|
|
1847
|
+
```tsx
|
|
1848
|
+
<div className="flex items-center space-x-2">
|
|
1849
|
+
<Switch id="airplane" />
|
|
1850
|
+
<label htmlFor="airplane">Airplane mode</label>
|
|
1851
|
+
</div>
|
|
1852
|
+
```
|
|
1853
|
+
|
|
1854
|
+
### Modes
|
|
1855
|
+
|
|
1856
|
+
- **Uncontrolled**: Use `defaultChecked` prop
|
|
1857
|
+
- **Controlled**: Use `checked` and `onCheckedChange` props
|
|
1858
|
+
|
|
1859
|
+
### Props
|
|
1860
|
+
|
|
1861
|
+
- **checked**: Controlled state
|
|
1862
|
+
- **defaultChecked**: Default state for uncontrolled mode
|
|
1863
|
+
- **onCheckedChange**: Callback when state changes
|
|
1864
|
+
- **disabled**: Prevents user interaction
|
|
1865
|
+
|
|
1866
|
+
Perfect for settings, preferences, and feature toggles. Fully accessible.
|
|
1867
|
+
|
|
1868
|
+
---
|
|
1869
|
+
|
|
1870
|
+
## Breadcrumb
|
|
1871
|
+
|
|
1872
|
+
```tsx
|
|
1873
|
+
import { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis } from "@alkimi.org/ui-kit"
|
|
1874
|
+
```
|
|
1875
|
+
|
|
1876
|
+
**Components:** `Breadcrumb`, `BreadcrumbList`, `BreadcrumbItem`, `BreadcrumbLink`, `BreadcrumbPage`, `BreadcrumbSeparator`, `BreadcrumbEllipsis`
|
|
1877
|
+
|
|
1878
|
+
A breadcrumb navigation component that displays the user's location within the application hierarchy.
|
|
1879
|
+
|
|
1880
|
+
### Component Structure
|
|
1881
|
+
|
|
1882
|
+
- **Breadcrumb**: Root container
|
|
1883
|
+
- **BreadcrumbList**: Wrapper for breadcrumb items
|
|
1884
|
+
- **BreadcrumbItem**: Individual item in the breadcrumb trail
|
|
1885
|
+
- **BreadcrumbLink**: Clickable link for navigable items
|
|
1886
|
+
- **BreadcrumbPage**: Current page (non-clickable, end of trail)
|
|
1887
|
+
- **BreadcrumbSeparator**: Visual separator between items (defaults to chevron)
|
|
1888
|
+
- **BreadcrumbEllipsis**: Collapsed items indicator for long paths
|
|
1889
|
+
|
|
1890
|
+
### Usage
|
|
1891
|
+
|
|
1892
|
+
```tsx
|
|
1893
|
+
<Breadcrumb>
|
|
1894
|
+
<BreadcrumbList>
|
|
1895
|
+
<BreadcrumbItem>
|
|
1896
|
+
<BreadcrumbLink href="/">Home</BreadcrumbLink>
|
|
1897
|
+
</BreadcrumbItem>
|
|
1898
|
+
<BreadcrumbSeparator />
|
|
1899
|
+
<BreadcrumbItem>
|
|
1900
|
+
<BreadcrumbPage>Current</BreadcrumbPage>
|
|
1901
|
+
</BreadcrumbItem>
|
|
1902
|
+
</BreadcrumbList>
|
|
1903
|
+
</Breadcrumb>
|
|
1904
|
+
```
|
|
1905
|
+
|
|
1906
|
+
### Customization
|
|
1907
|
+
|
|
1908
|
+
- Use custom separators by passing children to BreadcrumbSeparator (e.g., icons, text)
|
|
1909
|
+
- Use BreadcrumbEllipsis for collapsed middle sections in long paths
|
|
1910
|
+
|
|
1911
|
+
---
|
|
1912
|
+
|
|
1913
|
+
## Utilities
|
|
1914
|
+
|
|
1915
|
+
```tsx
|
|
1916
|
+
import { cn } from "@alkimi.org/ui-kit"
|
|
1917
|
+
import { getSphericalGradient, getSeedColor } from "@alkimi.org/ui-kit"
|
|
1918
|
+
```
|
|
1919
|
+
|
|
1920
|
+
- `cn(...classes)` — Tailwind class merging utility (clsx + tailwind-merge)
|
|
1921
|
+
- `getSphericalGradient(seed)` — Generate a spherical gradient for avatars
|
|
1922
|
+
- `getSeedColor(seed)` — Generate a deterministic color from a seed string
|