@skunkworksai/ui-kit 0.1.18
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/AGENTS.md +250 -0
- package/README.md +429 -0
- package/dist/assets/Service-applets-apps/audience-measurement.png +0 -0
- package/dist/assets/Service-applets-apps/coatro-app.png +0 -0
- package/dist/assets/Service-applets-apps/content-effectiveness.png +0 -0
- package/dist/assets/Service-applets-apps/hop-tracking.png +0 -0
- package/dist/assets/Service-applets-apps/index.ts +13 -0
- package/dist/assets/Service-applets-apps/journeys-app.png +0 -0
- package/dist/assets/Service-applets-apps/people-counting.png +0 -0
- package/dist/assets/Service-applets-apps/petra.png +0 -0
- package/dist/assets/Service-applets-apps/sam-generic.png +0 -0
- package/dist/assets/Service-applets-apps/sami-for-environment.png +0 -0
- package/dist/assets/Service-applets-apps/shelf-engagement.png +0 -0
- package/dist/assets/Service-applets-apps/traffic-management.png +0 -0
- package/dist/assets/Service-applets-apps/viana.png +0 -0
- package/dist/assets/Service-applets-apps/zone-engagement.png +0 -0
- package/dist/assets/icons/Dashboard-active.svg +29 -0
- package/dist/assets/icons/Dashboard.svg +25 -0
- package/dist/assets/icons/DashboardActiveIcon.tsx +35 -0
- package/dist/assets/icons/DashboardIcon.tsx +31 -0
- package/dist/assets/icons/Devices-active.svg +27 -0
- package/dist/assets/icons/Devices.svg +20 -0
- package/dist/assets/icons/DevicesActiveIcon.tsx +33 -0
- package/dist/assets/icons/DevicesIcon.tsx +26 -0
- package/dist/assets/icons/Installer-active.svg +29 -0
- package/dist/assets/icons/Installer.svg +17 -0
- package/dist/assets/icons/InstallerActiveIcon.tsx +35 -0
- package/dist/assets/icons/InstallerIcon.tsx +23 -0
- package/dist/assets/icons/Manifest-active.svg +49 -0
- package/dist/assets/icons/Manifest.svg +49 -0
- package/dist/assets/icons/ManifestActiveIcon.tsx +55 -0
- package/dist/assets/icons/ManifestIcon.tsx +55 -0
- package/dist/assets/icons/Sensor-active.svg +15 -0
- package/dist/assets/icons/Sensor.svg +11 -0
- package/dist/assets/icons/SensorActiveIcon.tsx +21 -0
- package/dist/assets/icons/SensorIcon.tsx +17 -0
- package/dist/assets/icons/Site-active.svg +14 -0
- package/dist/assets/icons/Site.svg +10 -0
- package/dist/assets/icons/SiteActiveIcon.tsx +20 -0
- package/dist/assets/icons/SiteIcon.tsx +16 -0
- package/dist/assets/icons/X-ray-active.svg +199 -0
- package/dist/assets/icons/X-ray.svg +47 -0
- package/dist/assets/icons/XrayActiveIcon.tsx +205 -0
- package/dist/assets/icons/XrayIcon.tsx +53 -0
- package/dist/assets/icons/index.ts +14 -0
- package/dist/assets/logos/DarkLogo.tsx +28 -0
- package/dist/assets/logos/DarkSymbol.tsx +9 -0
- package/dist/assets/logos/PrimaryLogo.tsx +28 -0
- package/dist/assets/logos/PrimarySymbol.tsx +9 -0
- package/dist/assets/logos/WhiteLogo.tsx +28 -0
- package/dist/assets/logos/WhiteSymbol.tsx +9 -0
- package/dist/assets/logos/dark_logo.svg +22 -0
- package/dist/assets/logos/dark_symbol.svg +3 -0
- package/dist/assets/logos/index.ts +6 -0
- package/dist/assets/logos/primary-logo.svg +22 -0
- package/dist/assets/logos/primary_logo.svg +22 -0
- package/dist/assets/logos/primary_symbol.svg +3 -0
- package/dist/assets/logos/white_symbol.svg +3 -0
- package/dist/index.cjs +160 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +45276 -0
- package/dist/index.js.map +1 -0
- package/dist/tokens-source.css +121 -0
- package/dist/types/assets/Service-applets-apps/index.d.ts +13 -0
- package/dist/types/assets/icons/DashboardActiveIcon.d.ts +2 -0
- package/dist/types/assets/icons/DashboardIcon.d.ts +2 -0
- package/dist/types/assets/icons/DevicesActiveIcon.d.ts +2 -0
- package/dist/types/assets/icons/DevicesIcon.d.ts +2 -0
- package/dist/types/assets/icons/InstallerActiveIcon.d.ts +2 -0
- package/dist/types/assets/icons/InstallerIcon.d.ts +2 -0
- package/dist/types/assets/icons/ManifestActiveIcon.d.ts +2 -0
- package/dist/types/assets/icons/ManifestIcon.d.ts +2 -0
- package/dist/types/assets/icons/SensorActiveIcon.d.ts +2 -0
- package/dist/types/assets/icons/SensorIcon.d.ts +2 -0
- package/dist/types/assets/icons/SiteActiveIcon.d.ts +2 -0
- package/dist/types/assets/icons/SiteIcon.d.ts +2 -0
- package/dist/types/assets/icons/XrayActiveIcon.d.ts +2 -0
- package/dist/types/assets/icons/XrayIcon.d.ts +2 -0
- package/dist/types/assets/icons/index.d.ts +14 -0
- package/dist/types/assets/logos/DarkLogo.d.ts +2 -0
- package/dist/types/assets/logos/DarkSymbol.d.ts +2 -0
- package/dist/types/assets/logos/PrimaryLogo.d.ts +2 -0
- package/dist/types/assets/logos/PrimarySymbol.d.ts +2 -0
- package/dist/types/assets/logos/WhiteLogo.d.ts +2 -0
- package/dist/types/assets/logos/WhiteSymbol.d.ts +2 -0
- package/dist/types/assets/logos/index.d.ts +6 -0
- package/dist/types/components/blocks/AppBentoMenu.d.ts +31 -0
- package/dist/types/components/blocks/AppDashboard.d.ts +121 -0
- package/dist/types/components/blocks/AppHeader.d.ts +198 -0
- package/dist/types/components/blocks/AppLocationTreeFilter.d.ts +44 -0
- package/dist/types/components/blocks/AppNotificationsMenu.d.ts +50 -0
- package/dist/types/components/blocks/AppPageTitle.d.ts +86 -0
- package/dist/types/components/blocks/AppProfile.d.ts +53 -0
- package/dist/types/components/blocks/TableManager.d.ts +194 -0
- package/dist/types/components/blocks/backgrounds/AppDashboardBackgroundDots.d.ts +14 -0
- package/dist/types/components/blocks/backgrounds/AppDashboardBackgroundWave.d.ts +14 -0
- package/dist/types/components/blocks/backgrounds/index.d.ts +3 -0
- package/dist/types/components/blocks/backgrounds/types.d.ts +13 -0
- package/dist/types/components/blocks/index.d.ts +9 -0
- package/dist/types/components/primitives/AppAccordion.d.ts +22 -0
- package/dist/types/components/primitives/AppAlert.d.ts +33 -0
- package/dist/types/components/primitives/AppAlertDialog.d.ts +79 -0
- package/dist/types/components/primitives/AppAspectRatio.d.ts +7 -0
- package/dist/types/components/primitives/AppAvatar.d.ts +17 -0
- package/dist/types/components/primitives/AppBadge.d.ts +9 -0
- package/dist/types/components/primitives/AppBreadcrumb.d.ts +45 -0
- package/dist/types/components/primitives/AppButton.d.ts +24 -0
- package/dist/types/components/primitives/AppButtonGroup.d.ts +10 -0
- package/dist/types/components/primitives/AppCalendar.d.ts +51 -0
- package/dist/types/components/primitives/AppCard.d.ts +41 -0
- package/dist/types/components/primitives/AppCarousel.d.ts +26 -0
- package/dist/types/components/primitives/AppChart.d.ts +27 -0
- package/dist/types/components/primitives/AppCheckbox.d.ts +9 -0
- package/dist/types/components/primitives/AppCollapsible.d.ts +20 -0
- package/dist/types/components/primitives/AppCombobox.d.ts +37 -0
- package/dist/types/components/primitives/AppCommand.d.ts +47 -0
- package/dist/types/components/primitives/AppContextMenu.d.ts +82 -0
- package/dist/types/components/primitives/AppDataTable.d.ts +23 -0
- package/dist/types/components/primitives/AppDatePicker.d.ts +26 -0
- package/dist/types/components/primitives/AppDialog.d.ts +40 -0
- package/dist/types/components/primitives/AppDrawer.d.ts +58 -0
- package/dist/types/components/primitives/AppDropdownMenu.d.ts +85 -0
- package/dist/types/components/primitives/AppEmpty.d.ts +35 -0
- package/dist/types/components/primitives/AppField.d.ts +65 -0
- package/dist/types/components/primitives/AppForm.d.ts +58 -0
- package/dist/types/components/primitives/AppHoverCard.d.ts +19 -0
- package/dist/types/components/primitives/AppInput.d.ts +21 -0
- package/dist/types/components/primitives/AppKbd.d.ts +18 -0
- package/dist/types/components/primitives/AppLabel.d.ts +8 -0
- package/dist/types/components/primitives/AppMenubar.d.ts +83 -0
- package/dist/types/components/primitives/AppNavigationMenu.d.ts +51 -0
- package/dist/types/components/primitives/AppPagination.d.ts +46 -0
- package/dist/types/components/primitives/AppPopover.d.ts +20 -0
- package/dist/types/components/primitives/AppProgress.d.ts +9 -0
- package/dist/types/components/primitives/AppRadioGroup.d.ts +15 -0
- package/dist/types/components/primitives/AppScrollArea.d.ts +12 -0
- package/dist/types/components/primitives/AppScrollText.d.ts +7 -0
- package/dist/types/components/primitives/AppSelect.d.ts +46 -0
- package/dist/types/components/primitives/AppSeparator.d.ts +8 -0
- package/dist/types/components/primitives/AppSheet.d.ts +32 -0
- package/dist/types/components/primitives/AppSidebar.d.ts +59 -0
- package/dist/types/components/primitives/AppSkeleton.d.ts +6 -0
- package/dist/types/components/primitives/AppSpinner.d.ts +13 -0
- package/dist/types/components/primitives/AppSwitch.d.ts +8 -0
- package/dist/types/components/primitives/AppTable.d.ts +53 -0
- package/dist/types/components/primitives/AppTabs.d.ts +10 -0
- package/dist/types/components/primitives/AppTextarea.d.ts +9 -0
- package/dist/types/components/primitives/AppThemeProvider.d.ts +46 -0
- package/dist/types/components/primitives/AppToaster.d.ts +7 -0
- package/dist/types/components/primitives/AppToggle.d.ts +9 -0
- package/dist/types/components/primitives/AppToggleGroup.d.ts +18 -0
- package/dist/types/components/primitives/AppTooltip.d.ts +26 -0
- package/dist/types/components/primitives/AppTypography.d.ts +80 -0
- package/dist/types/components/primitives/index.d.ts +57 -0
- package/dist/types/components/ui/accordion.d.ts +7 -0
- package/dist/types/components/ui/alert-dialog.d.ts +20 -0
- package/dist/types/components/ui/alert.d.ts +8 -0
- package/dist/types/components/ui/aspect-ratio.d.ts +4 -0
- package/dist/types/components/ui/avatar.d.ts +6 -0
- package/dist/types/components/ui/badge.d.ts +9 -0
- package/dist/types/components/ui/breadcrumb.d.ts +19 -0
- package/dist/types/components/ui/button.d.ts +13 -0
- package/dist/types/components/ui/calendar.d.ts +8 -0
- package/dist/types/components/ui/card.d.ts +11 -0
- package/dist/types/components/ui/carousel.d.ts +28 -0
- package/dist/types/components/ui/chart.d.ts +48 -0
- package/dist/types/components/ui/checkbox.d.ts +4 -0
- package/dist/types/components/ui/collapsible.d.ts +6 -0
- package/dist/types/components/ui/combobox.d.ts +83 -0
- package/dist/types/components/ui/command.d.ts +82 -0
- package/dist/types/components/ui/context-menu.d.ts +27 -0
- package/dist/types/components/ui/dialog.d.ts +19 -0
- package/dist/types/components/ui/drawer.d.ts +23 -0
- package/dist/types/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/types/components/ui/empty.d.ts +14 -0
- package/dist/types/components/ui/field.d.ts +40 -0
- package/dist/types/components/ui/form.d.ts +22 -0
- package/dist/types/components/ui/hover-card.d.ts +6 -0
- package/dist/types/components/ui/input.d.ts +3 -0
- package/dist/types/components/ui/kbd.d.ts +4 -0
- package/dist/types/components/ui/label.d.ts +4 -0
- package/dist/types/components/ui/menubar.d.ts +30 -0
- package/dist/types/components/ui/navigation-menu.d.ts +12 -0
- package/dist/types/components/ui/pagination.d.ts +28 -0
- package/dist/types/components/ui/popover.d.ts +6 -0
- package/dist/types/components/ui/progress.d.ts +4 -0
- package/dist/types/components/ui/radio-group.d.ts +5 -0
- package/dist/types/components/ui/scroll-area.d.ts +5 -0
- package/dist/types/components/ui/scroll-text.d.ts +6 -0
- package/dist/types/components/ui/select.d.ts +13 -0
- package/dist/types/components/ui/separator.d.ts +4 -0
- package/dist/types/components/ui/sheet.d.ts +25 -0
- package/dist/types/components/ui/sidebar.d.ts +69 -0
- package/dist/types/components/ui/skeleton.d.ts +2 -0
- package/dist/types/components/ui/sonner.d.ts +2 -0
- package/dist/types/components/ui/switch.d.ts +4 -0
- package/dist/types/components/ui/table.d.ts +10 -0
- package/dist/types/components/ui/tabs.d.ts +19 -0
- package/dist/types/components/ui/textarea.d.ts +5 -0
- package/dist/types/components/ui/toggle-group.d.ts +15 -0
- package/dist/types/components/ui/toggle.d.ts +12 -0
- package/dist/types/components/ui/tooltip.d.ts +7 -0
- package/dist/types/hooks/use-mobile.d.ts +13 -0
- package/dist/types/hooks/use-page-title.d.ts +23 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lib/utils.d.ts +2 -0
- package/dist/ui-kit.css +1 -0
- package/package.json +117 -0
- package/rules/accordion.md +60 -0
- package/rules/alert-dialog.md +62 -0
- package/rules/alert.md +61 -0
- package/rules/aspect-ratio.md +47 -0
- package/rules/avatar.md +52 -0
- package/rules/badge.md +55 -0
- package/rules/bento-menu.md +86 -0
- package/rules/breadcrumb.md +80 -0
- package/rules/button-group.md +58 -0
- package/rules/button.md +66 -0
- package/rules/calendar.md +97 -0
- package/rules/card.md +84 -0
- package/rules/carousel.md +113 -0
- package/rules/chart.md +125 -0
- package/rules/checkbox.md +49 -0
- package/rules/collapsible.md +57 -0
- package/rules/combobox.md +133 -0
- package/rules/command.md +73 -0
- package/rules/context-menu.md +65 -0
- package/rules/dashboard.md +368 -0
- package/rules/data-table.md +91 -0
- package/rules/date-picker.md +65 -0
- package/rules/dialog.md +60 -0
- package/rules/drawer.md +65 -0
- package/rules/dropdown-menu.md +72 -0
- package/rules/empty.md +110 -0
- package/rules/field.md +149 -0
- package/rules/form.md +60 -0
- package/rules/header.md +245 -0
- package/rules/hover-card.md +53 -0
- package/rules/icons.md +141 -0
- package/rules/input.md +66 -0
- package/rules/kbd.md +58 -0
- package/rules/label.md +30 -0
- package/rules/location-tree-filter.md +165 -0
- package/rules/logo.md +58 -0
- package/rules/menubar.md +75 -0
- package/rules/navigation-menu.md +68 -0
- package/rules/notifications-menu.md +137 -0
- package/rules/pagetitle.md +160 -0
- package/rules/pagination.md +71 -0
- package/rules/popover.md +48 -0
- package/rules/profile.md +125 -0
- package/rules/progress.md +41 -0
- package/rules/radio-group.md +44 -0
- package/rules/scroll-area.md +32 -0
- package/rules/scroll-text.md +40 -0
- package/rules/select.md +86 -0
- package/rules/separator.md +43 -0
- package/rules/sheet.md +76 -0
- package/rules/sidebar.md +442 -0
- package/rules/skeleton.md +46 -0
- package/rules/spinner.md +43 -0
- package/rules/switch.md +46 -0
- package/rules/table-manager.md +306 -0
- package/rules/table.md +177 -0
- package/rules/tabs.md +82 -0
- package/rules/text.md +3 -0
- package/rules/textarea.md +38 -0
- package/rules/toaster.md +58 -0
- package/rules/toggle-group.md +50 -0
- package/rules/toggle.md +40 -0
- package/rules/tokens.md +88 -0
- package/rules/tooltip.md +78 -0
- package/rules/typography.md +81 -0
- package/scripts/scaffold.mjs +28 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# AppAccordion
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/components/accordion
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { AppAccordion, AppAccordionItem, AppAccordionTrigger, AppAccordionContent } from "@/components/primitives/AppAccordion"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## AppAccordion
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
|------|------|---------|-------------|
|
|
13
|
+
| `type` | `"single" \| "multiple"` | — | Determines whether a single or multiple items can be opened at once |
|
|
14
|
+
| `collapsible` | `boolean` | `false` | When `type` is "single", allows closing the open item by clicking the trigger |
|
|
15
|
+
| `defaultValue` | `string \| string[]` | — | The value of the item(s) to expand by default |
|
|
16
|
+
| `value` | `string \| string[]` | — | Controlled value of the expanded item(s) |
|
|
17
|
+
| `onValueChange` | `(value: string \| string[]) => void` | — | Event handler called when the expanded state changes |
|
|
18
|
+
|
|
19
|
+
## AppAccordionItem
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Default | Description |
|
|
22
|
+
|------|------|---------|-------------|
|
|
23
|
+
| `value` | `string` | — | A unique value for the item |
|
|
24
|
+
| `disabled` | `boolean` | `false` | When `true`, prevents the user from interacting with the item |
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### Basic
|
|
29
|
+
```tsx
|
|
30
|
+
<AppAccordion type="single" collapsible>
|
|
31
|
+
<AppAccordionItem value="item-1">
|
|
32
|
+
<AppAccordionTrigger>Is it accessible?</AppAccordionTrigger>
|
|
33
|
+
<AppAccordionContent>
|
|
34
|
+
Yes. It adheres to the WAI-ARIA design pattern.
|
|
35
|
+
</AppAccordionContent>
|
|
36
|
+
</AppAccordionItem>
|
|
37
|
+
</AppAccordion>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Multiple
|
|
41
|
+
```tsx
|
|
42
|
+
<AppAccordion type="multiple">
|
|
43
|
+
<AppAccordionItem value="item-1">
|
|
44
|
+
<AppAccordionTrigger>First Item</AppAccordionTrigger>
|
|
45
|
+
<AppAccordionContent>Content for first item.</AppAccordionContent>
|
|
46
|
+
</AppAccordionItem>
|
|
47
|
+
<AppAccordionItem value="item-2">
|
|
48
|
+
<AppAccordionTrigger>Second Item</AppAccordionTrigger>
|
|
49
|
+
<AppAccordionContent>Content for second item.</AppAccordionContent>
|
|
50
|
+
</AppAccordionItem>
|
|
51
|
+
</AppAccordion>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Rules
|
|
55
|
+
- ✅ Always use `AppAccordion` components together as a set
|
|
56
|
+
- ✅ Provide a unique `value` to each `AppAccordionItem`
|
|
57
|
+
- ✅ Use `collapsible` with `type="single"` if you want users to be able to close all items
|
|
58
|
+
- ❌ Do not place interactive elements (buttons, links) inside `AppAccordionTrigger`
|
|
59
|
+
- ❌ Do not override the chevron rotation or transition manually — it is handled by the primitive
|
|
60
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# AppAlertDialog
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/components/alert-dialog
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {
|
|
7
|
+
AppAlertDialog,
|
|
8
|
+
AppAlertDialogTrigger,
|
|
9
|
+
AppAlertDialogContent,
|
|
10
|
+
AppAlertDialogHeader,
|
|
11
|
+
AppAlertDialogFooter,
|
|
12
|
+
AppAlertDialogTitle,
|
|
13
|
+
AppAlertDialogDescription,
|
|
14
|
+
AppAlertDialogAction,
|
|
15
|
+
AppAlertDialogCancel,
|
|
16
|
+
} from "@/components/primitives/AppAlertDialog"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## AppAlertDialogAction / AppAlertDialogCancel
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Default | Description |
|
|
22
|
+
|------|------|---------|-------------|
|
|
23
|
+
| `variant` | `"default" \| "destructive" \| "secondary" \| "outline"` | `"default"` | Visual style of the action/cancel button |
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
### Basic
|
|
28
|
+
```tsx
|
|
29
|
+
<AppAlertDialog>
|
|
30
|
+
<AppAlertDialogTrigger asChild>
|
|
31
|
+
<AppButton variant="outline">Show Dialog</AppButton>
|
|
32
|
+
</AppAlertDialogTrigger>
|
|
33
|
+
<AppAlertDialogContent>
|
|
34
|
+
<AppAlertDialogHeader>
|
|
35
|
+
<AppAlertDialogTitle>Are you absolutely sure?</AppAlertDialogTitle>
|
|
36
|
+
<AppAlertDialogDescription>
|
|
37
|
+
This action cannot be undone.
|
|
38
|
+
</AppAlertDialogDescription>
|
|
39
|
+
</AppAlertDialogHeader>
|
|
40
|
+
<AppAlertDialogFooter>
|
|
41
|
+
<AppAlertDialogCancel>Cancel</AppAlertDialogCancel>
|
|
42
|
+
<AppAlertDialogAction>Continue</AppAlertDialogAction>
|
|
43
|
+
</AppAlertDialogFooter>
|
|
44
|
+
</AppAlertDialogContent>
|
|
45
|
+
</AppAlertDialog>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Destructive Action
|
|
49
|
+
```tsx
|
|
50
|
+
<AppAlertDialogFooter>
|
|
51
|
+
<AppAlertDialogCancel variant="outline">Cancel</AppAlertDialogCancel>
|
|
52
|
+
<AppAlertDialogAction variant="destructive">Delete Item</AppAlertDialogAction>
|
|
53
|
+
</AppAlertDialogFooter>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Rules
|
|
57
|
+
- ✅ Use `AppAlertDialog` for actions that require explicit confirmation and interrupt the workflow
|
|
58
|
+
- ✅ Always provide both an action and a cancel button in the `AppAlertDialogFooter`
|
|
59
|
+
- ✅ Use `variant="destructive"` for actions that permanently delete or change data
|
|
60
|
+
- ❌ Do not use `AppAlertDialog` for simple information or non-critical choices — use `AppDialog` instead
|
|
61
|
+
- ❌ Do not place complex forms inside `AppAlertDialog` — use `AppDialog` for form-based interactions
|
|
62
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|
package/rules/alert.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# AppAlert
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/components/alert
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { AppAlert, AppAlertTitle, AppAlertDescription, AppAlertContent } from "@/components/primitives/AppAlert"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## AppAlert
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
|------|------|---------|-------------|
|
|
13
|
+
| `variant` | `"default" \| "destructive" \| "success" \| "warning" \| "info"` | `"default"` | Visual style of the alert |
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Basic
|
|
18
|
+
```tsx
|
|
19
|
+
<AppAlert>
|
|
20
|
+
<TerminalIcon className="size-4" />
|
|
21
|
+
<AppAlertContent>
|
|
22
|
+
<AppAlertTitle>Heads up!</AppAlertTitle>
|
|
23
|
+
<AppAlertDescription>
|
|
24
|
+
You can add components to your app using the cli.
|
|
25
|
+
</AppAlertDescription>
|
|
26
|
+
</AppAlertContent>
|
|
27
|
+
</AppAlert>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Semantic Variants
|
|
31
|
+
```tsx
|
|
32
|
+
<AppAlert variant="success">
|
|
33
|
+
<CheckCircleIcon className="size-4" />
|
|
34
|
+
<AppAlertTitle>Success</AppAlertTitle>
|
|
35
|
+
</AppAlert>
|
|
36
|
+
|
|
37
|
+
<AppAlert variant="destructive">
|
|
38
|
+
<AlertCircleIcon className="size-4" />
|
|
39
|
+
<AppAlertTitle>Error</AppAlertTitle>
|
|
40
|
+
</AppAlert>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### With Action
|
|
44
|
+
```tsx
|
|
45
|
+
<AppAlert>
|
|
46
|
+
<InfoIcon className="size-4" />
|
|
47
|
+
<AppAlertContent>
|
|
48
|
+
<AppAlertTitle>Update Available</AppAlertTitle>
|
|
49
|
+
<AppAlertDescription>A new version is ready to install.</AppAlertDescription>
|
|
50
|
+
</AppAlertContent>
|
|
51
|
+
<AppButton size="sm" variant="outline" className="ml-auto">Update</AppButton>
|
|
52
|
+
</AppAlert>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Rules
|
|
56
|
+
- ✅ Always use `AppAlertContent` to wrap title and description for proper alignment
|
|
57
|
+
- ✅ Use the semantic variants (`success`, `warning`, `info`, `destructive`) for status-driven messaging
|
|
58
|
+
- ✅ Icons should be placed as direct children of `AppAlert`, outside `AppAlertContent`
|
|
59
|
+
- ❌ Do not use `AppAlert` for transient messages — use `AppToaster` or `toast` instead
|
|
60
|
+
- ❌ Do not manually style colors when a semantic variant exists
|
|
61
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# AppAspectRatio
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/components/aspect-ratio
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { AppAspectRatio } from "@/components/primitives/AppAspectRatio"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
|------|------|---------|-------------|
|
|
13
|
+
| `ratio` | `number` | `1` | The desired aspect ratio (e.g., 16/9, 4/3, 1) |
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Basic (16:9)
|
|
18
|
+
```tsx
|
|
19
|
+
<div className="w-[450px]">
|
|
20
|
+
<AppAspectRatio ratio={16 / 9}>
|
|
21
|
+
<img
|
|
22
|
+
src="..."
|
|
23
|
+
alt="Image"
|
|
24
|
+
className="rounded-md object-cover"
|
|
25
|
+
/>
|
|
26
|
+
</AppAspectRatio>
|
|
27
|
+
</div>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Square (1:1)
|
|
31
|
+
```tsx
|
|
32
|
+
<div className="w-[200px]">
|
|
33
|
+
<AppAspectRatio ratio={1}>
|
|
34
|
+
<img
|
|
35
|
+
src="..."
|
|
36
|
+
alt="Profile"
|
|
37
|
+
className="rounded-full object-cover"
|
|
38
|
+
/>
|
|
39
|
+
</AppAspectRatio>
|
|
40
|
+
</div>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Rules
|
|
44
|
+
- ✅ Always wrap `AppAspectRatio` in a container with a defined width
|
|
45
|
+
- ✅ Use `object-cover` on images inside `AppAspectRatio` to ensure they fill the container without distortion
|
|
46
|
+
- ❌ Do not set a height on the `AppAspectRatio` container — height is determined by the ratio and width
|
|
47
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|
package/rules/avatar.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# AppAvatar
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/components/avatar
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { AppAvatar, AppAvatarImage, AppAvatarFallback } from "@/components/primitives/AppAvatar"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## AppAvatar
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
|------|------|---------|-------------|
|
|
13
|
+
| `className` | `string` | — | Additional Tailwind classes for size and styling |
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Basic
|
|
18
|
+
```tsx
|
|
19
|
+
<AppAvatar>
|
|
20
|
+
<AppAvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
21
|
+
<AppAvatarFallback>CN</AppAvatarFallback>
|
|
22
|
+
</AppAvatar>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Custom Sizes
|
|
26
|
+
```tsx
|
|
27
|
+
<AppAvatar className="h-12 w-12">
|
|
28
|
+
<AppAvatarImage src="..." />
|
|
29
|
+
<AppAvatarFallback>JD</AppAvatarFallback>
|
|
30
|
+
</AppAvatar>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Avatar Group
|
|
34
|
+
```tsx
|
|
35
|
+
<div className="flex -space-x-2">
|
|
36
|
+
<AppAvatar className="border-2 border-background">
|
|
37
|
+
<AppAvatarImage src="..." />
|
|
38
|
+
<AppAvatarFallback>U1</AppAvatarFallback>
|
|
39
|
+
</AppAvatar>
|
|
40
|
+
<AppAvatar className="border-2 border-background">
|
|
41
|
+
<AppAvatarImage src="..." />
|
|
42
|
+
<AppAvatarFallback>U2</AppAvatarFallback>
|
|
43
|
+
</AppAvatar>
|
|
44
|
+
</div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Rules
|
|
48
|
+
- ✅ Always provide `AppAvatarFallback` for cases where the image fails to load or is not provided
|
|
49
|
+
- ✅ Use `alt` text on `AppAvatarImage` for accessibility
|
|
50
|
+
- ✅ Use `border-background` on avatars when used in a group to create visual separation
|
|
51
|
+
- ❌ Do not use raw `<img>` tags for user avatars — use `AppAvatar` to handle loading and fallback states automatically
|
|
52
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|
package/rules/badge.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# AppBadge
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/components/badge
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { AppBadge } from "@/components/primitives/AppBadge"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
|------|------|---------|-------------|
|
|
13
|
+
| `variant` | `"default" \| "secondary" \| "destructive" \| "warning" \| "outline" \| "ghost" \| "link"` | `"default"` | Visual style of the badge |
|
|
14
|
+
| `asChild` | `boolean` | `false` | Renders as child element via Radix Slot |
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Basic
|
|
19
|
+
```tsx
|
|
20
|
+
<AppBadge>Active</AppBadge>
|
|
21
|
+
<AppBadge variant="secondary">Draft</AppBadge>
|
|
22
|
+
<AppBadge variant="outline">Pending</AppBadge>
|
|
23
|
+
<AppBadge variant="destructive">Error</AppBadge>
|
|
24
|
+
<AppBadge variant="warning">Warning</AppBadge>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### With Icons
|
|
28
|
+
```tsx
|
|
29
|
+
<AppBadge>
|
|
30
|
+
<CheckIcon className="size-3" />
|
|
31
|
+
Verified
|
|
32
|
+
</AppBadge>
|
|
33
|
+
|
|
34
|
+
<AppBadge variant="secondary" className="gap-1 pr-1">
|
|
35
|
+
React
|
|
36
|
+
<AppButton size="icon" variant="ghost" className="size-3.5 p-0">
|
|
37
|
+
<XIcon className="size-2.5" />
|
|
38
|
+
</AppButton>
|
|
39
|
+
</AppBadge>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### As a Link
|
|
43
|
+
```tsx
|
|
44
|
+
<AppBadge asChild>
|
|
45
|
+
<a href="/tags/react">React</a>
|
|
46
|
+
</AppBadge>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Rules
|
|
50
|
+
- ✅ Use `AppBadge` for status indicators, tags, or small labels
|
|
51
|
+
- ✅ Use `asChild` when the badge should behave as a link
|
|
52
|
+
- ✅ Use `gap-1` when adding icons or small buttons inside the badge
|
|
53
|
+
- ❌ Do not use `AppBadge` for main navigation actions — use `AppButton` instead
|
|
54
|
+
- ❌ Do not use long text strings inside a badge — keep it to 1-2 words
|
|
55
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# AppBentoMenu
|
|
2
|
+
|
|
3
|
+
App-switcher popover displaying a grid of app tiles. Trigger defaults to a ghost icon button; pass `children` to use a custom trigger.
|
|
4
|
+
|
|
5
|
+
## Exports
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import {
|
|
9
|
+
AppBentoMenu,
|
|
10
|
+
AppBentoMenuItem,
|
|
11
|
+
DEFAULT_BENTO_APPS,
|
|
12
|
+
type BentoApp,
|
|
13
|
+
type AppBentoMenuProps,
|
|
14
|
+
type AppBentoMenuItemProps,
|
|
15
|
+
} from '@skunkworksai/ui-kit'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Props
|
|
19
|
+
|
|
20
|
+
### `AppBentoMenu`
|
|
21
|
+
|
|
22
|
+
| Prop | Type | Default | Description |
|
|
23
|
+
|------|------|---------|-------------|
|
|
24
|
+
| `apps` | `BentoApp[]` | `DEFAULT_BENTO_APPS` | Apps to display in the grid |
|
|
25
|
+
| `cols` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | `2` | Number of grid columns |
|
|
26
|
+
| `children` | `ReactNode` | ghost icon button | Custom popover trigger |
|
|
27
|
+
| `className` | `string` | — | Extra classes on the popover content |
|
|
28
|
+
|
|
29
|
+
### `BentoApp`
|
|
30
|
+
|
|
31
|
+
| Field | Type | Required | Description |
|
|
32
|
+
|-------|------|----------|-------------|
|
|
33
|
+
| `id` | `string` | ✓ | Unique key |
|
|
34
|
+
| `label` | `string` | ✓ | Display label below icon |
|
|
35
|
+
| `icon` | `string \| ComponentType<SVGProps<SVGSVGElement>>` | ✓ | PNG/SVG URL or SVG React component |
|
|
36
|
+
| `active` | `boolean` | — | Highlights tile with `ring-2 ring-primary` |
|
|
37
|
+
| `href` | `string` | — | Wraps tile in an `<a>` tag |
|
|
38
|
+
|
|
39
|
+
### `AppBentoMenuItem`
|
|
40
|
+
|
|
41
|
+
| Prop | Type | Required | Description |
|
|
42
|
+
|------|------|----------|-------------|
|
|
43
|
+
| `app` | `BentoApp` | ✓ | App data |
|
|
44
|
+
| `className` | `string` | — | Extra classes on the tile button |
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
### Default (built-in apps)
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
<AppBentoMenu />
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Custom app list
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
const MY_APPS: BentoApp[] = [
|
|
58
|
+
{ id: "app-a", label: "App A", icon: appAIcon, active: true, href: "/app-a" },
|
|
59
|
+
{ id: "app-b", label: "App B", icon: appBImg },
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
<AppBentoMenu apps={MY_APPS} cols={3} />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Custom trigger
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
<AppBentoMenu apps={MY_APPS}>
|
|
69
|
+
<AppButton variant="outline" size="sm">Apps</AppButton>
|
|
70
|
+
</AppBentoMenu>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Standalone tile (advanced)
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<AppBentoMenuItem app={{ id: "x", label: "X", icon: XIcon }} />
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Rules
|
|
80
|
+
|
|
81
|
+
- Use `DEFAULT_BENTO_APPS` as base and spread in overrides — don't hardcode the full list in app code unless you need full control.
|
|
82
|
+
- Set `active: true` on the app that matches the current route.
|
|
83
|
+
- Supply `href` on each app for navigation; omit only if clicks are handled via an `onClick` on the parent.
|
|
84
|
+
- `cols` accepts 1–6; values outside this range fall back to 2-column grid.
|
|
85
|
+
- Never hardcode icon pixel sizes — the tile container is fixed at `size-12` (48×48px); icons fill it automatically.
|
|
86
|
+
- If a prop you need is missing, stop and inform the design team.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# AppBreadcrumb
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/components/breadcrumb
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import {
|
|
7
|
+
AppBreadcrumb,
|
|
8
|
+
AppBreadcrumbList,
|
|
9
|
+
AppBreadcrumbItem,
|
|
10
|
+
AppBreadcrumbLink,
|
|
11
|
+
AppBreadcrumbPage,
|
|
12
|
+
AppBreadcrumbSeparator,
|
|
13
|
+
AppBreadcrumbEllipsis,
|
|
14
|
+
} from "@/components/primitives/AppBreadcrumb"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## AppBreadcrumbLink
|
|
18
|
+
|
|
19
|
+
| Prop | Type | Default | Description |
|
|
20
|
+
|------|------|---------|-------------|
|
|
21
|
+
| `asChild` | `boolean` | `false` | Renders as child element (e.g., for Next.js Link) |
|
|
22
|
+
| `href` | `string` | — | Link destination |
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Basic
|
|
27
|
+
```tsx
|
|
28
|
+
<AppBreadcrumb>
|
|
29
|
+
<AppBreadcrumbList>
|
|
30
|
+
<AppBreadcrumbItem>
|
|
31
|
+
<AppBreadcrumbLink href="/">Home</AppBreadcrumbLink>
|
|
32
|
+
</AppBreadcrumbItem>
|
|
33
|
+
<AppBreadcrumbSeparator />
|
|
34
|
+
<AppBreadcrumbItem>
|
|
35
|
+
<AppBreadcrumbLink href="/components">Components</AppBreadcrumbLink>
|
|
36
|
+
</AppBreadcrumbItem>
|
|
37
|
+
<AppBreadcrumbSeparator />
|
|
38
|
+
<AppBreadcrumbItem>
|
|
39
|
+
<AppBreadcrumbPage>Breadcrumb</AppBreadcrumbPage>
|
|
40
|
+
</AppBreadcrumbItem>
|
|
41
|
+
</AppBreadcrumbList>
|
|
42
|
+
</AppBreadcrumb>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### With Ellipsis
|
|
46
|
+
```tsx
|
|
47
|
+
<AppBreadcrumbList>
|
|
48
|
+
<AppBreadcrumbItem>
|
|
49
|
+
<AppBreadcrumbLink href="/">Home</AppBreadcrumbLink>
|
|
50
|
+
</AppBreadcrumbItem>
|
|
51
|
+
<AppBreadcrumbSeparator />
|
|
52
|
+
<AppBreadcrumbItem>
|
|
53
|
+
<AppBreadcrumbEllipsis />
|
|
54
|
+
</AppBreadcrumbItem>
|
|
55
|
+
<AppBreadcrumbSeparator />
|
|
56
|
+
<AppBreadcrumbItem>
|
|
57
|
+
<AppBreadcrumbPage>Current Page</AppBreadcrumbPage>
|
|
58
|
+
</AppBreadcrumbItem>
|
|
59
|
+
</AppBreadcrumbList>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Rules
|
|
63
|
+
- ✅ Always end the breadcrumb trail with `AppBreadcrumbPage` for the current location
|
|
64
|
+
- ✅ Use `AppBreadcrumbSeparator` between items
|
|
65
|
+
- ✅ Use `asChild` with `AppBreadcrumbLink` when using framework routers (like Next.js `Link`)
|
|
66
|
+
- ❌ Do not use breadcrumbs as the primary navigation system
|
|
67
|
+
- ❌ Do not use more than one `AppBreadcrumbEllipsis` in a single trail
|
|
68
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|
|
69
|
+
|
|
70
|
+
## Responsive
|
|
71
|
+
|
|
72
|
+
`AppBreadcrumbItem` and `AppBreadcrumbSeparator` accept a `hideOnMobile` prop (`boolean`); pass it on middle segments to hide them below `sm` (640px). `AppPageTitle` applies this automatically when the trail has more than 2 segments.
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
// Manual usage
|
|
76
|
+
<AppBreadcrumbItem hideOnMobile>
|
|
77
|
+
<AppBreadcrumbLink href="/admin">Admin</AppBreadcrumbLink>
|
|
78
|
+
</AppBreadcrumbItem>
|
|
79
|
+
<AppBreadcrumbSeparator hideOnMobile />
|
|
80
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# AppButtonGroup
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/components/button-group
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { AppButtonGroup } from "@/components/primitives/AppButtonGroup"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
|------|------|---------|-------------|
|
|
13
|
+
| `className` | `string` | — | Additional Tailwind classes |
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Button Group
|
|
18
|
+
```tsx
|
|
19
|
+
<AppButtonGroup>
|
|
20
|
+
<AppButton variant="outline">Copy</AppButton>
|
|
21
|
+
<AppButton variant="outline">Paste</AppButton>
|
|
22
|
+
<AppButton variant="outline">Clear</AppButton>
|
|
23
|
+
</AppButtonGroup>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Split Button
|
|
27
|
+
```tsx
|
|
28
|
+
<AppButtonGroup>
|
|
29
|
+
<AppButton>Publish</AppButton>
|
|
30
|
+
<AppDropdownMenu>
|
|
31
|
+
<AppDropdownMenuTrigger asChild>
|
|
32
|
+
<AppButton size="icon">
|
|
33
|
+
<ChevronDownIcon className="size-4" />
|
|
34
|
+
</AppButton>
|
|
35
|
+
</AppDropdownMenuTrigger>
|
|
36
|
+
<AppDropdownMenuContent align="end">
|
|
37
|
+
<AppDropdownMenuItem>Schedule</AppDropdownMenuItem>
|
|
38
|
+
<AppDropdownMenuItem>Save draft</AppDropdownMenuItem>
|
|
39
|
+
</AppDropdownMenuContent>
|
|
40
|
+
</AppDropdownMenu>
|
|
41
|
+
</AppButtonGroup>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Input with Button
|
|
45
|
+
```tsx
|
|
46
|
+
<AppButtonGroup>
|
|
47
|
+
<AppInput placeholder="Search..." />
|
|
48
|
+
<AppButton variant="outline">Search</AppButton>
|
|
49
|
+
</AppButtonGroup>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Rules
|
|
53
|
+
- ✅ Use `AppButtonGroup` to visually join related inputs and buttons
|
|
54
|
+
- ✅ Ensure all buttons within a group use the same `size` and `variant` for visual consistency
|
|
55
|
+
- ✅ Use `AppButtonGroup` for "Split Buttons" (primary action + dropdown)
|
|
56
|
+
- ❌ Do not use `AppButtonGroup` for disparate actions that aren't related
|
|
57
|
+
- ❌ Do not manually override border-radii of children — `AppButtonGroup` handles this automatically
|
|
58
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|
package/rules/button.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# AppButton
|
|
2
|
+
|
|
3
|
+
> Docs: https://ui-kit.vercel.app/docs/components/button
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { AppButton } from "@/components/primitives/AppButton"
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
|------|------|---------|-------------|
|
|
13
|
+
| `variant` | `"default" \| "outline" \| "secondary" \| "ghost" \| "destructive" \| "link"` | `"default"` | Visual style of the button |
|
|
14
|
+
| `size` | `"default" \| "xs" \| "sm" \| "lg" \| "icon" \| "icon-xs" \| "icon-sm" \| "icon-lg"` | `"default"` | Size of the button |
|
|
15
|
+
| `loading` | `boolean` | `false` | Shows a spinner and disables the button |
|
|
16
|
+
| `iconLeft` | `ReactNode` | — | Icon rendered before the label |
|
|
17
|
+
| `iconRight` | `ReactNode` | — | Icon rendered after the label |
|
|
18
|
+
| `disabled` | `boolean` | `false` | Disables the button |
|
|
19
|
+
| `asChild` | `boolean` | `false` | Renders as child element via Radix Slot |
|
|
20
|
+
| `className` | `string` | — | Additional Tailwind classes |
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
### Basic
|
|
25
|
+
```tsx
|
|
26
|
+
<AppButton>Save</AppButton>
|
|
27
|
+
<AppButton variant="outline">Cancel</AppButton>
|
|
28
|
+
<AppButton variant="destructive">Delete account</AppButton>
|
|
29
|
+
<AppButton variant="ghost">Dismiss</AppButton>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Sizes
|
|
33
|
+
```tsx
|
|
34
|
+
<AppButton size="sm">Small</AppButton>
|
|
35
|
+
<AppButton size="lg">Large</AppButton>
|
|
36
|
+
<AppButton size="icon"><TrashIcon /></AppButton>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Loading state
|
|
40
|
+
```tsx
|
|
41
|
+
<AppButton loading>Saving...</AppButton>
|
|
42
|
+
<AppButton loading variant="outline">Submitting</AppButton>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### With icons
|
|
46
|
+
```tsx
|
|
47
|
+
<AppButton iconLeft={<PlusIcon />}>Add item</AppButton>
|
|
48
|
+
<AppButton iconRight={<ArrowRightIcon />}>Continue</AppButton>
|
|
49
|
+
<AppButton iconLeft={<DownloadIcon />} variant="outline">Export</AppButton>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### As a link
|
|
53
|
+
```tsx
|
|
54
|
+
<AppButton asChild>
|
|
55
|
+
<a href="/dashboard">Go to dashboard</a>
|
|
56
|
+
</AppButton>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Rules
|
|
60
|
+
- ✅ Always use `AppButton` — never use a raw `<button>` element
|
|
61
|
+
- ✅ Use the `loading` prop for async actions — do not place `AppSpinner` inside manually
|
|
62
|
+
- ✅ Use `iconLeft` / `iconRight` for icons — do not wrap icons in extra `<div>` or `<span>`
|
|
63
|
+
- ✅ Use `variant` for color intent — do not override button color with Tailwind color classes
|
|
64
|
+
- ❌ Do not use `size="icon"` with text children — icon size is for icon-only buttons
|
|
65
|
+
- ❌ Do not set `gap` or `flex` on the button — icon spacing is controlled by the size variant
|
|
66
|
+
- ❌ If a prop you need is missing, stop and inform the design team
|