@gears-frontx/ui-kit 0.3.0-alpha.1

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.
Files changed (181) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +49 -0
  3. package/README.md +75 -0
  4. package/dist/badge.d.ts +1 -0
  5. package/dist/badge.js +42 -0
  6. package/dist/badge.js.map +1 -0
  7. package/dist/button.d.ts +1 -0
  8. package/dist/button.js +73 -0
  9. package/dist/button.js.map +1 -0
  10. package/dist/card.d.ts +1 -0
  11. package/dist/card.js +54 -0
  12. package/dist/card.js.map +1 -0
  13. package/dist/checkbox.d.ts +1 -0
  14. package/dist/checkbox.js +46 -0
  15. package/dist/checkbox.js.map +1 -0
  16. package/dist/chunks/badge.ej-3-Xs4.css +1 -0
  17. package/dist/chunks/button.CKfALaMe.css +1 -0
  18. package/dist/chunks/card.B0AcyAT1.css +1 -0
  19. package/dist/chunks/checkbox.Dd6YDr20.css +1 -0
  20. package/dist/chunks/dialog.D6LS2vnG.css +1 -0
  21. package/dist/chunks/dropdown-menu.DmDZc5gB.css +1 -0
  22. package/dist/chunks/field.BNZx8HfN.css +1 -0
  23. package/dist/chunks/input.CrRQ0OAn.css +1 -0
  24. package/dist/chunks/label.jrB9zD_G.css +1 -0
  25. package/dist/chunks/radio-group.1Y6B0lXt.css +1 -0
  26. package/dist/chunks/select.BmyP2S2q.css +1 -0
  27. package/dist/chunks/separator.DdRRkJW4.css +1 -0
  28. package/dist/chunks/skeleton.BhWSzPnI.css +1 -0
  29. package/dist/chunks/switch.B_ebMSxR.css +1 -0
  30. package/dist/chunks/table.r8ppNt1W.css +1 -0
  31. package/dist/chunks/tabs.DqJE9cX3.css +1 -0
  32. package/dist/chunks/textarea.BKWvs6fD.css +1 -0
  33. package/dist/chunks/toast.DMl31Mq4.css +1 -0
  34. package/dist/chunks/tooltip.apA3VWHJ.css +1 -0
  35. package/dist/components/badge/badge.d.ts +11 -0
  36. package/dist/components/badge/badge.d.ts.map +1 -0
  37. package/dist/components/badge/public.d.ts +2 -0
  38. package/dist/components/badge/public.d.ts.map +1 -0
  39. package/dist/components/button/button.d.ts +50 -0
  40. package/dist/components/button/button.d.ts.map +1 -0
  41. package/dist/components/button/public.d.ts +2 -0
  42. package/dist/components/button/public.d.ts.map +1 -0
  43. package/dist/components/card/card.d.ts +22 -0
  44. package/dist/components/card/card.d.ts.map +1 -0
  45. package/dist/components/card/public.d.ts +2 -0
  46. package/dist/components/card/public.d.ts.map +1 -0
  47. package/dist/components/checkbox/checkbox.d.ts +6 -0
  48. package/dist/components/checkbox/checkbox.d.ts.map +1 -0
  49. package/dist/components/checkbox/public.d.ts +2 -0
  50. package/dist/components/checkbox/public.d.ts.map +1 -0
  51. package/dist/components/dialog/dialog.d.ts +58 -0
  52. package/dist/components/dialog/dialog.d.ts.map +1 -0
  53. package/dist/components/dialog/public.d.ts +2 -0
  54. package/dist/components/dialog/public.d.ts.map +1 -0
  55. package/dist/components/dropdown-menu/dropdown-menu.d.ts +70 -0
  56. package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -0
  57. package/dist/components/dropdown-menu/public.d.ts +2 -0
  58. package/dist/components/dropdown-menu/public.d.ts.map +1 -0
  59. package/dist/components/field/field.d.ts +18 -0
  60. package/dist/components/field/field.d.ts.map +1 -0
  61. package/dist/components/field/public.d.ts +2 -0
  62. package/dist/components/field/public.d.ts.map +1 -0
  63. package/dist/components/input/input.d.ts +6 -0
  64. package/dist/components/input/input.d.ts.map +1 -0
  65. package/dist/components/input/public.d.ts +2 -0
  66. package/dist/components/input/public.d.ts.map +1 -0
  67. package/dist/components/label/label.d.ts +4 -0
  68. package/dist/components/label/label.d.ts.map +1 -0
  69. package/dist/components/label/public.d.ts +2 -0
  70. package/dist/components/label/public.d.ts.map +1 -0
  71. package/dist/components/radio-group/public.d.ts +2 -0
  72. package/dist/components/radio-group/public.d.ts.map +1 -0
  73. package/dist/components/radio-group/radio-group.d.ts +11 -0
  74. package/dist/components/radio-group/radio-group.d.ts.map +1 -0
  75. package/dist/components/select/public.d.ts +2 -0
  76. package/dist/components/select/public.d.ts.map +1 -0
  77. package/dist/components/select/select.d.ts +61 -0
  78. package/dist/components/select/select.d.ts.map +1 -0
  79. package/dist/components/separator/public.d.ts +2 -0
  80. package/dist/components/separator/public.d.ts.map +1 -0
  81. package/dist/components/separator/separator.d.ts +6 -0
  82. package/dist/components/separator/separator.d.ts.map +1 -0
  83. package/dist/components/skeleton/public.d.ts +2 -0
  84. package/dist/components/skeleton/public.d.ts.map +1 -0
  85. package/dist/components/skeleton/skeleton.d.ts +4 -0
  86. package/dist/components/skeleton/skeleton.d.ts.map +1 -0
  87. package/dist/components/switch/public.d.ts +2 -0
  88. package/dist/components/switch/public.d.ts.map +1 -0
  89. package/dist/components/switch/switch.d.ts +11 -0
  90. package/dist/components/switch/switch.d.ts.map +1 -0
  91. package/dist/components/table/public.d.ts +2 -0
  92. package/dist/components/table/public.d.ts.map +1 -0
  93. package/dist/components/table/table.d.ts +38 -0
  94. package/dist/components/table/table.d.ts.map +1 -0
  95. package/dist/components/tabs/public.d.ts +2 -0
  96. package/dist/components/tabs/public.d.ts.map +1 -0
  97. package/dist/components/tabs/tabs.d.ts +23 -0
  98. package/dist/components/tabs/tabs.d.ts.map +1 -0
  99. package/dist/components/textarea/public.d.ts +2 -0
  100. package/dist/components/textarea/public.d.ts.map +1 -0
  101. package/dist/components/textarea/textarea.d.ts +4 -0
  102. package/dist/components/textarea/textarea.d.ts.map +1 -0
  103. package/dist/components/toast/public.d.ts +2 -0
  104. package/dist/components/toast/public.d.ts.map +1 -0
  105. package/dist/components/toast/toast.d.ts +85 -0
  106. package/dist/components/toast/toast.d.ts.map +1 -0
  107. package/dist/components/tooltip/public.d.ts +2 -0
  108. package/dist/components/tooltip/public.d.ts.map +1 -0
  109. package/dist/components/tooltip/tooltip.d.ts +41 -0
  110. package/dist/components/tooltip/tooltip.d.ts.map +1 -0
  111. package/dist/dialog.d.ts +1 -0
  112. package/dist/dialog.js +84 -0
  113. package/dist/dialog.js.map +1 -0
  114. package/dist/docs/badge.md +82 -0
  115. package/dist/docs/button.md +102 -0
  116. package/dist/docs/card.md +131 -0
  117. package/dist/docs/checkbox.md +55 -0
  118. package/dist/docs/dialog.md +124 -0
  119. package/dist/docs/dropdown-menu.md +140 -0
  120. package/dist/docs/field.md +68 -0
  121. package/dist/docs/input.md +65 -0
  122. package/dist/docs/label.md +50 -0
  123. package/dist/docs/radio-group.md +59 -0
  124. package/dist/docs/select.md +99 -0
  125. package/dist/docs/separator.md +119 -0
  126. package/dist/docs/skeleton.md +143 -0
  127. package/dist/docs/switch.md +51 -0
  128. package/dist/docs/table.md +276 -0
  129. package/dist/docs/tabs.md +124 -0
  130. package/dist/docs/textarea.md +52 -0
  131. package/dist/docs/toast.md +153 -0
  132. package/dist/docs/tooltip.md +134 -0
  133. package/dist/dropdown-menu.d.ts +1 -0
  134. package/dist/dropdown-menu.js +183 -0
  135. package/dist/dropdown-menu.js.map +1 -0
  136. package/dist/field.d.ts +1 -0
  137. package/dist/field.js +28 -0
  138. package/dist/field.js.map +1 -0
  139. package/dist/index.d.ts +48 -0
  140. package/dist/index.d.ts.map +1 -0
  141. package/dist/index.js +96 -0
  142. package/dist/index.js.map +1 -0
  143. package/dist/input.d.ts +1 -0
  144. package/dist/input.js +30 -0
  145. package/dist/input.js.map +1 -0
  146. package/dist/label.d.ts +1 -0
  147. package/dist/label.js +12 -0
  148. package/dist/label.js.map +1 -0
  149. package/dist/radio-group.d.ts +1 -0
  150. package/dist/radio-group.js +21 -0
  151. package/dist/radio-group.js.map +1 -0
  152. package/dist/select.d.ts +1 -0
  153. package/dist/select.js +175 -0
  154. package/dist/select.js.map +1 -0
  155. package/dist/separator.d.ts +1 -0
  156. package/dist/separator.js +13 -0
  157. package/dist/separator.js.map +1 -0
  158. package/dist/skeleton.d.ts +1 -0
  159. package/dist/skeleton.js +12 -0
  160. package/dist/skeleton.js.map +1 -0
  161. package/dist/switch.d.ts +1 -0
  162. package/dist/switch.js +26 -0
  163. package/dist/switch.js.map +1 -0
  164. package/dist/table.d.ts +1 -0
  165. package/dist/table.js +64 -0
  166. package/dist/table.js.map +1 -0
  167. package/dist/tabs.d.ts +1 -0
  168. package/dist/tabs.js +41 -0
  169. package/dist/tabs.js.map +1 -0
  170. package/dist/textarea.d.ts +1 -0
  171. package/dist/textarea.js +13 -0
  172. package/dist/textarea.js.map +1 -0
  173. package/dist/theme.css +485 -0
  174. package/dist/toast.d.ts +1 -0
  175. package/dist/toast.js +193 -0
  176. package/dist/toast.js.map +1 -0
  177. package/dist/tooltip.d.ts +1 -0
  178. package/dist/tooltip.js +49 -0
  179. package/dist/tooltip.js.map +1 -0
  180. package/llms.txt +148 -0
  181. package/package.json +85 -0
@@ -0,0 +1,131 @@
1
+ # Card
2
+
3
+ A container for grouping related content and actions — a bounded surface
4
+ with its own background and shadow. The boundary is a 1px ring drawn via
5
+ `box-shadow`, not a CSS `border` — adding your own `border` draws a
6
+ second ring rather than replacing the existing one. Card has no Base UI
7
+ primitive: every part is a plain styled `div` (no portal, no open state,
8
+ no keyboard behavior to inherit).
9
+
10
+ Composition: `Card` (root) → `CardHeader` (→ `CardTitle`, optional
11
+ `CardDescription`, optional `CardAction`) → `CardContent` → `CardFooter`.
12
+ Every part except `Card` itself is a passthrough over
13
+ `ComponentProps<'div'>` — no kit-specific props of its own.
14
+
15
+ ## When to use
16
+
17
+ - Grouping a self-contained unit of content (a stat, a settings section,
18
+ an item in a list of similar items) with a clear visual boundary.
19
+ - A summary or preview that pairs a title/description with an action
20
+ (`CardAction`) or a set of actions (`CardFooter`).
21
+
22
+ ## When not to use
23
+
24
+ - A focused task that should block the rest of the page — use `dialog`.
25
+ - Purely tabular data — the kit's `table` component fits rows/columns
26
+ better than a boundary-and-padding container.
27
+ - A single line of muted supporting text with no need for a boundary or
28
+ background — plain text is lighter.
29
+
30
+ ## Props (kit level)
31
+
32
+ `Card`:
33
+
34
+ | Prop | Type | Default |
35
+ |------|------|---------|
36
+ | `size` | `'default' \| 'sm'` — scales the card's internal padding and gap, and `CardTitle`'s font size | `'default'` |
37
+ | `className` | `string` — merged after the kit class | — |
38
+
39
+ `CardHeader` becomes a two-column grid (content, then `CardAction`) when
40
+ it contains a `CardAction`, and a two-row grid (title, then
41
+ `CardDescription`) when it contains a `CardDescription` — both detected
42
+ structurally, no prop to set.
43
+
44
+ Direct `img` children of `Card` are flush against the edges: no top
45
+ padding when the image is the first child, and the image's own corners
46
+ are rounded to match the card (first child rounds the top corners, last
47
+ child the bottom ones) — useful for a media card with a full-bleed image.
48
+
49
+ `CardTitle` renders a plain `div`, not a heading element — like every
50
+ other part, it has no `render` prop to swap it (Card has no Base UI
51
+ primitive to supply one). When a card is a real page landmark rather
52
+ than a decorative grouping, supply your own heading (e.g. wrap the text
53
+ in an `h2`/`h3`) so the page keeps a document outline; `CardTitle` alone
54
+ contributes nothing to it.
55
+
56
+ `CardHeader` and `CardFooter` sit flush against `CardContent`, with no
57
+ divider by default. To add one, put a border on the part via `className`
58
+ (e.g. `border-top: 1px solid var(--border)` on `CardFooter`) and pair it
59
+ with `style={{ paddingTop: 'var(--card-spacing)' }}`, so the divider gets
60
+ the same inner padding as the rest of the card instead of sitting flush
61
+ against the border.
62
+
63
+ `--card-spacing` is a plain CSS custom property (unlike class names, CSS
64
+ Modules does not scope custom property names), so it resolves correctly
65
+ read from `style` on any Card part, and automatically follows `size`.
66
+
67
+ ## Examples
68
+
69
+ ```tsx
70
+ import {
71
+ Button,
72
+ Card,
73
+ CardAction,
74
+ CardContent,
75
+ CardDescription,
76
+ CardFooter,
77
+ CardHeader,
78
+ CardTitle,
79
+ } from '@gears-frontx/ui-kit';
80
+
81
+ <Card>
82
+ <CardHeader>
83
+ <CardTitle>Team plan</CardTitle>
84
+ <CardDescription>Billed monthly, 5 seats in use.</CardDescription>
85
+ <CardAction>
86
+ <Button variant="ghost" size="sm">
87
+ Manage
88
+ </Button>
89
+ </CardAction>
90
+ </CardHeader>
91
+ <CardContent>
92
+ <p>Next invoice on the 1st.</p>
93
+ </CardContent>
94
+ <CardFooter>
95
+ <Button variant="outline">Cancel</Button>
96
+ <Button>Upgrade</Button>
97
+ </CardFooter>
98
+ </Card>;
99
+ ```
100
+
101
+ A compact card, sized down as a unit with `size="sm"`:
102
+
103
+ ```tsx
104
+ import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@gears-frontx/ui-kit';
105
+
106
+ <Card size="sm">
107
+ <CardHeader>
108
+ <CardTitle>Storage</CardTitle>
109
+ <CardDescription>12 GB of 20 GB used</CardDescription>
110
+ </CardHeader>
111
+ <CardContent>
112
+ <p>8 GB free</p>
113
+ </CardContent>
114
+ </Card>;
115
+ ```
116
+
117
+ ## Anti-patterns
118
+
119
+ - Avoid nesting a `Card` inside another `Card` for visual grouping within
120
+ the same surface — use `CardContent` layout (a grid or flex wrapper
121
+ inside it) instead; two stacked shadow rings read as a bug, not a
122
+ hierarchy. (Sizing itself is not the concern: `--card-spacing` and
123
+ `CardTitle`'s font size resolve to each `Card`'s own `size`, so a
124
+ nested `Card` is never skewed by an ancestor `Card`'s size — this is
125
+ purely a "don't stack two boundaries" visual guideline.)
126
+ - Do not put interactive form controls that need `Field`'s label/error
127
+ wiring directly as `CardContent` children without `Field` — `Card`
128
+ supplies a boundary, not form semantics.
129
+ - Do not rely on `CardHeader`'s grid columns switching when you only want
130
+ a fixed two-column header layout — that behavior is driven by whether a
131
+ `CardAction` is present, not by a layout prop.
@@ -0,0 +1,55 @@
1
+ # Checkbox
2
+
3
+ An on/off tick box. Wraps the Base UI Checkbox primitive: renders a
4
+ `role="checkbox"` button with a hidden native input for forms, toggles via
5
+ mouse and keyboard, exposes state through `data-checked`/`data-unchecked`.
6
+
7
+ ## When to use
8
+
9
+ - Opting in/out of independent options (multiple can be on at once).
10
+ - Accepting terms, selecting rows, toggling settings that apply on submit.
11
+
12
+ ## When not to use
13
+
14
+ - An immediate on/off with instant effect — use `switch`.
15
+ - Mutually exclusive options — use `radio-group`.
16
+
17
+ ## Props (kit level)
18
+
19
+ | Prop | Type | Default |
20
+ |------|------|---------|
21
+ | `checked` / `defaultChecked` | controlled / uncontrolled state | `false` |
22
+ | `onCheckedChange` | `(checked: boolean, eventDetails) => void` | — |
23
+ | `name` / `value` | form submission via the hidden native input | — |
24
+ | `className` | `string` — merged after the kit class | — |
25
+
26
+ Other props follow Base UI Checkbox.Root (`disabled`, `required`,
27
+ `readOnly`, ...). `aria-invalid` switches the border and ring to the
28
+ destructive color. `indeterminate` renders a minus mark in an unfilled box
29
+ (`aria-checked="mixed"`) — use it for "some children selected" parents.
30
+
31
+ ## Examples
32
+
33
+ ```tsx
34
+ import { Checkbox, Label } from '@gears-frontx/ui-kit';
35
+
36
+ // Labelled checkbox — nesting gives one click target
37
+ <Label>
38
+ <Checkbox name="terms" required /> I agree to the terms
39
+ </Label>
40
+
41
+ // Controlled
42
+ <Checkbox checked={selected} onCheckedChange={setSelected} />
43
+
44
+ // Disabled
45
+ <Label data-disabled="">
46
+ <Checkbox disabled defaultChecked /> Locked option
47
+ </Label>
48
+ ```
49
+
50
+ ## Anti-patterns
51
+
52
+ - Do not render a checkbox without a visible label — `aria-label` alone is
53
+ a last resort for dense tables.
54
+ - Do not use it as an instant toggle for a running process — that is
55
+ `switch` semantics.
@@ -0,0 +1,124 @@
1
+ # Dialog
2
+
3
+ A modal overlay for a focused task or confirmation. Wraps the Base UI
4
+ Dialog primitives; the popup is portalled, focus trapping, page-scroll
5
+ locking, and Escape/outside-press dismissal come from Base UI. Base UI
6
+ does **not** supply a touch-screen-reader escape hatch on its own — when
7
+ `modal` is `true` (the default) or `'trap-focus'`, its own docs require
8
+ the consumer to render a `Dialog.Close` inside `Dialog.Popup` for that.
9
+ The kit satisfies this by having `DialogContent` render a close button
10
+ by default (`showCloseButton`, see below).
11
+
12
+ Composition: `Dialog` (root, holds open state) → `DialogTrigger` →
13
+ `DialogContent` (portals `DialogHeader` / `DialogFooter` /
14
+ `DialogTitle` / `DialogDescription` / consumer content) → optional
15
+ `DialogClose` for a consumer-composed close action (e.g. a footer
16
+ "Cancel" button).
17
+
18
+ ## When to use
19
+
20
+ - A focused task or confirmation that should block interaction with the
21
+ rest of the page until the user acts or dismisses it.
22
+ - Content the user must read or decide on before continuing (destructive
23
+ action confirmation, a short form).
24
+
25
+ ## When not to use
26
+
27
+ - Passive information that does not need to block the page — a dialog is
28
+ modal by default; if it genuinely must not block, pair `modal={false}`
29
+ on the root with `showBackdrop={false}` on `DialogContent` (one without
30
+ the other still blocks: `modal` alone leaves the backdrop covering and
31
+ click-closing over the page).
32
+ - Menus of actions anchored to a trigger — use `dropdown-menu`.
33
+ - Single-line contextual hints — use `tooltip`.
34
+
35
+ ## Props (kit level)
36
+
37
+ `Dialog` (root): `open` / `defaultOpen`, `onOpenChange`, `modal` (`true`
38
+ default; `false`; `'trap-focus'`) — see Base UI Dialog.Root.
39
+
40
+ `DialogContent`:
41
+
42
+ | Prop | Type | Default |
43
+ |------|------|---------|
44
+ | `showCloseButton` | `boolean` — renders a top-right close (X) button | `true` |
45
+ | `showBackdrop` | `boolean` — renders the dimming backdrop; set `false` together with `modal={false}` on the root for a genuinely non-modal dialog | `true` |
46
+ | `closeLabel` | `string` — accessible name for that button, the popup's only kit-authored text; same contract as `Toaster`'s `closeLabel` | `'Close'` |
47
+ | `container` | DOM node to portal the popup into | `<body>` |
48
+ | `initialFocus` / `finalFocus` | `boolean \| RefObject \| function` — see Base UI Dialog.Popup | default focus behavior |
49
+ | `className` | `string` — merged after the kit class | — |
50
+
51
+ Setting `showCloseButton={false}` removes the only built-in escape hatch
52
+ touch screen reader users have out of a modal dialog (see above) — only
53
+ do this if you compose your own `DialogClose` somewhere inside
54
+ `DialogContent` (e.g. in the footer).
55
+
56
+ The popup portals to `<body>` by default, so if your theme lives on a
57
+ subtree (`data-theme` on a section instead of `<html>`), pass that
58
+ section as `container` or the popup renders with the root theme.
59
+
60
+ `DialogTrigger` and `DialogClose` are unstyled pass-throughs (native
61
+ `<button>` semantics) — compose them with `Button` via their `render`
62
+ prop for a styled trigger or close action, same as the built-in close
63
+ button does internally.
64
+
65
+ ## Examples
66
+
67
+ ```tsx
68
+ import {
69
+ Button,
70
+ Dialog,
71
+ DialogClose,
72
+ DialogContent,
73
+ DialogDescription,
74
+ DialogFooter,
75
+ DialogHeader,
76
+ DialogTitle,
77
+ DialogTrigger,
78
+ } from '@gears-frontx/ui-kit';
79
+
80
+ <Dialog>
81
+ <DialogTrigger render={<Button variant="destructive" />}>Delete project</DialogTrigger>
82
+ <DialogContent>
83
+ <DialogHeader>
84
+ <DialogTitle>Delete project</DialogTitle>
85
+ <DialogDescription>
86
+ This action cannot be undone. This will permanently delete the project.
87
+ </DialogDescription>
88
+ </DialogHeader>
89
+ <DialogFooter>
90
+ <DialogClose render={<Button variant="outline" />}>Cancel</DialogClose>
91
+ <Button variant="destructive" onClick={handleDelete}>
92
+ Delete
93
+ </Button>
94
+ </DialogFooter>
95
+ </DialogContent>
96
+ </Dialog>
97
+ ```
98
+
99
+ ## Wide content
100
+
101
+ `DialogContent` lays its children out as a single-column grid capped at
102
+ `28rem` (`calc(100% - 2rem)` below 640px), and the column's minimum width
103
+ is floored at zero — so content wider than the popup overflows *inside*
104
+ it rather than stretching the dialog past its cap.
105
+
106
+ That means a wide child needs its own horizontal scroll container:
107
+ `Table` already ships one (its wrapper scrolls and is keyboard-reachable),
108
+ so a table drops in as-is. Anything else wide — a `<pre>` code block, a
109
+ long unbroken string, an image — either wrap in an element with
110
+ `overflow-x: auto`, or let it wrap (`overflow-wrap: anywhere` for
111
+ unbreakable strings). Widening the dialog itself is a `className` width on
112
+ `DialogContent`, not something to fix from the child.
113
+
114
+ ## Anti-patterns
115
+
116
+ - Do not nest interactive page content's focus expectations across the
117
+ backdrop — modal mode (the default) already traps focus and moves it
118
+ in/out on open/close; use `initialFocus` / `finalFocus` on
119
+ `DialogContent` if you need to redirect it, don't fight it with manual
120
+ focus management (imperative `.focus()` calls in effects).
121
+ - Do not omit `DialogTitle` — Base UI's accessibility tree needs it even
122
+ if it is visually hidden via `className`; do not delete it for a
123
+ "cleaner" look.
124
+ - Do not use `Dialog` for a simple toast/notification — use `toast`.
@@ -0,0 +1,140 @@
1
+ # DropdownMenu
2
+
3
+ A menu of actions anchored to a trigger. Wraps the Base UI Menu
4
+ primitives; the popup is portalled, keyboard navigation (arrow keys,
5
+ typeahead, roving focus), and Escape/outside-press dismissal come from
6
+ Base UI.
7
+
8
+ Composition: `DropdownMenu` (root, holds open state) →
9
+ `DropdownMenuTrigger` → `DropdownMenuContent` (portals
10
+ `DropdownMenuGroup` / `DropdownMenuItem` / `DropdownMenuCheckboxItem` /
11
+ `DropdownMenuRadioGroup` + `DropdownMenuRadioItem` /
12
+ `DropdownMenuSeparator` / `DropdownMenuShortcut`). `DropdownMenuLabel`
13
+ requires a `DropdownMenuGroup` or `DropdownMenuRadioGroup` ancestor —
14
+ Base UI throws if it is used outside one (it looks up the group it
15
+ labels from context). Nest a submenu with `DropdownMenuSub` →
16
+ `DropdownMenuSubTrigger` → `DropdownMenuSubContent`.
17
+
18
+ ## When to use
19
+
20
+ - A set of actions or options anchored to a trigger (row actions, a
21
+ "more" button, an avatar menu).
22
+ - Mutually exclusive or independent toggles that live inside a menu
23
+ (`DropdownMenuRadioItem`, `DropdownMenuCheckboxItem`).
24
+
25
+ ## When not to use
26
+
27
+ - Picking one value from a list bound to a form field — use `select`.
28
+ - A focused task or confirmation that should block the page — use
29
+ `dialog`.
30
+ - A single-line contextual hint — use `tooltip`.
31
+
32
+ ## Props (kit level)
33
+
34
+ `DropdownMenu` (root): `open` / `defaultOpen`, `onOpenChange`, `modal`
35
+ (`true` default), `loopFocus`, `highlightItemOnHover` — see Base UI
36
+ Menu.Root.
37
+
38
+ `DropdownMenuContent` / `DropdownMenuSubContent`:
39
+
40
+ | Prop | Type | Default |
41
+ |------|------|---------|
42
+ | `side` | `top` \| `bottom` \| `left` \| `right` \| `inline-start` \| `inline-end` | `bottom` (Content), `right` (SubContent) |
43
+ | `align` | `start` \| `center` \| `end` | `start` |
44
+ | `sideOffset` / `alignOffset` | `number` | `4` / `0` (Content), `0` / `-3` (SubContent) |
45
+ | `container` | DOM node to portal the popup into; `DropdownMenuSubContent` inherits the nearest Content's unless given its own | `<body>` |
46
+ | `positionMethod` | `absolute` \| `fixed` — pass `fixed` when the trigger sits inside a `transform`/`filter` container (an animated panel), where absolute positioning resolves against the wrong box | `absolute` |
47
+ | `collisionBoundary` / `collisionPadding` | see Base UI Menu.Positioner — bound and pad the flip/shift collision logic | viewport / `5` |
48
+ | `className` | `string` — merged after the kit class | — |
49
+
50
+ `DropdownMenuContent` sizes its popup to the trigger's width
51
+ (`--anchor-width`, floored at a `min-width`); `DropdownMenuSubContent`
52
+ sizes to its own content instead, since a submenu's anchor is its own
53
+ (usually narrow) `DropdownMenuSubTrigger` item, not the top-level
54
+ trigger.
55
+
56
+ The popup portals to `<body>` by default, so if your theme lives on a
57
+ subtree (`data-theme` on a section instead of `<html>`), pass that
58
+ section as `container` or the popup renders with the root theme — same
59
+ contract as `Dialog` and `Select`.
60
+
61
+ `DropdownMenuItem`: `variant` — `default` | `destructive`, `disabled`,
62
+ `closeOnClick` (`true` by default — Base UI closes the menu on
63
+ selection).
64
+
65
+ `DropdownMenuCheckboxItem`: `checked` / `defaultChecked`,
66
+ `onCheckedChange`; `DropdownMenuRadioGroup` + `DropdownMenuRadioItem`:
67
+ `value` / `defaultValue`, `onValueChange` on the group, `value` on each
68
+ item — both leave `closeOnClick` at Base UI's default of `false` so the
69
+ menu stays open after a toggle.
70
+
71
+ `DropdownMenuTrigger` is an unstyled pass-through (native `<button>`
72
+ semantics) — compose it with `Button` via its `render` prop for a
73
+ styled trigger, same as `DialogTrigger`.
74
+
75
+ ## Examples
76
+
77
+ ```tsx
78
+ import {
79
+ Button,
80
+ DropdownMenu,
81
+ DropdownMenuCheckboxItem,
82
+ DropdownMenuContent,
83
+ DropdownMenuGroup,
84
+ DropdownMenuItem,
85
+ DropdownMenuLabel,
86
+ DropdownMenuRadioGroup,
87
+ DropdownMenuRadioItem,
88
+ DropdownMenuSeparator,
89
+ DropdownMenuShortcut,
90
+ DropdownMenuSub,
91
+ DropdownMenuSubContent,
92
+ DropdownMenuSubTrigger,
93
+ DropdownMenuTrigger,
94
+ } from '@gears-frontx/ui-kit';
95
+
96
+ <DropdownMenu>
97
+ <DropdownMenuTrigger render={<Button variant="outline" />}>Options</DropdownMenuTrigger>
98
+ <DropdownMenuContent>
99
+ <DropdownMenuGroup>
100
+ <DropdownMenuLabel>Account</DropdownMenuLabel>
101
+ <DropdownMenuItem>
102
+ Profile
103
+ <DropdownMenuShortcut>⇧⌘P</DropdownMenuShortcut>
104
+ </DropdownMenuItem>
105
+ </DropdownMenuGroup>
106
+ <DropdownMenuSeparator />
107
+ <DropdownMenuCheckboxItem checked={showBookmarks} onCheckedChange={setShowBookmarks}>
108
+ Show bookmarks
109
+ </DropdownMenuCheckboxItem>
110
+ <DropdownMenuSeparator />
111
+ <DropdownMenuRadioGroup value={view} onValueChange={setView}>
112
+ <DropdownMenuRadioItem value="list">List view</DropdownMenuRadioItem>
113
+ <DropdownMenuRadioItem value="grid">Grid view</DropdownMenuRadioItem>
114
+ </DropdownMenuRadioGroup>
115
+ <DropdownMenuSeparator />
116
+ <DropdownMenuSub>
117
+ <DropdownMenuSubTrigger>More tools</DropdownMenuSubTrigger>
118
+ <DropdownMenuSubContent>
119
+ <DropdownMenuItem>Extensions</DropdownMenuItem>
120
+ </DropdownMenuSubContent>
121
+ </DropdownMenuSub>
122
+ <DropdownMenuSeparator />
123
+ <DropdownMenuItem variant="destructive" onClick={handleDelete}>
124
+ Delete account
125
+ </DropdownMenuItem>
126
+ </DropdownMenuContent>
127
+ </DropdownMenu>
128
+ ```
129
+
130
+ ## Anti-patterns
131
+
132
+ - Do not use `DropdownMenu` for page navigation between routes when a
133
+ plain link list would do — reserve it for actions/options anchored to
134
+ a trigger.
135
+ - Do not put `DropdownMenuCheckboxItem` / `DropdownMenuRadioItem`
136
+ directly under `DropdownMenuContent` when they represent a bound
137
+ single-select value elsewhere in the app — use `select` or
138
+ `radio-group` for form state instead.
139
+ - Do not nest more than one level of `DropdownMenuSub` — deep submenu
140
+ chains are hard to navigate with a mouse or keyboard.
@@ -0,0 +1,68 @@
1
+ # Field
2
+
3
+ A labelled form field. Wraps the Base UI Field primitives: `Field` (root)
4
+ associates its `FieldLabel`, `FieldDescription`, `FieldError`, and the
5
+ control inside it automatically — ids, `htmlFor`, and `aria-describedby`
6
+ are wired for you, and validation state flows to every part via
7
+ `data-invalid`/`data-disabled`.
8
+
9
+ Kit controls (`Input`, `Textarea`, and Base UI-based controls like
10
+ `Checkbox`, `Switch`, `RadioGroup`, `Select`) register themselves with the
11
+ surrounding Field — no extra props needed.
12
+
13
+ ## When to use
14
+
15
+ - Every labelled control in a form. This is the default way to compose
16
+ forms from the kit.
17
+
18
+ ## When not to use
19
+
20
+ - Purely decorative text next to a control that is not its label or
21
+ description.
22
+
23
+ ## Props (kit level)
24
+
25
+ `Field` (root):
26
+
27
+ | Prop | Type | Default |
28
+ |------|------|---------|
29
+ | `name` | field name, also used by form-level validation | — |
30
+ | `disabled` | disables the control and dims the label | `false` |
31
+ | `invalid` | force the invalid state (external validation libraries) | — |
32
+ | `validate` | custom validation: `(value) => string \| string[] \| null` | — |
33
+ | `className` | `string` — merged after the kit class | — |
34
+
35
+ `FieldError` accepts `match`: `true` to always show (external validation),
36
+ or a native `ValidityState` key (`"valueMissing"`, `"typeMismatch"`, ...)
37
+ to show only for that failure. Without `match` it shows whenever the field
38
+ is invalid.
39
+
40
+ ## Examples
41
+
42
+ ```tsx
43
+ import { Field, FieldDescription, FieldError, FieldLabel, Input } from '@gears-frontx/ui-kit';
44
+
45
+ // Label + description + native validation
46
+ <Field name="email">
47
+ <FieldLabel>Email</FieldLabel>
48
+ <Input type="email" required placeholder="you@company.com" />
49
+ <FieldDescription>We only use it for the invoice.</FieldDescription>
50
+ <FieldError match="valueMissing">Email is required.</FieldError>
51
+ <FieldError match="typeMismatch">That does not look like an email.</FieldError>
52
+ </Field>
53
+
54
+ // External validation (e.g. server errors)
55
+ <Field name="slug" invalid={Boolean(serverError)}>
56
+ <FieldLabel>Slug</FieldLabel>
57
+ <Input value={slug} onValueChange={setSlug} />
58
+ <FieldError match={true}>{serverError}</FieldError>
59
+ </Field>
60
+ ```
61
+
62
+ ## Anti-patterns
63
+
64
+ - Do not wire `htmlFor`/`id`/`aria-describedby` by hand inside a Field —
65
+ the point of the composition is that it does this for you.
66
+ - Do not put two controls in one Field — one field, one control.
67
+ - Do not render validation text outside `FieldError` — screen readers
68
+ lose the association.
@@ -0,0 +1,65 @@
1
+ # Input
2
+
3
+ A single-line text field. Wraps the Base UI Input primitive: a native
4
+ `<input>` that automatically wires itself to `Field` (label, description,
5
+ error, validation state) when rendered inside one.
6
+
7
+ ## When to use
8
+
9
+ - Any single-line free-text value: names, emails, search queries, numbers,
10
+ file uploads (`type="file"`).
11
+ - Inside a `Field` to get label association and validation display for
12
+ free.
13
+
14
+ ## When not to use
15
+
16
+ - Multi-line text — use `textarea`.
17
+ - Picking from a fixed set of options — use `select`, `radio-group`, or
18
+ `checkbox`.
19
+
20
+ ## Props (kit level)
21
+
22
+ | Prop | Type | Default |
23
+ |------|------|---------|
24
+ | `value` / `defaultValue` | controlled / uncontrolled value | — |
25
+ | `onValueChange` | `(value: string, eventDetails) => void` — fires on every change | — |
26
+ | `className` | `string` — merged after the kit class | — |
27
+
28
+ All other props are native `<input>` props (`type`, `placeholder`,
29
+ `disabled`, `required`, `aria-invalid`, ...) and are forwarded as-is.
30
+ `aria-invalid` switches the border and ring to the destructive color.
31
+
32
+ `type="search"` upgrades the field visually as well as semantically: a
33
+ leading magnifier icon (decorative, `aria-hidden`) renders inside the
34
+ field via a presentational wrapper element, and the input announces as a
35
+ searchbox. No prop needed — the native type is the switch.
36
+
37
+ ## Examples
38
+
39
+ ```tsx
40
+ import { Input } from '@gears-frontx/ui-kit';
41
+
42
+ // Uncontrolled with placeholder
43
+ <Input placeholder="Project name" />
44
+
45
+ // Search field — the native type brings the magnifier and searchbox role
46
+ <Input type="search" placeholder="Search projects…" />
47
+
48
+ // Controlled
49
+ <Input value={email} onValueChange={setEmail} type="email" />
50
+
51
+ // Invalid state (set automatically when used inside a Field with an error)
52
+ <Input aria-invalid={true} defaultValue="not-an-email" />
53
+
54
+ // Disabled
55
+ <Input disabled value="read only for now" />
56
+ ```
57
+
58
+ ## Anti-patterns
59
+
60
+ - Do not use `onChange` + `event.target.value` when `onValueChange` is
61
+ enough — it hands you the string directly.
62
+ - Do not restyle via inline `style` — sizing/spacing tweaks belong to layout
63
+ containers, colors to theme tokens.
64
+ - Do not build a labelled input by hand — the `Field` composition handles
65
+ label/error/description wiring.
@@ -0,0 +1,50 @@
1
+ # Label
2
+
3
+ A caption for a form control. A styled native `<label>` — associate it with
4
+ a control via `htmlFor`, or by nesting the control inside it.
5
+
6
+ ## When to use
7
+
8
+ - Naming any form control: `input`, `textarea`, `select`, `checkbox`,
9
+ `switch`, `radio-group` items.
10
+ - Inline labels next to a checkbox/switch (nest the control, get the click
11
+ target for free).
12
+
13
+ ## When not to use
14
+
15
+ - Headings or free-standing text — labels are for controls; use regular
16
+ markup styled by the consumer app.
17
+ - Inside a form, prefer the `Field` composition — it wires the label,
18
+ control, description, and error together automatically.
19
+
20
+ ## Props (kit level)
21
+
22
+ | Prop | Type | Default |
23
+ |------|------|---------|
24
+ | `className` | `string` — merged after the kit class | — |
25
+
26
+ All other props are native `<label>` props (`htmlFor`, ...) and are
27
+ forwarded as-is. A `data-disabled` attribute dims the label (set
28
+ automatically inside a Field whose control is disabled).
29
+
30
+ ## Examples
31
+
32
+ ```tsx
33
+ import { Input, Label } from '@gears-frontx/ui-kit';
34
+
35
+ // Explicit association
36
+ <Label htmlFor="email">Email</Label>
37
+ <Input id="email" type="email" />
38
+
39
+ // Nested control (single click target)
40
+ <Label>
41
+ <input type="checkbox" /> Remember me
42
+ </Label>
43
+ ```
44
+
45
+ ## Anti-patterns
46
+
47
+ - Do not render a label without associating it with a control — screen
48
+ readers get nothing from an orphan label.
49
+ - Do not use placeholders instead of labels — placeholders disappear on
50
+ input.