@optimum-intelligence/opti-ui 0.3.0 → 0.5.0
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/README.md +28 -7
- package/dist/components/accordion/Accordion.d.ts +12 -0
- package/dist/components/accordion/Accordion.js +12 -0
- package/dist/components/accordion/Accordion.js.map +1 -1
- package/dist/components/alert/Alert.d.ts +4 -0
- package/dist/components/alert/Alert.js.map +1 -1
- package/dist/components/app-shell/AppShell.d.ts +96 -5
- package/dist/components/app-shell/AppShell.js +676 -185
- package/dist/components/app-shell/AppShell.js.map +1 -1
- package/dist/components/avatar/Avatar.d.ts +8 -0
- package/dist/components/avatar/Avatar.js +2 -0
- package/dist/components/avatar/Avatar.js.map +1 -1
- package/dist/components/badge/Badge.d.ts +10 -3
- package/dist/components/badge/Badge.js +17 -28
- package/dist/components/badge/Badge.js.map +1 -1
- package/dist/components/breadcrumbs/Breadcrumbs.d.ts +1 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/components/button/Button.d.ts +8 -0
- package/dist/components/button/Button.js +6 -0
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/calendar/Calendar.d.ts +21 -7
- package/dist/components/calendar/Calendar.js +285 -212
- package/dist/components/calendar/Calendar.js.map +1 -1
- package/dist/components/calendar/DateConfig.d.ts +37 -0
- package/dist/components/calendar/DateConfig.js +75 -0
- package/dist/components/calendar/DateConfig.js.map +1 -0
- package/dist/components/calendar/date-utils.d.ts +41 -6
- package/dist/components/calendar/date-utils.js +119 -20
- package/dist/components/calendar/date-utils.js.map +1 -1
- package/dist/components/card/Card.d.ts +13 -0
- package/dist/components/card/Card.js +13 -0
- package/dist/components/card/Card.js.map +1 -1
- package/dist/components/choice/Choice.d.ts +13 -0
- package/dist/components/choice/Choice.js +10 -0
- package/dist/components/choice/Choice.js.map +1 -1
- package/dist/components/combobox/Combobox.d.ts +12 -0
- package/dist/components/combobox/Combobox.js.map +1 -1
- package/dist/components/command-palette/CommandPalette.d.ts +10 -0
- package/dist/components/command-palette/CommandPalette.js.map +1 -1
- package/dist/components/data-table/DataTable.d.ts +4 -0
- package/dist/components/data-table/DataTable.js.map +1 -1
- package/dist/components/data-table/DataTableContent.d.ts +1 -0
- package/dist/components/data-table/DataTableContent.js +3 -3
- package/dist/components/data-table/DataTableContent.js.map +1 -1
- package/dist/components/data-table/DataTableFilters.d.ts +3 -0
- package/dist/components/data-table/DataTableFilters.js.map +1 -1
- package/dist/components/data-table/types.d.ts +16 -0
- package/dist/components/date-picker/DatePicker.d.ts +33 -10
- package/dist/components/date-picker/DatePicker.js +315 -279
- package/dist/components/date-picker/DatePicker.js.map +1 -1
- package/dist/components/date-picker/DateRangePicker.d.ts +12 -4
- package/dist/components/date-picker/DateRangePicker.js +240 -206
- package/dist/components/date-picker/DateRangePicker.js.map +1 -1
- package/dist/components/date-picker/PickerField.d.ts +13 -0
- package/dist/components/date-picker/PickerField.js +1 -1
- package/dist/components/date-picker/PickerField.js.map +1 -1
- package/dist/components/dialog/Dialog.d.ts +5 -0
- package/dist/components/dialog/Dialog.js.map +1 -1
- package/dist/components/drawer/Drawer.d.ts +10 -0
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/empty-state/EmptyState.d.ts +5 -0
- package/dist/components/empty-state/EmptyState.js.map +1 -1
- package/dist/components/file-upload/FileUpload.d.ts +21 -0
- package/dist/components/file-upload/FileUpload.js.map +1 -1
- package/dist/components/input/Input.d.ts +7 -0
- package/dist/components/input/Input.js +3 -0
- package/dist/components/input/Input.js.map +1 -1
- package/dist/components/link/Link.d.ts +1 -0
- package/dist/components/link/Link.js.map +1 -1
- package/dist/components/menu/Menu.d.ts +6 -0
- package/dist/components/menu/Menu.js.map +1 -1
- package/dist/components/number-field/NumberField.d.ts +7 -0
- package/dist/components/number-field/NumberField.js.map +1 -1
- package/dist/components/pagination/Pagination.d.ts +4 -0
- package/dist/components/pagination/Pagination.js.map +1 -1
- package/dist/components/popover/Popover.d.ts +4 -0
- package/dist/components/popover/Popover.js.map +1 -1
- package/dist/components/preview-card/PreviewCard.d.ts +4 -0
- package/dist/components/preview-card/PreviewCard.js.map +1 -1
- package/dist/components/progress/Progress.d.ts +8 -0
- package/dist/components/progress/Progress.js.map +1 -1
- package/dist/components/scroll-area/ScrollArea.d.ts +1 -0
- package/dist/components/scroll-area/ScrollArea.js.map +1 -1
- package/dist/components/search-input/SearchInput.d.ts +2 -0
- package/dist/components/search-input/SearchInput.js.map +1 -1
- package/dist/components/select/Select.d.ts +11 -0
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components/separator/Separator.d.ts +1 -0
- package/dist/components/separator/Separator.js +1 -0
- package/dist/components/separator/Separator.js.map +1 -1
- package/dist/components/skeleton/Skeleton.d.ts +7 -0
- package/dist/components/skeleton/Skeleton.js +1 -0
- package/dist/components/skeleton/Skeleton.js.map +1 -1
- package/dist/components/slider/Slider.d.ts +1 -0
- package/dist/components/slider/Slider.js.map +1 -1
- package/dist/components/spinner/Spinner.d.ts +2 -0
- package/dist/components/spinner/Spinner.js +1 -0
- package/dist/components/spinner/Spinner.js.map +1 -1
- package/dist/components/stat-card/StatCard.d.ts +4 -0
- package/dist/components/stat-card/StatCard.js.map +1 -1
- package/dist/components/stepper/Stepper.d.ts +4 -0
- package/dist/components/stepper/Stepper.js.map +1 -1
- package/dist/components/table/Table.d.ts +24 -1
- package/dist/components/table/Table.js +19 -2
- package/dist/components/table/Table.js.map +1 -1
- package/dist/components/tabs/Tabs.d.ts +1 -0
- package/dist/components/tabs/Tabs.js.map +1 -1
- package/dist/components/tag/Tag.d.ts +3 -0
- package/dist/components/tag/Tag.js.map +1 -1
- package/dist/components/toast/Toast.d.ts +2 -0
- package/dist/components/toast/Toast.js.map +1 -1
- package/dist/components/toggle/Toggle.d.ts +7 -0
- package/dist/components/toggle/Toggle.js +1 -0
- package/dist/components/toggle/Toggle.js.map +1 -1
- package/dist/components/tooltip/Tooltip.d.ts +8 -0
- package/dist/components/tooltip/Tooltip.js.map +1 -1
- package/dist/components/typography/Typography.d.ts +5 -0
- package/dist/components/typography/Typography.js +2 -0
- package/dist/components/typography/Typography.js.map +1 -1
- package/dist/components.json +5534 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -3
- package/dist/llms-full.txt +2707 -0
- package/dist/llms.txt +177 -0
- package/dist/opti-ui.css +171 -81
- package/dist/theme/ThemeProvider.d.ts +1 -0
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/utils/portal.d.ts +4 -0
- package/dist/utils/portal.js +4 -0
- package/dist/utils/portal.js.map +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,2707 @@
|
|
|
1
|
+
# Opti UI (`@optimum-intelligence/opti-ui`)
|
|
2
|
+
|
|
3
|
+
> Optimum's customizable React component library, built on Base UI. React 19, styled with CSS custom properties (`--oui-*`) in cascade layers.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
React 19 is a peer dependency; the build is precompiled with React Compiler. `@base-ui/react` is installed with the package.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import '@optimum-intelligence/opti-ui/styles.css';
|
|
11
|
+
import '@optimum-intelligence/opti-ui/fonts.css'; // optional: loads Poppins + Montserrat from Google Fonts
|
|
12
|
+
import { Button, Card, CardTitle, ToastProvider, Tooltip } from '@optimum-intelligence/opti-ui';
|
|
13
|
+
|
|
14
|
+
export function App() {
|
|
15
|
+
return (
|
|
16
|
+
<Tooltip.Provider>
|
|
17
|
+
<ToastProvider>
|
|
18
|
+
<Card>
|
|
19
|
+
<CardTitle>Monthly energy</CardTitle>
|
|
20
|
+
<Button>Export report</Button>
|
|
21
|
+
</Card>
|
|
22
|
+
</ToastProvider>
|
|
23
|
+
</Tooltip.Provider>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Add `class="oui-root"` to `<body>` for the library font, text color and background. Add `oui-isolate`
|
|
29
|
+
to your app root so portalled popups stack above app content. Every module has a `'use client'` banner,
|
|
30
|
+
so the components work in Next.js App Router.
|
|
31
|
+
|
|
32
|
+
## Customization
|
|
33
|
+
|
|
34
|
+
Start with the simplest option that does what you need:
|
|
35
|
+
|
|
36
|
+
1. **Tokens.** Every color, radius, shadow, font, size and duration is a `--oui-*` custom property. Most
|
|
37
|
+
colors are derived from two inputs with `color-mix()`, so a product theme is often just two values:
|
|
38
|
+
|
|
39
|
+
```css
|
|
40
|
+
:root {
|
|
41
|
+
--oui-color-brand: #0f2a44; /* deep base: primary buttons, headings, navbar, muted text */
|
|
42
|
+
--oui-color-accent: #1f8fd6; /* focus rings, selection, borders, tints */
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
2. **Scoped themes.** `<ThemeProvider theme={{ 'color-accent': '#1f8fd6' }} mode="dark">` applies tokens to a
|
|
47
|
+
subtree. Popups opened inside are portalled into the provider, so they inherit the same theme. For
|
|
48
|
+
dark mode across the whole app, set `data-oui-theme="dark"` on `<html>`.
|
|
49
|
+
3. **Component variables.** Use these per instance or globally, e.g. `--oui-button-radius`,
|
|
50
|
+
`--oui-button-height`, `--oui-input-height`, `--oui-card-padding`, `--oui-card-radius`,
|
|
51
|
+
`--oui-dialog-width`, `--oui-navbar-width`, `--oui-navbar-collapsed-width`, `--oui-switch-width`, `--oui-progress-height`.
|
|
52
|
+
4. **Classes.** All library CSS is inside cascade layers (`oui.tokens < oui.base < oui.components`).
|
|
53
|
+
Any unlayered CSS in your app overrides it, whatever its specificity, so `!important` is never
|
|
54
|
+
needed. Every part has a stable class (`oui-select__trigger`, `oui-dialog__footer`, …).
|
|
55
|
+
5. **State attributes.** Style states through Base UI's data attributes (`[data-checked]`,
|
|
56
|
+
`[data-popup-open]`, `[data-highlighted]`, …) and the library's own (`[data-variant]`, `[data-size]`,
|
|
57
|
+
`[data-tone]`). `className` also accepts a function of component state.
|
|
58
|
+
6. **The render prop.** Swap the rendered element and keep the styles and behaviour:
|
|
59
|
+
`<NavbarItem render={<NavLink to="/fleet" />}>`,
|
|
60
|
+
`<Button render={<a href="…" />} nativeButton={false}>`.
|
|
61
|
+
|
|
62
|
+
**Tailwind v4:** declare the layer order so utilities still win over library styles:
|
|
63
|
+
`@layer theme, base, oui, components, utilities;`
|
|
64
|
+
|
|
65
|
+
# Theme
|
|
66
|
+
|
|
67
|
+
## createTheme
|
|
68
|
+
|
|
69
|
+
function · Theme
|
|
70
|
+
|
|
71
|
+
Builds a theme from a base, applying overrides on top.
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { createTheme } from '@optimum-intelligence/opti-ui';
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Signature: `createTheme(...themes: Theme[])`
|
|
78
|
+
|
|
79
|
+
## ThemeProvider
|
|
80
|
+
|
|
81
|
+
component · Theme
|
|
82
|
+
|
|
83
|
+
Scopes a theme to its children. Popups opened inside are portalled into the
|
|
84
|
+
provider so they pick up the same tokens.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { ThemeProvider } from '@optimum-intelligence/opti-ui';
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
| Prop | Type | Default | Description |
|
|
91
|
+
| --- | --- | --- | --- |
|
|
92
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the provider's root element. |
|
|
93
|
+
| `theme?` | `Theme` | | Token overrides applied to this subtree. |
|
|
94
|
+
| `mode?` | `'light' \| 'dark'` | | Color mode for this subtree. |
|
|
95
|
+
|
|
96
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
97
|
+
|
|
98
|
+
## themeToStyle
|
|
99
|
+
|
|
100
|
+
function · Theme
|
|
101
|
+
|
|
102
|
+
Converts a theme object into CSS custom properties for a `style` prop.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { themeToStyle } from '@optimum-intelligence/opti-ui';
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Signature: `themeToStyle(theme: Theme \| undefined)`
|
|
109
|
+
|
|
110
|
+
# Forms
|
|
111
|
+
|
|
112
|
+
## Calendar
|
|
113
|
+
|
|
114
|
+
component · Forms
|
|
115
|
+
|
|
116
|
+
Month grid for picking one day. Keyboard: arrows move by day / week,
|
|
117
|
+
Home / End jump within the week, PageUp / PageDown change month (with Shift: year).
|
|
118
|
+
The month and year in the title open a list to jump straight to another one.
|
|
119
|
+
With `granularity="month"` or `"year"` it shows a month or year grid instead.
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import { Calendar } from '@optimum-intelligence/opti-ui';
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
<Calendar value={month} onValueChange={setMonth} granularity="month" />
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
| Prop | Type | Default | Description |
|
|
130
|
+
| --- | --- | --- | --- |
|
|
131
|
+
| `value?` | `string \| null` | | Selected day as an ISO date (`"2026-03-09"`). With a month or year `granularity`, the day it falls in is enough. |
|
|
132
|
+
| `defaultValue?` | `string \| null` | `null` | Initially selected day (ISO date) when uncontrolled. |
|
|
133
|
+
| `onValueChange?` | `(value: string) => void` | | Called with the picked day as an ISO date: the 1st of the month, or 1 January, for a month or year `granularity`. |
|
|
134
|
+
|
|
135
|
+
Also accepts all props of: `CalendarOptions`.
|
|
136
|
+
|
|
137
|
+
## Checkbox
|
|
138
|
+
|
|
139
|
+
component · Forms
|
|
140
|
+
|
|
141
|
+
Checkbox with optional `label` and `description`. Supports `indeterminate`.
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
import { Checkbox } from '@optimum-intelligence/opti-ui';
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
Also accepts all props of: `BaseCheckbox.Root.Props`, `ChoiceLabelProps`.
|
|
149
|
+
|
|
150
|
+
## CheckboxGroup
|
|
151
|
+
|
|
152
|
+
component · Forms
|
|
153
|
+
|
|
154
|
+
Manages the checked values of several `Checkbox` children (`value` / `onValueChange`).
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import { CheckboxGroup } from '@optimum-intelligence/opti-ui';
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
| Prop | Type | Default | Description |
|
|
161
|
+
| --- | --- | --- | --- |
|
|
162
|
+
| `orientation?` | `'vertical' \| 'horizontal'` | `'vertical'` | Layout direction of the checkboxes. |
|
|
163
|
+
|
|
164
|
+
Also accepts all props of: `BaseCheckboxGroup.Props`.
|
|
165
|
+
|
|
166
|
+
## Combobox
|
|
167
|
+
|
|
168
|
+
compound · Forms
|
|
169
|
+
|
|
170
|
+
Searchable select. `<Combobox items={…} />` covers single and `multiple`
|
|
171
|
+
(chips) selection; compose the parts for anything custom.
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import { Combobox } from '@optimum-intelligence/opti-ui';
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
| Prop | Type | Default | Description |
|
|
178
|
+
| --- | --- | --- | --- |
|
|
179
|
+
| `items` | `ComboboxOption[]` | | Options to choose from. |
|
|
180
|
+
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
181
|
+
| `description?` | `React.ReactNode` | | Help text under the input. |
|
|
182
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
183
|
+
| `placeholder?` | `string` | | Placeholder shown while nothing is typed or selected. |
|
|
184
|
+
| `emptyText?` | `React.ReactNode` | `'No results found.'` | Shown when the filter matches nothing. |
|
|
185
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
186
|
+
| `hideClear?` | `boolean` | | Hide the clear button. |
|
|
187
|
+
| `inputProps?` | `BaseCombobox.Input.Props` | | Props for the text input. |
|
|
188
|
+
|
|
189
|
+
Also accepts all props of: `RootProps`.
|
|
190
|
+
|
|
191
|
+
### Combobox.Root
|
|
192
|
+
|
|
193
|
+
Base UI `Combobox.Root` re-exported unchanged. See https://base-ui.com/react/components/combobox.
|
|
194
|
+
|
|
195
|
+
### Combobox.InputGroup
|
|
196
|
+
|
|
197
|
+
| Prop | Type | Default | Description |
|
|
198
|
+
| --- | --- | --- | --- |
|
|
199
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
200
|
+
|
|
201
|
+
Also accepts all props of: `BaseCombobox.InputGroup.Props`.
|
|
202
|
+
|
|
203
|
+
### Combobox.Input
|
|
204
|
+
|
|
205
|
+
### Combobox.Trigger
|
|
206
|
+
|
|
207
|
+
### Combobox.Clear
|
|
208
|
+
|
|
209
|
+
### Combobox.Value
|
|
210
|
+
|
|
211
|
+
Base UI `Combobox.Value` re-exported unchanged. See https://base-ui.com/react/components/combobox.
|
|
212
|
+
|
|
213
|
+
### Combobox.Chips
|
|
214
|
+
|
|
215
|
+
### Combobox.Chip
|
|
216
|
+
|
|
217
|
+
### Combobox.Content
|
|
218
|
+
|
|
219
|
+
| Prop | Type | Default | Description |
|
|
220
|
+
| --- | --- | --- | --- |
|
|
221
|
+
| `side?` | `BaseCombobox.Positioner.Props['side']` | | Which side of the input the list opens on. |
|
|
222
|
+
| `align?` | `BaseCombobox.Positioner.Props['align']` | | Alignment along that side. |
|
|
223
|
+
| `sideOffset?` | `BaseCombobox.Positioner.Props['sideOffset']` | `6` | Distance from the input in px. |
|
|
224
|
+
| `positionerProps?` | `BaseCombobox.Positioner.Props` | | Props for the positioner element that places the popup. |
|
|
225
|
+
|
|
226
|
+
Also accepts all props of: `BaseCombobox.Popup.Props`.
|
|
227
|
+
|
|
228
|
+
### Combobox.List
|
|
229
|
+
|
|
230
|
+
### Combobox.Item
|
|
231
|
+
|
|
232
|
+
### Combobox.Empty
|
|
233
|
+
|
|
234
|
+
### Combobox.Group
|
|
235
|
+
|
|
236
|
+
Base UI `Combobox.Group` re-exported unchanged. See https://base-ui.com/react/components/combobox.
|
|
237
|
+
|
|
238
|
+
### Combobox.GroupLabel
|
|
239
|
+
|
|
240
|
+
### Combobox.Collection
|
|
241
|
+
|
|
242
|
+
Base UI `Combobox.Collection` re-exported unchanged. See https://base-ui.com/react/components/combobox.
|
|
243
|
+
|
|
244
|
+
### Combobox.useFilter
|
|
245
|
+
|
|
246
|
+
Base UI `Combobox.useFilter` re-exported unchanged. See https://base-ui.com/react/components/combobox.
|
|
247
|
+
|
|
248
|
+
## DateConfigProvider
|
|
249
|
+
|
|
250
|
+
component · Forms
|
|
251
|
+
|
|
252
|
+
Sets default locale, time zone, week start and display formats for every
|
|
253
|
+
date picker and calendar inside it. Props on a component still win.
|
|
254
|
+
Nested providers override only the settings they pass.
|
|
255
|
+
|
|
256
|
+
```tsx
|
|
257
|
+
import { DateConfigProvider } from '@optimum-intelligence/opti-ui';
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
```tsx
|
|
261
|
+
<DateConfigProvider timeZone="Europe/Budapest" locale="hu-HU" formats={{ day: 'YYYY.MM.DD' }}>
|
|
262
|
+
<App />
|
|
263
|
+
</DateConfigProvider>
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
| Prop | Type | Default | Description |
|
|
267
|
+
| --- | --- | --- | --- |
|
|
268
|
+
| `locale?` | `string` | | BCP 47 locale for month and weekday names. |
|
|
269
|
+
| `timeZone?` | `string` | | IANA zone (`"Europe/Budapest"`) that date-times are shown and edited in. Defaults to the browser's. |
|
|
270
|
+
| `weekStartsOn?` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6` | | First calendar column: 0 = Sunday, 1 = Monday. |
|
|
271
|
+
| `formats?` | `Partial<Record<DateGranularity, string>>` | | Display patterns per granularity, e.g. `{ day: 'DD.MM.YYYY' }`. Tokens as in `formatDate`. |
|
|
272
|
+
| `children?` | `React.ReactNode` | | The subtree that uses these settings. |
|
|
273
|
+
|
|
274
|
+
## DatePicker
|
|
275
|
+
|
|
276
|
+
component · Forms
|
|
277
|
+
|
|
278
|
+
Date field with a calendar popover. Day values are ISO dates (`"2026-03-09"`),
|
|
279
|
+
the same format as `<input type="date">`. `granularity="month"` or `"year"` opens a
|
|
280
|
+
month or year grid and stores the period's first day (`"2026-03-01"`); a time
|
|
281
|
+
granularity behaves like `DateTimePicker`.
|
|
282
|
+
|
|
283
|
+
```tsx
|
|
284
|
+
import { DatePicker } from '@optimum-intelligence/opti-ui';
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
<DatePicker label="Delivery date" value={date} onValueChange={setDate} />
|
|
289
|
+
<DatePicker label="Billing month" granularity="month" format="MMMM YYYY" />
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
Also accepts all props of: `PickerProps`.
|
|
294
|
+
|
|
295
|
+
## DateRangePicker
|
|
296
|
+
|
|
297
|
+
component · Forms
|
|
298
|
+
|
|
299
|
+
Date range field with a calendar popover and optional presets. Values are
|
|
300
|
+
`{ start, end }` ISO dates (`"2026-03-09"`), both inclusive. With
|
|
301
|
+
`granularity="month"` or `"year"` it picks whole months or years, and each end
|
|
302
|
+
is the first day of its period.
|
|
303
|
+
|
|
304
|
+
```tsx
|
|
305
|
+
import { DateRangePicker } from '@optimum-intelligence/opti-ui';
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
```tsx
|
|
309
|
+
<DateRangePicker label="Period" value={period} onValueChange={setPeriod} presets={presets} />
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
| Prop | Type | Default | Description |
|
|
313
|
+
| --- | --- | --- | --- |
|
|
314
|
+
| `ref?` | `React.Ref<HTMLButtonElement>` | | Ref to the trigger button. |
|
|
315
|
+
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
316
|
+
| `description?` | `React.ReactNode` | | Help text under the field. |
|
|
317
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
318
|
+
| `required?` | `boolean` | | Marks the field required and adds the required indicator to the label. |
|
|
319
|
+
| `disabled?` | `boolean` | | Disables the field. |
|
|
320
|
+
| `placeholder?` | `React.ReactNode` | `'Select dates'` | Text shown while no date is selected. |
|
|
321
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
322
|
+
| `open?` | `boolean` | | Whether the calendar popover is open (controlled). |
|
|
323
|
+
| `defaultOpen?` | `boolean` | | Initial popover state when uncontrolled. |
|
|
324
|
+
| `onOpenChange?` | `(open: boolean) => void` | | Called when the popover opens or closes. |
|
|
325
|
+
| `id?` | `string` | | Id of the trigger button. Generated when omitted. |
|
|
326
|
+
| `className?` | `string` | | Class name for the trigger button. |
|
|
327
|
+
| `triggerProps?` | `Omit<React.ComponentProps<typeof BasePopover.Trigger>, 'children' \| 'disabled' \| 'id'>` | | Props for the trigger button (aria-*, data-*, onBlur…). |
|
|
328
|
+
| `contentProps?` | `Omit<PopoverContentProps, 'children'>` | | Props for the popover content. |
|
|
329
|
+
| `value?` | `DateRange \| null` | | Selected days as ISO dates; both ends are inclusive. |
|
|
330
|
+
| `defaultValue?` | `DateRange \| null` | `null` | Initially selected range when uncontrolled. |
|
|
331
|
+
| `onValueChange?` | `(value: DateRange \| null) => void` | | Called with the new range, or `null` when cleared. |
|
|
332
|
+
| `min?` | `string` | | Earliest allowed day. |
|
|
333
|
+
| `max?` | `string` | | Latest allowed day. |
|
|
334
|
+
| `presets?` | `DateRangePreset[]` | | Shortcuts listed beside the calendar ("Last 7 days", "This month"…). |
|
|
335
|
+
| `startName?` | `string` | | Submits the first day with a form under this name. |
|
|
336
|
+
| `endName?` | `string` | | Submits the last day with a form under this name. |
|
|
337
|
+
| `clearable?` | `boolean` | | Show the Clear action. Defaults to `true` unless `required`. |
|
|
338
|
+
| `format?` | `string` | | Display pattern for each end, e.g. `"DD.MM.YYYY"` (tokens as in `formatDate`). Defaults to `DateConfigProvider` formats, then an ISO-style pattern for the granularity. |
|
|
339
|
+
| `formatValue?` | `(value: DateRange) => React.ReactNode` | | Custom display text for the selected range. Wins over `format`. |
|
|
340
|
+
| `labels?` | `Partial<DateRangePickerLabels>` | | Override texts for localisation. |
|
|
341
|
+
|
|
342
|
+
Also accepts all props of: `Pick<RangeCalendarProps, 'isDateDisabled' \| 'defaultMonth' \| 'locale' \| 'weekStartsOn' \| 'numberOfMonths' \| 'granularity'>`.
|
|
343
|
+
|
|
344
|
+
## DateTimePicker
|
|
345
|
+
|
|
346
|
+
component · Forms
|
|
347
|
+
|
|
348
|
+
Date and time field. Values are UTC instants (`"2026-03-09T13:30:00Z"`) shown and
|
|
349
|
+
edited in `timeZone` (the browser's by default) on a 24-hour clock, as
|
|
350
|
+
`2026-03-09 14:30`. Values without an offset (`"2026-03-09T14:30"`) are read as
|
|
351
|
+
wall-clock time in `timeZone`.
|
|
352
|
+
|
|
353
|
+
```tsx
|
|
354
|
+
import { DateTimePicker } from '@optimum-intelligence/opti-ui';
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
```tsx
|
|
358
|
+
<DateTimePicker label="Departure" value={slot} onValueChange={setSlot} timeZone="Europe/Budapest" />
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
| Prop | Type | Default | Description |
|
|
362
|
+
| --- | --- | --- | --- |
|
|
363
|
+
| `step?` | `number` | | Spacing of the time options in seconds (60 = every minute, 900 = quarter hours, 1 = every second). |
|
|
364
|
+
| `defaultTime?` | `string` | | Time (`"09:00"`) used when a day is picked before any time is set. |
|
|
365
|
+
| `granularity?` | `'hour' \| 'minute' \| 'second'` | `'minute'` | Smallest unit shown and stored: `hour`, `minute` or `second`. When omitted, `second` if `step` is not a whole number of minutes, otherwise `minute`. |
|
|
366
|
+
|
|
367
|
+
Also accepts all props of: `PickerProps`.
|
|
368
|
+
|
|
369
|
+
## Dropzone
|
|
370
|
+
|
|
371
|
+
component · Forms
|
|
372
|
+
|
|
373
|
+
Drop target that also opens the file browser on click, Enter or Space.
|
|
374
|
+
|
|
375
|
+
```tsx
|
|
376
|
+
import { Dropzone } from '@optimum-intelligence/opti-ui';
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
| Prop | Type | Default | Description |
|
|
380
|
+
| --- | --- | --- | --- |
|
|
381
|
+
| `ref?` | `React.Ref<HTMLLabelElement>` | | Ref to the dropzone element. |
|
|
382
|
+
| `onFiles?` | `(files: File[]) => void` | | Called with the picked or dropped files that pass `accept` and `maxSize`. |
|
|
383
|
+
| `onReject?` | `(rejections: FileRejection[]) => void` | | Called with the files that were turned away, and why. |
|
|
384
|
+
| `accept?` | `string` | | Allowed types, as for `<input accept>`: `".pdf,image/*"`. |
|
|
385
|
+
| `multiple?` | `boolean` | | Allow choosing several files. |
|
|
386
|
+
| `maxSize?` | `number` | | Largest allowed file, in bytes. |
|
|
387
|
+
| `files?` | `File[]` | | The current selection. It is kept in the native input, so the files submit with a form and `required` validates. Without it the input is emptied after each pick. |
|
|
388
|
+
| `disabled?` | `boolean` | | Disables picking and dropping. |
|
|
389
|
+
| `invalid?` | `boolean` | | Shows the error styling. |
|
|
390
|
+
| `size?` | `'sm' \| 'md'` | `'md'` | `sm` is a single compact row. |
|
|
391
|
+
| `icon?` | `React.ReactNode` | | Icon shown before the title. Defaults to an upload icon. |
|
|
392
|
+
| `title?` | `React.ReactNode` | | Main line. Defaults to "Drop files here or click to browse". |
|
|
393
|
+
| `hint?` | `React.ReactNode` | | Secondary line, e.g. the allowed types and size. |
|
|
394
|
+
| `inputProps?` | `Omit<React.ComponentProps<'input'>, 'ref' \| 'type'>` | | Props for the file input (name, id, required, aria-*…). |
|
|
395
|
+
|
|
396
|
+
Also accepts all props of: `Omit<React.LabelHTMLAttributes<HTMLLabelElement>, 'title'>`.
|
|
397
|
+
|
|
398
|
+
## Field
|
|
399
|
+
|
|
400
|
+
compound · Forms
|
|
401
|
+
|
|
402
|
+
Field parts wire up labels, descriptions and validation for any control
|
|
403
|
+
inside (Input, Select, Checkbox, Switch, NumberField…).
|
|
404
|
+
|
|
405
|
+
```tsx
|
|
406
|
+
import { Field } from '@optimum-intelligence/opti-ui';
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### Field.Root
|
|
410
|
+
|
|
411
|
+
### Field.Label
|
|
412
|
+
|
|
413
|
+
| Prop | Type | Default | Description |
|
|
414
|
+
| --- | --- | --- | --- |
|
|
415
|
+
| `required?` | `boolean` | | Appends a required marker. |
|
|
416
|
+
|
|
417
|
+
Also accepts all props of: `BaseField.Label.Props`.
|
|
418
|
+
|
|
419
|
+
### Field.Description
|
|
420
|
+
|
|
421
|
+
### Field.Error
|
|
422
|
+
|
|
423
|
+
### Field.Item
|
|
424
|
+
|
|
425
|
+
### Field.Validity
|
|
426
|
+
|
|
427
|
+
Base UI `Field.Validity` re-exported unchanged. See https://base-ui.com/react/components/field.
|
|
428
|
+
|
|
429
|
+
## Fieldset
|
|
430
|
+
|
|
431
|
+
compound · Forms
|
|
432
|
+
|
|
433
|
+
Groups related fields under a legend.
|
|
434
|
+
|
|
435
|
+
```tsx
|
|
436
|
+
import { Fieldset } from '@optimum-intelligence/opti-ui';
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### Fieldset.Root
|
|
440
|
+
|
|
441
|
+
### Fieldset.Legend
|
|
442
|
+
|
|
443
|
+
## FileItem
|
|
444
|
+
|
|
445
|
+
component · Forms
|
|
446
|
+
|
|
447
|
+
One file in a list: name, size, upload progress or error, and a remove button.
|
|
448
|
+
|
|
449
|
+
```tsx
|
|
450
|
+
import { FileItem } from '@optimum-intelligence/opti-ui';
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
| Prop | Type | Default | Description |
|
|
454
|
+
| --- | --- | --- | --- |
|
|
455
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the item element. |
|
|
456
|
+
| `name` | `string` | | File name. |
|
|
457
|
+
| `size?` | `number` | | Size in bytes. |
|
|
458
|
+
| `icon?` | `React.ReactNode` | | Icon before the name. Defaults to a file icon. |
|
|
459
|
+
| `status?` | `'idle' \| 'uploading' \| 'success' \| 'error'` | `'idle'` | Upload state; sets the progress bar and error styling. |
|
|
460
|
+
| `progress?` | `number \| null` | `null` | Upload progress from 0 to 100, shown while `uploading`. `null` is indeterminate. |
|
|
461
|
+
| `error?` | `React.ReactNode` | | Message shown in place of the size when `status` is `error`. |
|
|
462
|
+
| `onRemove?` | `() => void` | | Adds the remove button. |
|
|
463
|
+
| `removeLabel?` | `string` | | Accessible name of the remove button. Defaults to "Remove {name}". |
|
|
464
|
+
| `actions?` | `React.ReactNode` | | Extra controls before the remove button (download, preview…). |
|
|
465
|
+
| `locale?` | `string` | | BCP 47 locale for the size. |
|
|
466
|
+
|
|
467
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
468
|
+
|
|
469
|
+
## FileUpload
|
|
470
|
+
|
|
471
|
+
component · Forms
|
|
472
|
+
|
|
473
|
+
File field: a dropzone plus the list of chosen files. It only collects
|
|
474
|
+
`File` objects; upload them yourself and report progress through `fileState`.
|
|
475
|
+
|
|
476
|
+
```tsx
|
|
477
|
+
import { FileUpload } from '@optimum-intelligence/opti-ui';
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
| Prop | Type | Default | Description |
|
|
481
|
+
| --- | --- | --- | --- |
|
|
482
|
+
| `ref?` | `React.Ref<HTMLLabelElement>` | | Ref to the dropzone element. |
|
|
483
|
+
| `value?` | `File[]` | | Chosen files (controlled). |
|
|
484
|
+
| `defaultValue?` | `File[]` | | Initially chosen files when uncontrolled. |
|
|
485
|
+
| `onValueChange?` | `(files: File[]) => void` | | Called with the full list of files after a file is added or removed. |
|
|
486
|
+
| `maxFiles?` | `number` | | Most files allowed when `multiple`. |
|
|
487
|
+
| `fileState?` | `(file: File) => Pick<FileItemProps, 'status' \| 'progress' \| 'error'> \| undefined` | | Upload state of a file, for showing progress and errors in the list. |
|
|
488
|
+
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
489
|
+
| `description?` | `React.ReactNode` | | Help text under the dropzone. |
|
|
490
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
491
|
+
| `required?` | `boolean` | | Requires at least one file before the form submits. |
|
|
492
|
+
| `disabled?` | `boolean` | | Disables picking, dropping and removing files. |
|
|
493
|
+
| `name?` | `string` | | Submits the files with a form under this name. |
|
|
494
|
+
| `id?` | `string` | | Id of the file input. Generated when omitted. |
|
|
495
|
+
| `className?` | `string` | | Class name for the root element. |
|
|
496
|
+
| `locale?` | `string` | | BCP 47 locale for file sizes. |
|
|
497
|
+
| `labels?` | `Partial<FileUploadLabels>` | | Override texts for localisation. |
|
|
498
|
+
|
|
499
|
+
Also accepts all props of: `Pick<DropzoneProps, 'accept' \| 'multiple' \| 'maxSize' \| 'onReject' \| 'size' \| 'icon' \| 'title' \| 'hint'>`.
|
|
500
|
+
|
|
501
|
+
## Form
|
|
502
|
+
|
|
503
|
+
component · Forms
|
|
504
|
+
|
|
505
|
+
Form with Base UI validation wiring and vertical field spacing.
|
|
506
|
+
|
|
507
|
+
```tsx
|
|
508
|
+
import { Form } from '@optimum-intelligence/opti-ui';
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
Also accepts all props of: `BaseForm.Props`.
|
|
513
|
+
|
|
514
|
+
## formatDate
|
|
515
|
+
|
|
516
|
+
function · Forms
|
|
517
|
+
|
|
518
|
+
Formats a date or date-time the way the date pickers show it: ISO-style
|
|
519
|
+
(`2026-03-09 14:30`) on a 24-hour clock by default, or with a custom `format`.
|
|
520
|
+
Instants (`"2026-03-09T13:30:00Z"`) are shown in `timeZone`. Returns `""` for an invalid value.
|
|
521
|
+
|
|
522
|
+
```tsx
|
|
523
|
+
import { formatDate } from '@optimum-intelligence/opti-ui';
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
Signature: `formatDate(value: string \| null \| undefined, options: FormatDateOptions = {})`
|
|
527
|
+
|
|
528
|
+
```tsx
|
|
529
|
+
formatDate('2026-03-09T13:30:00Z', { timeZone: 'Europe/Budapest' }); // "2026-03-09 14:30"
|
|
530
|
+
formatDate('2026-03-01', { granularity: 'month', format: 'MMMM YYYY', locale: 'en' }); // "March 2026"
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
## formatFileSize
|
|
534
|
+
|
|
535
|
+
function · Forms
|
|
536
|
+
|
|
537
|
+
`1536` → `"1.5 KB"`.
|
|
538
|
+
|
|
539
|
+
```tsx
|
|
540
|
+
import { formatFileSize } from '@optimum-intelligence/opti-ui';
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
Signature: `formatFileSize(bytes: number, locale?: string)`
|
|
544
|
+
|
|
545
|
+
## Input
|
|
546
|
+
|
|
547
|
+
component · Forms
|
|
548
|
+
|
|
549
|
+
Text input, optionally with `startAdornment` / `endAdornment` inside the box. Use `TextField` for a labelled one.
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
import { Input } from '@optimum-intelligence/opti-ui';
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
| Prop | Type | Default | Description |
|
|
556
|
+
| --- | --- | --- | --- |
|
|
557
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
558
|
+
| `startAdornment?` | `React.ReactNode` | | Icon or text rendered inside the box, before the value. |
|
|
559
|
+
| `endAdornment?` | `React.ReactNode` | | Icon, text or button rendered inside the box, after the value. |
|
|
560
|
+
|
|
561
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
562
|
+
|
|
563
|
+
## NumberField
|
|
564
|
+
|
|
565
|
+
component · Forms
|
|
566
|
+
|
|
567
|
+
Numeric input with stepper buttons, locale formatting and keyboard stepping.
|
|
568
|
+
|
|
569
|
+
```tsx
|
|
570
|
+
import { NumberField } from '@optimum-intelligence/opti-ui';
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
| Prop | Type | Default | Description |
|
|
574
|
+
| --- | --- | --- | --- |
|
|
575
|
+
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
576
|
+
| `description?` | `React.ReactNode` | | Help text under the input. |
|
|
577
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
578
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
579
|
+
| `placeholder?` | `string` | | Placeholder shown while empty. |
|
|
580
|
+
| `hideStepper?` | `boolean` | | Hide the − / + stepper buttons. |
|
|
581
|
+
| `decrementLabel?` | `string` | `'Decrease'` | Accessible name of the − button. |
|
|
582
|
+
| `incrementLabel?` | `string` | `'Increase'` | Accessible name of the + button. |
|
|
583
|
+
|
|
584
|
+
Also accepts all props of: `BaseNumberField.Root.Props`.
|
|
585
|
+
|
|
586
|
+
## PasswordField
|
|
587
|
+
|
|
588
|
+
component · Forms
|
|
589
|
+
|
|
590
|
+
Labelled password input with description and error message.
|
|
591
|
+
|
|
592
|
+
```tsx
|
|
593
|
+
import { PasswordField } from '@optimum-intelligence/opti-ui';
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
| Prop | Type | Default | Description |
|
|
597
|
+
| --- | --- | --- | --- |
|
|
598
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
599
|
+
| `startAdornment?` | `React.ReactNode` | | Icon or text rendered inside the box, before the value. |
|
|
600
|
+
| `visible?` | `boolean` | | Whether the value is shown as plain text. |
|
|
601
|
+
| `defaultVisible?` | `boolean` | | Initial visibility when uncontrolled. |
|
|
602
|
+
| `onVisibleChange?` | `(visible: boolean) => void` | | Called when the user toggles visibility. |
|
|
603
|
+
| `toggleLabel?` | `string` | | Accessible name of the show/hide button. |
|
|
604
|
+
|
|
605
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`, `FieldShellProps`.
|
|
606
|
+
|
|
607
|
+
## PasswordInput
|
|
608
|
+
|
|
609
|
+
component · Forms
|
|
610
|
+
|
|
611
|
+
Password input with a button that reveals the value.
|
|
612
|
+
|
|
613
|
+
```tsx
|
|
614
|
+
import { PasswordInput } from '@optimum-intelligence/opti-ui';
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
| Prop | Type | Default | Description |
|
|
618
|
+
| --- | --- | --- | --- |
|
|
619
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
620
|
+
| `startAdornment?` | `React.ReactNode` | | Icon or text rendered inside the box, before the value. |
|
|
621
|
+
| `visible?` | `boolean` | | Whether the value is shown as plain text. |
|
|
622
|
+
| `defaultVisible?` | `boolean` | `false` | Initial visibility when uncontrolled. |
|
|
623
|
+
| `onVisibleChange?` | `(visible: boolean) => void` | | Called when the user toggles visibility. |
|
|
624
|
+
| `toggleLabel?` | `string` | `'Show password'` | Accessible name of the show/hide button. |
|
|
625
|
+
|
|
626
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
627
|
+
|
|
628
|
+
## Radio
|
|
629
|
+
|
|
630
|
+
component · Forms
|
|
631
|
+
|
|
632
|
+
Radio button with optional `label` and `description`. Use inside `RadioGroup`; each needs a `value`.
|
|
633
|
+
|
|
634
|
+
```tsx
|
|
635
|
+
import { Radio } from '@optimum-intelligence/opti-ui';
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
Also accepts all props of: `BaseRadio.Root.Props`, `ChoiceLabelProps`.
|
|
640
|
+
|
|
641
|
+
## RadioGroup
|
|
642
|
+
|
|
643
|
+
component · Forms
|
|
644
|
+
|
|
645
|
+
Single-choice group for `Radio` children (`value` / `onValueChange`).
|
|
646
|
+
|
|
647
|
+
```tsx
|
|
648
|
+
import { RadioGroup } from '@optimum-intelligence/opti-ui';
|
|
649
|
+
```
|
|
650
|
+
|
|
651
|
+
| Prop | Type | Default | Description |
|
|
652
|
+
| --- | --- | --- | --- |
|
|
653
|
+
| `orientation?` | `'vertical' \| 'horizontal'` | `'vertical'` | Layout direction of the radios. |
|
|
654
|
+
|
|
655
|
+
Also accepts all props of: `BaseRadioGroup.Props`.
|
|
656
|
+
|
|
657
|
+
## RangeCalendar
|
|
658
|
+
|
|
659
|
+
component · Forms
|
|
660
|
+
|
|
661
|
+
Month grid for picking a range of days: the first pick sets one end, the
|
|
662
|
+
second completes the range (in either order). Same keyboard as Calendar.
|
|
663
|
+
Disabled days cannot be picked as an end but may fall inside a range.
|
|
664
|
+
|
|
665
|
+
```tsx
|
|
666
|
+
import { RangeCalendar } from '@optimum-intelligence/opti-ui';
|
|
667
|
+
```
|
|
668
|
+
|
|
669
|
+
| Prop | Type | Default | Description |
|
|
670
|
+
| --- | --- | --- | --- |
|
|
671
|
+
| `value?` | `DateRange \| null` | | Selected days as ISO dates; both ends are inclusive. With a month or year `granularity`, each end is the 1st day of its month or year. |
|
|
672
|
+
| `defaultValue?` | `DateRange \| null` | `null` | Initially selected range when uncontrolled. |
|
|
673
|
+
| `onValueChange?` | `(value: DateRange) => void` | | Called once both ends are picked, with `start` on or before `end`. |
|
|
674
|
+
|
|
675
|
+
Also accepts all props of: `CalendarOptions`.
|
|
676
|
+
|
|
677
|
+
## SearchInput
|
|
678
|
+
|
|
679
|
+
component · Forms
|
|
680
|
+
|
|
681
|
+
Text input with a search icon and a clear button that appears once there is a value.
|
|
682
|
+
|
|
683
|
+
```tsx
|
|
684
|
+
import { SearchInput } from '@optimum-intelligence/opti-ui';
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
| Prop | Type | Default | Description |
|
|
688
|
+
| --- | --- | --- | --- |
|
|
689
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
690
|
+
| `value?` | `string` | | Current text (controlled). |
|
|
691
|
+
| `defaultValue?` | `string` | `''` | Initial text when uncontrolled. |
|
|
692
|
+
| `onValueChange?` | `(value: string) => void` | | Called with the new text on typing and with `''` on clear. |
|
|
693
|
+
| `clearLabel?` | `string` | `'Clear search'` | Accessible name of the clear button. |
|
|
694
|
+
| `icon?` | `React.ReactNode` | | Replaces the leading search icon. |
|
|
695
|
+
|
|
696
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
697
|
+
|
|
698
|
+
## Select
|
|
699
|
+
|
|
700
|
+
compound · Forms
|
|
701
|
+
|
|
702
|
+
`<Select items={…} />` renders a complete labelled select. For full control
|
|
703
|
+
compose the parts: `Select.Root`, `Select.Trigger`, `Select.Content`,
|
|
704
|
+
`Select.Item`, `Select.Group`, `Select.GroupLabel`, `Select.Separator`.
|
|
705
|
+
|
|
706
|
+
```tsx
|
|
707
|
+
import { Select } from '@optimum-intelligence/opti-ui';
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
| Prop | Type | Default | Description |
|
|
711
|
+
| --- | --- | --- | --- |
|
|
712
|
+
| `items` | `Array<SelectOption \| SelectOptionGroup>` | | Options, or groups of options. |
|
|
713
|
+
| `label?` | `React.ReactNode` | | Visible field label. |
|
|
714
|
+
| `description?` | `React.ReactNode` | | Help text under the trigger. |
|
|
715
|
+
| `error?` | `React.ReactNode` | | Error message. When set, the field is marked invalid. |
|
|
716
|
+
| `placeholder?` | `React.ReactNode` | `'Select…'` | Text shown while nothing is selected. |
|
|
717
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
718
|
+
| `triggerProps?` | `Omit<SelectTriggerProps, 'size' \| 'placeholder'>` | | Props passed to the trigger button (className, style, aria-*). |
|
|
719
|
+
| `contentProps?` | `Omit<SelectContentProps, 'children'>` | | Props for the popup (side, align, className…). |
|
|
720
|
+
|
|
721
|
+
Also accepts all props of: `RootProps`.
|
|
722
|
+
|
|
723
|
+
### Select.Root
|
|
724
|
+
|
|
725
|
+
Base UI `Select.Root` re-exported unchanged. See https://base-ui.com/react/components/select.
|
|
726
|
+
|
|
727
|
+
### Select.Label
|
|
728
|
+
|
|
729
|
+
### Select.Trigger
|
|
730
|
+
|
|
731
|
+
The select button. Renders the value and chevron unless children are given.
|
|
732
|
+
|
|
733
|
+
| Prop | Type | Default | Description |
|
|
734
|
+
| --- | --- | --- | --- |
|
|
735
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Control height. |
|
|
736
|
+
| `placeholder?` | `React.ReactNode` | | Placeholder shown by the default value slot. |
|
|
737
|
+
|
|
738
|
+
Also accepts all props of: `BaseSelect.Trigger.Props`.
|
|
739
|
+
|
|
740
|
+
### Select.Value
|
|
741
|
+
|
|
742
|
+
### Select.Content
|
|
743
|
+
|
|
744
|
+
Portal + positioner + popup + list in one.
|
|
745
|
+
|
|
746
|
+
| Prop | Type | Default | Description |
|
|
747
|
+
| --- | --- | --- | --- |
|
|
748
|
+
| `side?` | `BaseSelect.Positioner.Props['side']` | | Which side of the trigger the list opens on. |
|
|
749
|
+
| `align?` | `BaseSelect.Positioner.Props['align']` | | Alignment along that side. |
|
|
750
|
+
| `sideOffset?` | `BaseSelect.Positioner.Props['sideOffset']` | `6` | Distance from the trigger in px. |
|
|
751
|
+
| `alignItemWithTrigger?` | `boolean` | `false` | Overlap the trigger so the selected item lines up with it (macOS style). |
|
|
752
|
+
| `positionerProps?` | `BaseSelect.Positioner.Props` | | Props for the positioner element that places the popup. |
|
|
753
|
+
|
|
754
|
+
Also accepts all props of: `BaseSelect.Popup.Props`.
|
|
755
|
+
|
|
756
|
+
### Select.Item
|
|
757
|
+
|
|
758
|
+
### Select.Group
|
|
759
|
+
|
|
760
|
+
### Select.GroupLabel
|
|
761
|
+
|
|
762
|
+
### Select.Separator
|
|
763
|
+
|
|
764
|
+
## Slider
|
|
765
|
+
|
|
766
|
+
component · Forms
|
|
767
|
+
|
|
768
|
+
Single value or range (pass an array) slider.
|
|
769
|
+
|
|
770
|
+
```tsx
|
|
771
|
+
import { Slider } from '@optimum-intelligence/opti-ui';
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
| Prop | Type | Default | Description |
|
|
775
|
+
| --- | --- | --- | --- |
|
|
776
|
+
| `label?` | `React.ReactNode` | | Visible label above the track. |
|
|
777
|
+
| `showValue?` | `boolean` | | Show the formatted value next to the label. |
|
|
778
|
+
| `thumbLabels?` | `string[]` | | Accessible labels for each thumb (needed for range sliders). |
|
|
779
|
+
|
|
780
|
+
Also accepts all props of: `BaseSlider.Root.Props`.
|
|
781
|
+
|
|
782
|
+
## Switch
|
|
783
|
+
|
|
784
|
+
component · Forms
|
|
785
|
+
|
|
786
|
+
On/off switch with optional `label` and `description`.
|
|
787
|
+
|
|
788
|
+
```tsx
|
|
789
|
+
import { Switch } from '@optimum-intelligence/opti-ui';
|
|
790
|
+
```
|
|
791
|
+
|
|
792
|
+
```tsx
|
|
793
|
+
<Switch label="Email alerts" checked={on} onCheckedChange={setOn} />
|
|
794
|
+
```
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
Also accepts all props of: `BaseSwitch.Root.Props`, `ChoiceLabelProps`.
|
|
798
|
+
|
|
799
|
+
## Textarea
|
|
800
|
+
|
|
801
|
+
component · Forms
|
|
802
|
+
|
|
803
|
+
Multi-line text input. Use `TextareaField` for a labelled one.
|
|
804
|
+
|
|
805
|
+
```tsx
|
|
806
|
+
import { Textarea } from '@optimum-intelligence/opti-ui';
|
|
807
|
+
```
|
|
808
|
+
|
|
809
|
+
| Prop | Type | Default | Description |
|
|
810
|
+
| --- | --- | --- | --- |
|
|
811
|
+
| `ref?` | `React.Ref<HTMLTextAreaElement>` | | Ref to the `<textarea>`. |
|
|
812
|
+
| `autoResize?` | `boolean` | | Grow with content up to `maxRows` (uses CSS field-sizing where supported). |
|
|
813
|
+
|
|
814
|
+
Also accepts all props of: `React.TextareaHTMLAttributes<HTMLTextAreaElement>`.
|
|
815
|
+
|
|
816
|
+
## TextareaField
|
|
817
|
+
|
|
818
|
+
component · Forms
|
|
819
|
+
|
|
820
|
+
Labelled textarea with description and error message.
|
|
821
|
+
|
|
822
|
+
```tsx
|
|
823
|
+
import { TextareaField } from '@optimum-intelligence/opti-ui';
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
| Prop | Type | Default | Description |
|
|
827
|
+
| --- | --- | --- | --- |
|
|
828
|
+
| `ref?` | `React.Ref<HTMLTextAreaElement>` | | Ref to the `<textarea>`. |
|
|
829
|
+
| `autoResize?` | `boolean` | | Grow with content up to `maxRows` (uses CSS field-sizing where supported). |
|
|
830
|
+
|
|
831
|
+
Also accepts all props of: `React.TextareaHTMLAttributes<HTMLTextAreaElement>`, `FieldShellProps`.
|
|
832
|
+
|
|
833
|
+
## TextField
|
|
834
|
+
|
|
835
|
+
component · Forms
|
|
836
|
+
|
|
837
|
+
Labelled input with description and error message.
|
|
838
|
+
|
|
839
|
+
```tsx
|
|
840
|
+
import { TextField } from '@optimum-intelligence/opti-ui';
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
| Prop | Type | Default | Description |
|
|
844
|
+
| --- | --- | --- | --- |
|
|
845
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
846
|
+
| `startAdornment?` | `React.ReactNode` | | Icon or text rendered inside the box, before the value. |
|
|
847
|
+
| `endAdornment?` | `React.ReactNode` | | Icon, text or button rendered inside the box, after the value. |
|
|
848
|
+
|
|
849
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`, `FieldShellProps`.
|
|
850
|
+
|
|
851
|
+
## useDateConfig
|
|
852
|
+
|
|
853
|
+
hook · Forms
|
|
854
|
+
|
|
855
|
+
The date settings from the nearest `DateConfigProvider`. Spread it into
|
|
856
|
+
`formatDate` options to format dates the same way the pickers do.
|
|
857
|
+
|
|
858
|
+
```tsx
|
|
859
|
+
import { useDateConfig } from '@optimum-intelligence/opti-ui';
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
Signature: `useDateConfig()`
|
|
863
|
+
|
|
864
|
+
```tsx
|
|
865
|
+
const config = useDateConfig();
|
|
866
|
+
return <span>{formatDate(order.createdAt, { ...config, granularity: 'minute' })}</span>;
|
|
867
|
+
```
|
|
868
|
+
|
|
869
|
+
# Layout
|
|
870
|
+
|
|
871
|
+
## AppShell
|
|
872
|
+
|
|
873
|
+
component · Layout
|
|
874
|
+
|
|
875
|
+
Full-height layout with a fixed navbar and an internally scrolling main
|
|
876
|
+
area. Below 900px the navbar moves into a slide-in drawer, and `NavbarItem`s marked `pinned` show in a
|
|
877
|
+
tab bar (see `mobileNavPosition`).
|
|
878
|
+
Customize width with `--oui-navbar-width` and `--oui-navbar-collapsed-width`.
|
|
879
|
+
|
|
880
|
+
```tsx
|
|
881
|
+
import { AppShell } from '@optimum-intelligence/opti-ui';
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
```tsx
|
|
885
|
+
<AppShell
|
|
886
|
+
mobileBrand="OptiControl"
|
|
887
|
+
navbar={
|
|
888
|
+
<Navbar>
|
|
889
|
+
<NavbarSection>
|
|
890
|
+
<NavbarItem href="/" icon={<Home />} active pinned>Overview</NavbarItem>
|
|
891
|
+
<NavbarItem href="/fleet" icon={<Truck />} pinned>Fleet</NavbarItem>
|
|
892
|
+
</NavbarSection>
|
|
893
|
+
</Navbar>
|
|
894
|
+
}
|
|
895
|
+
>
|
|
896
|
+
<PageHeader title="Overview" />
|
|
897
|
+
</AppShell>
|
|
898
|
+
```
|
|
899
|
+
|
|
900
|
+
| Prop | Type | Default | Description |
|
|
901
|
+
| --- | --- | --- | --- |
|
|
902
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the shell's root element. |
|
|
903
|
+
| `navbar` | `React.ReactNode` | | Navbar content (usually a `<Navbar>`). Rendered in a drawer on small screens. |
|
|
904
|
+
| `mobileBrand?` | `React.ReactNode` | | Brand shown in the mobile top bar. |
|
|
905
|
+
| `mobileActions?` | `React.ReactNode` | | Extra content on the right of the mobile top bar. |
|
|
906
|
+
| `mobileNavPosition?` | `'bottom' \| 'top'` | `'bottom'` | Where small screens show the tab bar of pinned `NavbarItem`s: below or above the main area. Both look the same; the "More" slot (see `moreTabPosition`) opens the navbar drawer. The top bar with `mobileBrand` and `mobileActions` only appears when one of them is set. Without pinned items, a top bar with a menu button is shown instead. |
|
|
907
|
+
| `menuLabel?` | `string` | `'Open navigation'` | Accessible name of the button that opens the navigation drawer on small screens. |
|
|
908
|
+
| `moreLabel?` | `string` | `'More'` | Label of the tab-bar slot that opens the navigation drawer. |
|
|
909
|
+
| `moreTabPosition?` | `'start' \| 'end'` | `'start'` | Whether the "More" slot comes before or after the pinned items in the tab bar. |
|
|
910
|
+
| `mainProps?` | `React.HTMLAttributes<HTMLElement>` | | Props for the scrolling `<main>` element. |
|
|
911
|
+
|
|
912
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
913
|
+
|
|
914
|
+
## Card
|
|
915
|
+
|
|
916
|
+
component · Layout
|
|
917
|
+
|
|
918
|
+
Surface that groups related content. Compose with `CardHeader` (`CardTitle`, `CardDescription`,
|
|
919
|
+
`CardActions`), `CardContent` and `CardFooter`.
|
|
920
|
+
|
|
921
|
+
```tsx
|
|
922
|
+
import { Card } from '@optimum-intelligence/opti-ui';
|
|
923
|
+
```
|
|
924
|
+
|
|
925
|
+
```tsx
|
|
926
|
+
<Card variant="elevated">
|
|
927
|
+
<CardHeader>
|
|
928
|
+
<CardTitle>Monthly energy</CardTitle>
|
|
929
|
+
<CardDescription>Last 30 days</CardDescription>
|
|
930
|
+
</CardHeader>
|
|
931
|
+
<CardContent>…</CardContent>
|
|
932
|
+
</Card>
|
|
933
|
+
```
|
|
934
|
+
|
|
935
|
+
| Prop | Type | Default | Description |
|
|
936
|
+
| --- | --- | --- | --- |
|
|
937
|
+
| `variant?` | `'outlined' \| 'elevated' \| 'filled' \| 'ghost'` | `'outlined'` | `outlined` (default) uses the card border, `elevated` a soft shadow. |
|
|
938
|
+
| `padding?` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'md'` | Inner spacing. Override with `--oui-card-padding`. |
|
|
939
|
+
| `interactive?` | `boolean` | `false` | Adds hover and focus states — use with `render={<a href=… />}` or a click handler. |
|
|
940
|
+
|
|
941
|
+
Also accepts all props of: `useRender.ComponentProps<'div', CardState>`.
|
|
942
|
+
|
|
943
|
+
## CardActions
|
|
944
|
+
|
|
945
|
+
compound · Layout
|
|
946
|
+
|
|
947
|
+
Right-aligned slot inside CardHeader for icon buttons or menus.
|
|
948
|
+
|
|
949
|
+
```tsx
|
|
950
|
+
import { CardActions } from '@optimum-intelligence/opti-ui';
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
### CardActions.displayName
|
|
954
|
+
|
|
955
|
+
## CardContent
|
|
956
|
+
|
|
957
|
+
compound · Layout
|
|
958
|
+
|
|
959
|
+
Styled `<div>` (`.oui-card__content`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
960
|
+
|
|
961
|
+
```tsx
|
|
962
|
+
import { CardContent } from '@optimum-intelligence/opti-ui';
|
|
963
|
+
```
|
|
964
|
+
|
|
965
|
+
### CardContent.displayName
|
|
966
|
+
|
|
967
|
+
## CardDescription
|
|
968
|
+
|
|
969
|
+
compound · Layout
|
|
970
|
+
|
|
971
|
+
Styled `<p>` (`.oui-card__description`). Accepts `className`, `style`, the `render` prop and all `<p>` attributes.
|
|
972
|
+
|
|
973
|
+
```tsx
|
|
974
|
+
import { CardDescription } from '@optimum-intelligence/opti-ui';
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
### CardDescription.displayName
|
|
978
|
+
|
|
979
|
+
## CardFooter
|
|
980
|
+
|
|
981
|
+
compound · Layout
|
|
982
|
+
|
|
983
|
+
Styled `<div>` (`.oui-card__footer`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
984
|
+
|
|
985
|
+
```tsx
|
|
986
|
+
import { CardFooter } from '@optimum-intelligence/opti-ui';
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
### CardFooter.displayName
|
|
990
|
+
|
|
991
|
+
## CardHeader
|
|
992
|
+
|
|
993
|
+
compound · Layout
|
|
994
|
+
|
|
995
|
+
Styled `<div>` (`.oui-card__header`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
996
|
+
|
|
997
|
+
```tsx
|
|
998
|
+
import { CardHeader } from '@optimum-intelligence/opti-ui';
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
### CardHeader.displayName
|
|
1002
|
+
|
|
1003
|
+
## CardTitle
|
|
1004
|
+
|
|
1005
|
+
compound · Layout
|
|
1006
|
+
|
|
1007
|
+
Styled `<h3>` (`.oui-card__title`). Accepts `className`, `style`, the `render` prop and all `<h3>` attributes.
|
|
1008
|
+
|
|
1009
|
+
```tsx
|
|
1010
|
+
import { CardTitle } from '@optimum-intelligence/opti-ui';
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
### CardTitle.displayName
|
|
1014
|
+
|
|
1015
|
+
## Grid
|
|
1016
|
+
|
|
1017
|
+
component · Layout
|
|
1018
|
+
|
|
1019
|
+
Responsive dashboard grid.
|
|
1020
|
+
|
|
1021
|
+
```tsx
|
|
1022
|
+
import { Grid } from '@optimum-intelligence/opti-ui';
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
| Prop | Type | Default | Description |
|
|
1026
|
+
| --- | --- | --- | --- |
|
|
1027
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the grid element. |
|
|
1028
|
+
| `columns?` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | `3` | Columns on wide screens; collapses to 2 below 1200px (for 4+) and 1 below 900px. |
|
|
1029
|
+
| `gap?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Space between grid cells. |
|
|
1030
|
+
|
|
1031
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
1032
|
+
|
|
1033
|
+
## Navbar
|
|
1034
|
+
|
|
1035
|
+
component · Layout
|
|
1036
|
+
|
|
1037
|
+
Collapsible side navigation. Use inside `AppShell`. Compose with `NavbarHeader` (`NavbarBrand`),
|
|
1038
|
+
`NavbarSection` (`NavbarSectionLabel`, `NavbarItem`) and `NavbarFooter`.
|
|
1039
|
+
|
|
1040
|
+
```tsx
|
|
1041
|
+
import { Navbar } from '@optimum-intelligence/opti-ui';
|
|
1042
|
+
```
|
|
1043
|
+
|
|
1044
|
+
| Prop | Type | Default | Description |
|
|
1045
|
+
| --- | --- | --- | --- |
|
|
1046
|
+
| `variant?` | `'inverse' \| 'surface'` | `'inverse'` | `inverse` (brand-colored, default) or `surface` (light panel). |
|
|
1047
|
+
| `collapsible?` | `boolean` | `true` | Shows a toggle in the top right that shrinks the navbar to an icon rail. Defaults to `true`. |
|
|
1048
|
+
| `collapsed?` | `boolean` | | Controlled collapsed state. |
|
|
1049
|
+
| `defaultCollapsed?` | `boolean` | `false` | Initial collapsed state when uncontrolled. |
|
|
1050
|
+
| `onCollapsedChange?` | `(collapsed: boolean) => void` | | Called when the user collapses or expands the navbar. |
|
|
1051
|
+
| `expandOnHover?` | `boolean` | `true` | Temporarily opens a collapsed navbar while the mouse is over it. Defaults to `true`. |
|
|
1052
|
+
| `collapseLabel?` | `string` | `'Collapse'` | Accessible names for the icon-only toggle. |
|
|
1053
|
+
| `expandLabel?` | `string` | `'Expand'` | Accessible name of the toggle while collapsed. |
|
|
1054
|
+
|
|
1055
|
+
Also accepts all props of: `useRender.ComponentProps<'nav', NavbarState>`.
|
|
1056
|
+
|
|
1057
|
+
## NavbarBrand
|
|
1058
|
+
|
|
1059
|
+
component · Layout
|
|
1060
|
+
|
|
1061
|
+
Logo, title and subtitle block for the top of a `Navbar`.
|
|
1062
|
+
|
|
1063
|
+
```tsx
|
|
1064
|
+
import { NavbarBrand } from '@optimum-intelligence/opti-ui';
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
| Prop | Type | Default | Description |
|
|
1068
|
+
| --- | --- | --- | --- |
|
|
1069
|
+
| `logo?` | `React.ReactNode` | | Logo or icon shown before the title; stays visible when the navbar is collapsed. |
|
|
1070
|
+
| `title` | `React.ReactNode` | | Product or organization name. |
|
|
1071
|
+
| `subtitle?` | `React.ReactNode` | | Smaller line under the title. |
|
|
1072
|
+
|
|
1073
|
+
Also accepts all props of: `Omit<useRender.ComponentProps<'div'>, 'title'>`.
|
|
1074
|
+
|
|
1075
|
+
## NavbarFooter
|
|
1076
|
+
|
|
1077
|
+
compound · Layout
|
|
1078
|
+
|
|
1079
|
+
Styled `<div>` (`.oui-navbar__footer`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1080
|
+
|
|
1081
|
+
```tsx
|
|
1082
|
+
import { NavbarFooter } from '@optimum-intelligence/opti-ui';
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
### NavbarFooter.displayName
|
|
1086
|
+
|
|
1087
|
+
## NavbarGroup
|
|
1088
|
+
|
|
1089
|
+
component · Layout
|
|
1090
|
+
|
|
1091
|
+
Expandable parent row in a `Navbar` with nested `NavbarItem` sub-links. Place it in a `NavbarSection`
|
|
1092
|
+
next to other items. On a collapsed rail the sub-links are hidden and the parent shows as active when
|
|
1093
|
+
one of them is; the hover peek shows the full tree.
|
|
1094
|
+
|
|
1095
|
+
```tsx
|
|
1096
|
+
import { NavbarGroup } from '@optimum-intelligence/opti-ui';
|
|
1097
|
+
```
|
|
1098
|
+
|
|
1099
|
+
```tsx
|
|
1100
|
+
<NavbarSection>
|
|
1101
|
+
<NavbarGroup icon={<Truck />} label="Fleet">
|
|
1102
|
+
<NavbarItem href="/fleet/vehicles" active>Vehicles</NavbarItem>
|
|
1103
|
+
<NavbarItem href="/fleet/drivers">Drivers</NavbarItem>
|
|
1104
|
+
</NavbarGroup>
|
|
1105
|
+
</NavbarSection>
|
|
1106
|
+
```
|
|
1107
|
+
|
|
1108
|
+
| Prop | Type | Default | Description |
|
|
1109
|
+
| --- | --- | --- | --- |
|
|
1110
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the group's root element. |
|
|
1111
|
+
| `label` | `React.ReactNode` | | Text of the parent row. A string also becomes its tooltip on the collapsed rail. |
|
|
1112
|
+
| `icon?` | `React.ReactNode` | | Icon of the parent row; it stays visible when the navbar is collapsed to a rail. |
|
|
1113
|
+
| `badge?` | `React.ReactNode` | | Trailing content of the parent row, such as a count badge. |
|
|
1114
|
+
| `open?` | `boolean` | | Controlled open state. Takes over from the automatic opening on an active child. |
|
|
1115
|
+
| `defaultOpen?` | `boolean` | `true when a child item is active` | Initial open state when uncontrolled. Whenever a child item becomes `active`, the group opens. |
|
|
1116
|
+
| `onOpenChange?` | `(open: boolean) => void` | | Called when the user opens or closes the group. |
|
|
1117
|
+
| `children?` | `React.ReactNode` | | Sub-links: `NavbarItem` elements (directly or in fragments), shown indented and without icons. |
|
|
1118
|
+
|
|
1119
|
+
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>`.
|
|
1120
|
+
|
|
1121
|
+
## NavbarHeader
|
|
1122
|
+
|
|
1123
|
+
compound · Layout
|
|
1124
|
+
|
|
1125
|
+
Styled `<div>` (`.oui-navbar__header`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1126
|
+
|
|
1127
|
+
```tsx
|
|
1128
|
+
import { NavbarHeader } from '@optimum-intelligence/opti-ui';
|
|
1129
|
+
```
|
|
1130
|
+
|
|
1131
|
+
### NavbarHeader.displayName
|
|
1132
|
+
|
|
1133
|
+
## NavbarItem
|
|
1134
|
+
|
|
1135
|
+
component · Layout
|
|
1136
|
+
|
|
1137
|
+
Navigation link. Renders an `<a>`; use `render={<Link to="…" />}` for a
|
|
1138
|
+
router link or `render={<button />}` for an action. Inside a `NavbarGroup` it becomes an indented sub-link.
|
|
1139
|
+
|
|
1140
|
+
```tsx
|
|
1141
|
+
import { NavbarItem } from '@optimum-intelligence/opti-ui';
|
|
1142
|
+
```
|
|
1143
|
+
|
|
1144
|
+
| Prop | Type | Default | Description |
|
|
1145
|
+
| --- | --- | --- | --- |
|
|
1146
|
+
| `icon?` | `React.ReactNode` | | Icon shown before the label; it stays visible when the navbar is collapsed to a rail. Not shown inside a `NavbarGroup`. |
|
|
1147
|
+
| `active?` | `boolean` | `false` | Marks the current page (sets aria-current). Also opens the surrounding `NavbarGroup`. |
|
|
1148
|
+
| `badge?` | `React.ReactNode` | | Trailing content such as a count badge. |
|
|
1149
|
+
| `pinned?` | `boolean` | `false` | Also shows the item in the `AppShell` mobile tab bar (icon and label). Pin up to four items; the first four in navbar order are used. Has no effect outside an `AppShell`. |
|
|
1150
|
+
|
|
1151
|
+
Also accepts all props of: `useRender.ComponentProps<'a', NavbarItemState>`.
|
|
1152
|
+
|
|
1153
|
+
## NavbarSection
|
|
1154
|
+
|
|
1155
|
+
compound · Layout
|
|
1156
|
+
|
|
1157
|
+
Styled `<div>` (`.oui-navbar__section`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1158
|
+
|
|
1159
|
+
```tsx
|
|
1160
|
+
import { NavbarSection } from '@optimum-intelligence/opti-ui';
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1163
|
+
### NavbarSection.displayName
|
|
1164
|
+
|
|
1165
|
+
## NavbarSectionLabel
|
|
1166
|
+
|
|
1167
|
+
compound · Layout
|
|
1168
|
+
|
|
1169
|
+
Styled `<div>` (`.oui-navbar__section-label`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1170
|
+
|
|
1171
|
+
```tsx
|
|
1172
|
+
import { NavbarSectionLabel } from '@optimum-intelligence/opti-ui';
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
### NavbarSectionLabel.displayName
|
|
1176
|
+
|
|
1177
|
+
## PageHeader
|
|
1178
|
+
|
|
1179
|
+
component · Layout
|
|
1180
|
+
|
|
1181
|
+
Page title block with optional breadcrumbs, eyebrow, description and actions.
|
|
1182
|
+
|
|
1183
|
+
```tsx
|
|
1184
|
+
import { PageHeader } from '@optimum-intelligence/opti-ui';
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
| Prop | Type | Default | Description |
|
|
1188
|
+
| --- | --- | --- | --- |
|
|
1189
|
+
| `ref?` | `React.Ref<HTMLElement>` | | Ref to the `<header>` element. |
|
|
1190
|
+
| `breadcrumbs?` | `React.ReactNode` | | Trail shown above the title, usually `<Breadcrumbs>`. |
|
|
1191
|
+
| `eyebrow?` | `React.ReactNode` | | Small label above the title. |
|
|
1192
|
+
| `title` | `React.ReactNode` | | Page title, rendered as the page `<h1>`. |
|
|
1193
|
+
| `description?` | `React.ReactNode` | | Supporting text under the title. |
|
|
1194
|
+
| `actions?` | `React.ReactNode` | | Buttons or controls aligned to the right of the title. |
|
|
1195
|
+
|
|
1196
|
+
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLElement>, 'title'>`.
|
|
1197
|
+
|
|
1198
|
+
## ScrollArea
|
|
1199
|
+
|
|
1200
|
+
component · Layout
|
|
1201
|
+
|
|
1202
|
+
Scroll container with slim, themed overlay scrollbars. Set a height or max-height.
|
|
1203
|
+
|
|
1204
|
+
```tsx
|
|
1205
|
+
import { ScrollArea } from '@optimum-intelligence/opti-ui';
|
|
1206
|
+
```
|
|
1207
|
+
|
|
1208
|
+
| Prop | Type | Default | Description |
|
|
1209
|
+
| --- | --- | --- | --- |
|
|
1210
|
+
| `scrollbars?` | `'vertical' \| 'horizontal' \| 'both'` | `'vertical'` | Which scrollbars to render. |
|
|
1211
|
+
| `viewportProps?` | `BaseScrollArea.Viewport.Props` | | Props for the inner scrolling viewport, e.g. a `ref` to read the scroll position. |
|
|
1212
|
+
|
|
1213
|
+
Also accepts all props of: `BaseScrollArea.Root.Props`.
|
|
1214
|
+
|
|
1215
|
+
## Separator
|
|
1216
|
+
|
|
1217
|
+
component · Layout
|
|
1218
|
+
|
|
1219
|
+
Thin divider line. Set `orientation="vertical"` for a vertical rule.
|
|
1220
|
+
|
|
1221
|
+
```tsx
|
|
1222
|
+
import { Separator } from '@optimum-intelligence/opti-ui';
|
|
1223
|
+
```
|
|
1224
|
+
|
|
1225
|
+
|
|
1226
|
+
Also accepts all props of: `BaseSeparator.Props`.
|
|
1227
|
+
|
|
1228
|
+
## Stack
|
|
1229
|
+
|
|
1230
|
+
component · Layout
|
|
1231
|
+
|
|
1232
|
+
Flex container that spaces its children evenly, in a column or a row.
|
|
1233
|
+
|
|
1234
|
+
```tsx
|
|
1235
|
+
import { Stack } from '@optimum-intelligence/opti-ui';
|
|
1236
|
+
```
|
|
1237
|
+
|
|
1238
|
+
| Prop | Type | Default | Description |
|
|
1239
|
+
| --- | --- | --- | --- |
|
|
1240
|
+
| `direction?` | `'column' \| 'row'` | `'column'` | `column` (default) stacks children, `row` puts them on a line. |
|
|
1241
|
+
| `gap?` | `'none' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Space between children. Override with `--oui-stack-gap`. |
|
|
1242
|
+
| `align?` | `'start' \| 'center' \| 'end' \| 'stretch' \| 'baseline'` | | Cross-axis alignment. Defaults to `stretch` in a column and `center` in a row. |
|
|
1243
|
+
| `justify?` | `'start' \| 'center' \| 'end' \| 'between'` | | Main-axis distribution. |
|
|
1244
|
+
| `wrap?` | `boolean` | `false` | Let a row's children wrap onto more lines. |
|
|
1245
|
+
|
|
1246
|
+
Also accepts all props of: `useRender.ComponentProps<'div', StackState>`.
|
|
1247
|
+
|
|
1248
|
+
## StatCard
|
|
1249
|
+
|
|
1250
|
+
component · Layout
|
|
1251
|
+
|
|
1252
|
+
KPI tile: label, large value, optional unit and trend.
|
|
1253
|
+
|
|
1254
|
+
```tsx
|
|
1255
|
+
import { StatCard } from '@optimum-intelligence/opti-ui';
|
|
1256
|
+
```
|
|
1257
|
+
|
|
1258
|
+
| Prop | Type | Default | Description |
|
|
1259
|
+
| --- | --- | --- | --- |
|
|
1260
|
+
| `variant?` | `'outlined' \| 'elevated' \| 'filled' \| 'ghost'` | | `outlined` (default) uses the card border, `elevated` a soft shadow. |
|
|
1261
|
+
| `padding?` | `'none' \| 'sm' \| 'md' \| 'lg'` | | Inner spacing. Override with `--oui-card-padding`. |
|
|
1262
|
+
| `interactive?` | `boolean` | | Adds hover and focus states — use with `render={<a href=… />}` or a click handler. |
|
|
1263
|
+
| `label` | `React.ReactNode` | | What the number measures. |
|
|
1264
|
+
| `value` | `React.ReactNode` | | The headline figure. |
|
|
1265
|
+
| `unit?` | `React.ReactNode` | | Unit beside the value, e.g. "kWh" or "orders". |
|
|
1266
|
+
| `delta?` | `React.ReactNode` | | Change indicator, e.g. "+12.4%". |
|
|
1267
|
+
| `trend?` | `'up' \| 'down' \| 'flat'` | | Arrow direction shown next to `delta`. |
|
|
1268
|
+
| `tone?` | `'positive' \| 'negative' \| 'neutral'` | | Color of the delta. Defaults to positive for `up`, negative for `down`. |
|
|
1269
|
+
| `hint?` | `React.ReactNode` | | Supporting text under the value. |
|
|
1270
|
+
| `icon?` | `React.ReactNode` | | Icon tile shown in the top-right corner. |
|
|
1271
|
+
| `loading?` | `boolean` | | Replaces the value with a skeleton while data loads. |
|
|
1272
|
+
|
|
1273
|
+
Also accepts all props of: `useRender.ComponentProps<'div', CardState>`.
|
|
1274
|
+
|
|
1275
|
+
# Typography
|
|
1276
|
+
|
|
1277
|
+
## Eyebrow
|
|
1278
|
+
|
|
1279
|
+
component · Typography
|
|
1280
|
+
|
|
1281
|
+
Small uppercase label used above titles, in filter bars and table headers.
|
|
1282
|
+
|
|
1283
|
+
```tsx
|
|
1284
|
+
import { Eyebrow } from '@optimum-intelligence/opti-ui';
|
|
1285
|
+
```
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
Also accepts all props of: `useRender.ComponentProps<'span'>`.
|
|
1289
|
+
|
|
1290
|
+
## Heading
|
|
1291
|
+
|
|
1292
|
+
component · Typography
|
|
1293
|
+
|
|
1294
|
+
Heading element. `level` sets the tag (`h1`–`h6`) and the default size; `size` overrides only the look.
|
|
1295
|
+
|
|
1296
|
+
```tsx
|
|
1297
|
+
import { Heading } from '@optimum-intelligence/opti-ui';
|
|
1298
|
+
```
|
|
1299
|
+
|
|
1300
|
+
| Prop | Type | Default | Description |
|
|
1301
|
+
| --- | --- | --- | --- |
|
|
1302
|
+
| `level?` | `HeadingLevel` | `2` | Semantic level; picks the element. |
|
|
1303
|
+
| `size?` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl'` | | Visual size, independent of the level. |
|
|
1304
|
+
|
|
1305
|
+
Also accepts all props of: `useRender.ComponentProps<'h2', HeadingState>`.
|
|
1306
|
+
|
|
1307
|
+
## Link
|
|
1308
|
+
|
|
1309
|
+
component · Typography
|
|
1310
|
+
|
|
1311
|
+
Text link. Pass a router link through `render`: `<Link render={<NavLink to="/fleet" />}>`.
|
|
1312
|
+
|
|
1313
|
+
```tsx
|
|
1314
|
+
import { Link } from '@optimum-intelligence/opti-ui';
|
|
1315
|
+
```
|
|
1316
|
+
|
|
1317
|
+
| Prop | Type | Default | Description |
|
|
1318
|
+
| --- | --- | --- | --- |
|
|
1319
|
+
| `tone?` | `'accent' \| 'muted' \| 'inherit'` | `'accent'` | `inherit` takes the color of the surrounding text. |
|
|
1320
|
+
| `underline?` | `'always' \| 'hover' \| 'none'` | `'always'` | When the underline shows. |
|
|
1321
|
+
| `external?` | `boolean` | `false` | Opens in a new tab, with a trailing icon. |
|
|
1322
|
+
|
|
1323
|
+
Also accepts all props of: `useRender.ComponentProps<'a', LinkState>`.
|
|
1324
|
+
|
|
1325
|
+
## Text
|
|
1326
|
+
|
|
1327
|
+
component · Typography
|
|
1328
|
+
|
|
1329
|
+
Body text paragraph. Use `render={<span />}` for inline text.
|
|
1330
|
+
|
|
1331
|
+
```tsx
|
|
1332
|
+
import { Text } from '@optimum-intelligence/opti-ui';
|
|
1333
|
+
```
|
|
1334
|
+
|
|
1335
|
+
| Prop | Type | Default | Description |
|
|
1336
|
+
| --- | --- | --- | --- |
|
|
1337
|
+
| `size?` | `'xs' \| 'sm' \| 'md' \| 'lg'` | `'md'` | Font size. |
|
|
1338
|
+
| `tone?` | `'default' \| 'strong' \| 'muted' \| 'subtle' \| 'accent' \| 'success' \| 'warning' \| 'danger'` | `'default'` | Color role: from `strong` to `subtle`, or a status color. |
|
|
1339
|
+
| `weight?` | `'regular' \| 'medium' \| 'semibold' \| 'bold'` | | Font weight. Inherits when omitted. |
|
|
1340
|
+
|
|
1341
|
+
Also accepts all props of: `useRender.ComponentProps<'p', TextState>`.
|
|
1342
|
+
|
|
1343
|
+
# Actions
|
|
1344
|
+
|
|
1345
|
+
## Button
|
|
1346
|
+
|
|
1347
|
+
component · Actions
|
|
1348
|
+
|
|
1349
|
+
Action button. Use `render={<a href="…" />}` with `nativeButton={false}` to style a link as a button.
|
|
1350
|
+
|
|
1351
|
+
```tsx
|
|
1352
|
+
import { Button } from '@optimum-intelligence/opti-ui';
|
|
1353
|
+
```
|
|
1354
|
+
|
|
1355
|
+
```tsx
|
|
1356
|
+
<Button variant="secondary" loading={saving} onClick={save}>Save</Button>
|
|
1357
|
+
```
|
|
1358
|
+
|
|
1359
|
+
| Prop | Type | Default | Description |
|
|
1360
|
+
| --- | --- | --- | --- |
|
|
1361
|
+
| `variant?` | `'primary' \| 'accent' \| 'secondary' \| 'soft' \| 'ghost' \| 'danger'` | `'primary'` | Visual emphasis. |
|
|
1362
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Height and padding. |
|
|
1363
|
+
| `shape?` | `'pill' \| 'rounded'` | `'pill'` | `pill` (default) or `rounded` corners. Override with `--oui-button-radius`. |
|
|
1364
|
+
| `fullWidth?` | `boolean` | | Stretch to the container width. |
|
|
1365
|
+
| `loading?` | `boolean` | | Shows a spinner and blocks interaction while keeping focus. |
|
|
1366
|
+
|
|
1367
|
+
Also accepts all props of: `BaseButton.Props`.
|
|
1368
|
+
|
|
1369
|
+
## ContextMenu
|
|
1370
|
+
|
|
1371
|
+
compound · Actions
|
|
1372
|
+
|
|
1373
|
+
Menu opened by right click or long press on `ContextMenu.Trigger`, which wraps
|
|
1374
|
+
the target area. The item parts are the same as `Menu`'s.
|
|
1375
|
+
|
|
1376
|
+
```tsx
|
|
1377
|
+
import { ContextMenu } from '@optimum-intelligence/opti-ui';
|
|
1378
|
+
```
|
|
1379
|
+
|
|
1380
|
+
### ContextMenu.Root
|
|
1381
|
+
|
|
1382
|
+
Base UI `ContextMenu.Root` re-exported unchanged. See https://base-ui.com/react/components/context-menu.
|
|
1383
|
+
|
|
1384
|
+
### ContextMenu.Trigger
|
|
1385
|
+
|
|
1386
|
+
Base UI `ContextMenu.Trigger` re-exported unchanged. See https://base-ui.com/react/components/context-menu.
|
|
1387
|
+
|
|
1388
|
+
### ContextMenu.Content
|
|
1389
|
+
|
|
1390
|
+
| Prop | Type | Default | Description |
|
|
1391
|
+
| --- | --- | --- | --- |
|
|
1392
|
+
| `positionerProps?` | `BaseContextMenu.Positioner.Props` | | Props for the positioner element that places the popup. |
|
|
1393
|
+
|
|
1394
|
+
Also accepts all props of: `BaseContextMenu.Popup.Props`.
|
|
1395
|
+
|
|
1396
|
+
### ContextMenu.Item
|
|
1397
|
+
|
|
1398
|
+
### ContextMenu.LinkItem
|
|
1399
|
+
|
|
1400
|
+
### ContextMenu.CheckboxItem
|
|
1401
|
+
|
|
1402
|
+
### ContextMenu.RadioGroup
|
|
1403
|
+
|
|
1404
|
+
### ContextMenu.RadioItem
|
|
1405
|
+
|
|
1406
|
+
### ContextMenu.Group
|
|
1407
|
+
|
|
1408
|
+
### ContextMenu.GroupLabel
|
|
1409
|
+
|
|
1410
|
+
### ContextMenu.Separator
|
|
1411
|
+
|
|
1412
|
+
### ContextMenu.SubmenuRoot
|
|
1413
|
+
|
|
1414
|
+
### ContextMenu.SubmenuTrigger
|
|
1415
|
+
|
|
1416
|
+
## IconButton
|
|
1417
|
+
|
|
1418
|
+
component · Actions
|
|
1419
|
+
|
|
1420
|
+
Square button for a single icon. Defaults to the compact ghost style.
|
|
1421
|
+
|
|
1422
|
+
```tsx
|
|
1423
|
+
import { IconButton } from '@optimum-intelligence/opti-ui';
|
|
1424
|
+
```
|
|
1425
|
+
|
|
1426
|
+
| Prop | Type | Default | Description |
|
|
1427
|
+
| --- | --- | --- | --- |
|
|
1428
|
+
| `variant?` | `'primary' \| 'accent' \| 'secondary' \| 'soft' \| 'ghost' \| 'danger'` | `'ghost'` | Visual emphasis. |
|
|
1429
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Height and padding. |
|
|
1430
|
+
| `loading?` | `boolean` | | Shows a spinner and blocks interaction while keeping focus. |
|
|
1431
|
+
| `aria-label` | `string` | | Required: icon-only buttons need an accessible name. |
|
|
1432
|
+
| `shape?` | `'rounded' \| 'circle'` | `'rounded'` | `rounded` square (default) or `circle`. |
|
|
1433
|
+
|
|
1434
|
+
Also accepts all props of: `BaseButton.Props`.
|
|
1435
|
+
|
|
1436
|
+
## Menu
|
|
1437
|
+
|
|
1438
|
+
compound · Actions
|
|
1439
|
+
|
|
1440
|
+
Dropdown menu of actions. Compose `Menu.Root` › `Menu.Trigger` + `Menu.Content` › items.
|
|
1441
|
+
For nested menus use `Menu.SubmenuRoot` › `Menu.SubmenuTrigger` + `Menu.Content`.
|
|
1442
|
+
|
|
1443
|
+
```tsx
|
|
1444
|
+
import { Menu } from '@optimum-intelligence/opti-ui';
|
|
1445
|
+
```
|
|
1446
|
+
|
|
1447
|
+
### Menu.Root
|
|
1448
|
+
|
|
1449
|
+
Base UI `Menu.Root` re-exported unchanged. See https://base-ui.com/react/components/menu.
|
|
1450
|
+
|
|
1451
|
+
### Menu.Trigger
|
|
1452
|
+
|
|
1453
|
+
Base UI `Menu.Trigger` re-exported unchanged. See https://base-ui.com/react/components/menu.
|
|
1454
|
+
|
|
1455
|
+
### Menu.Content
|
|
1456
|
+
|
|
1457
|
+
| Prop | Type | Default | Description |
|
|
1458
|
+
| --- | --- | --- | --- |
|
|
1459
|
+
| `side?` | `BaseMenu.Positioner.Props['side']` | | Which side of the trigger the menu opens on. |
|
|
1460
|
+
| `align?` | `BaseMenu.Positioner.Props['align']` | `'start'` | Alignment along that side. |
|
|
1461
|
+
| `sideOffset?` | `BaseMenu.Positioner.Props['sideOffset']` | `6` | Distance from the trigger in px. |
|
|
1462
|
+
| `alignOffset?` | `BaseMenu.Positioner.Props['alignOffset']` | | Shift along the alignment axis in px. |
|
|
1463
|
+
| `positionerProps?` | `BaseMenu.Positioner.Props` | | Props for the positioner element that places the popup. |
|
|
1464
|
+
|
|
1465
|
+
Also accepts all props of: `BaseMenu.Popup.Props`.
|
|
1466
|
+
|
|
1467
|
+
### Menu.Item
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
Also accepts all props of: `BaseMenu.Item.Props`, `ItemExtras`.
|
|
1471
|
+
|
|
1472
|
+
### Menu.LinkItem
|
|
1473
|
+
|
|
1474
|
+
|
|
1475
|
+
Also accepts all props of: `BaseMenu.LinkItem.Props`, `Omit<ItemExtras, 'danger'>`.
|
|
1476
|
+
|
|
1477
|
+
### Menu.CheckboxItem
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
Also accepts all props of: `BaseMenu.CheckboxItem.Props`, `Omit<ItemExtras, 'icon' \| 'danger'>`.
|
|
1481
|
+
|
|
1482
|
+
### Menu.RadioGroup
|
|
1483
|
+
|
|
1484
|
+
Base UI `Menu.RadioGroup` re-exported unchanged. See https://base-ui.com/react/components/menu.
|
|
1485
|
+
|
|
1486
|
+
### Menu.RadioItem
|
|
1487
|
+
|
|
1488
|
+
|
|
1489
|
+
Also accepts all props of: `BaseMenu.RadioItem.Props`, `Omit<ItemExtras, 'icon' \| 'danger'>`.
|
|
1490
|
+
|
|
1491
|
+
### Menu.Group
|
|
1492
|
+
|
|
1493
|
+
Base UI `Menu.Group` re-exported unchanged. See https://base-ui.com/react/components/menu.
|
|
1494
|
+
|
|
1495
|
+
### Menu.GroupLabel
|
|
1496
|
+
|
|
1497
|
+
### Menu.Separator
|
|
1498
|
+
|
|
1499
|
+
### Menu.SubmenuRoot
|
|
1500
|
+
|
|
1501
|
+
Base UI `Menu.SubmenuRoot` re-exported unchanged. See https://base-ui.com/react/components/menu.
|
|
1502
|
+
|
|
1503
|
+
### Menu.SubmenuTrigger
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
Also accepts all props of: `BaseMenu.SubmenuTrigger.Props`, `Omit<ItemExtras, 'shortcut' \| 'danger'>`.
|
|
1507
|
+
|
|
1508
|
+
## SegmentedControl
|
|
1509
|
+
|
|
1510
|
+
component · Actions
|
|
1511
|
+
|
|
1512
|
+
Single-choice switcher (e.g. Day / Week / Month). Always keeps one value selected.
|
|
1513
|
+
|
|
1514
|
+
```tsx
|
|
1515
|
+
import { SegmentedControl } from '@optimum-intelligence/opti-ui';
|
|
1516
|
+
```
|
|
1517
|
+
|
|
1518
|
+
| Prop | Type | Default | Description |
|
|
1519
|
+
| --- | --- | --- | --- |
|
|
1520
|
+
| `size?` | `'sm' \| 'md'` | `'md'` | Segment height. |
|
|
1521
|
+
| `variant?` | `'segmented' \| 'outline'` | | `segmented` renders a pill track like a tab switcher; `outline` separate buttons. |
|
|
1522
|
+
| `fullWidth?` | `boolean` | | Stretch segments to fill the width. |
|
|
1523
|
+
| `options` | `SegmentedControlOption[]` | | Segments to show. |
|
|
1524
|
+
| `value?` | `string` | | Selected option `value` (controlled). |
|
|
1525
|
+
| `defaultValue?` | `string` | | Initially selected option `value` when uncontrolled. |
|
|
1526
|
+
| `onValueChange?` | `(value: string) => void` | | Called with the new `value` when the selection changes. |
|
|
1527
|
+
|
|
1528
|
+
Also accepts all props of: `BaseToggleGroup.Props`.
|
|
1529
|
+
|
|
1530
|
+
## Toggle
|
|
1531
|
+
|
|
1532
|
+
component · Actions
|
|
1533
|
+
|
|
1534
|
+
Two-state button (bold, pin, favourite…). Inside a ToggleGroup it acts as a segment.
|
|
1535
|
+
|
|
1536
|
+
```tsx
|
|
1537
|
+
import { Toggle } from '@optimum-intelligence/opti-ui';
|
|
1538
|
+
```
|
|
1539
|
+
|
|
1540
|
+
| Prop | Type | Default | Description |
|
|
1541
|
+
| --- | --- | --- | --- |
|
|
1542
|
+
| `size?` | `'sm' \| 'md'` | `'md'` | Button height. |
|
|
1543
|
+
|
|
1544
|
+
Also accepts all props of: `BaseToggle.Props`.
|
|
1545
|
+
|
|
1546
|
+
## ToggleGroup
|
|
1547
|
+
|
|
1548
|
+
component · Actions
|
|
1549
|
+
|
|
1550
|
+
Group of `Toggle` buttons that share selection state (single or multiple).
|
|
1551
|
+
|
|
1552
|
+
```tsx
|
|
1553
|
+
import { ToggleGroup } from '@optimum-intelligence/opti-ui';
|
|
1554
|
+
```
|
|
1555
|
+
|
|
1556
|
+
| Prop | Type | Default | Description |
|
|
1557
|
+
| --- | --- | --- | --- |
|
|
1558
|
+
| `size?` | `'sm' \| 'md'` | `'md'` | Segment height. |
|
|
1559
|
+
| `variant?` | `'segmented' \| 'outline'` | `'segmented'` | `segmented` renders a pill track like a tab switcher; `outline` separate buttons. |
|
|
1560
|
+
| `fullWidth?` | `boolean` | | Stretch segments to fill the width. |
|
|
1561
|
+
|
|
1562
|
+
Also accepts all props of: `BaseToggleGroup.Props`.
|
|
1563
|
+
|
|
1564
|
+
## Toolbar
|
|
1565
|
+
|
|
1566
|
+
compound · Actions
|
|
1567
|
+
|
|
1568
|
+
Row of controls that is a single tab stop; arrow keys move between them.
|
|
1569
|
+
Other controls join through `render`: `<Toolbar.Button render={<Toggle />} />`,
|
|
1570
|
+
`<Toolbar.Button render={<Menu.Trigger />} />`.
|
|
1571
|
+
|
|
1572
|
+
```tsx
|
|
1573
|
+
import { Toolbar } from '@optimum-intelligence/opti-ui';
|
|
1574
|
+
```
|
|
1575
|
+
|
|
1576
|
+
### Toolbar.Root
|
|
1577
|
+
|
|
1578
|
+
### Toolbar.Button
|
|
1579
|
+
|
|
1580
|
+
### Toolbar.Link
|
|
1581
|
+
|
|
1582
|
+
### Toolbar.Group
|
|
1583
|
+
|
|
1584
|
+
### Toolbar.Separator
|
|
1585
|
+
|
|
1586
|
+
### Toolbar.Input
|
|
1587
|
+
|
|
1588
|
+
# Overlays
|
|
1589
|
+
|
|
1590
|
+
## AlertDialog
|
|
1591
|
+
|
|
1592
|
+
compound · Overlays
|
|
1593
|
+
|
|
1594
|
+
Confirmation dialog that requires an explicit choice (no outside-click dismissal).
|
|
1595
|
+
|
|
1596
|
+
```tsx
|
|
1597
|
+
import { AlertDialog } from '@optimum-intelligence/opti-ui';
|
|
1598
|
+
```
|
|
1599
|
+
|
|
1600
|
+
### AlertDialog.Root
|
|
1601
|
+
|
|
1602
|
+
Base UI `AlertDialog.Root` re-exported unchanged. See https://base-ui.com/react/components/alert-dialog.
|
|
1603
|
+
|
|
1604
|
+
### AlertDialog.Trigger
|
|
1605
|
+
|
|
1606
|
+
Base UI `AlertDialog.Trigger` re-exported unchanged. See https://base-ui.com/react/components/alert-dialog.
|
|
1607
|
+
|
|
1608
|
+
### AlertDialog.Content
|
|
1609
|
+
|
|
1610
|
+
| Prop | Type | Default | Description |
|
|
1611
|
+
| --- | --- | --- | --- |
|
|
1612
|
+
| `size?` | `Exclude<DialogSize, 'full'>` | `'sm'` | Dialog width. |
|
|
1613
|
+
|
|
1614
|
+
Also accepts all props of: `BaseAlertDialog.Popup.Props`.
|
|
1615
|
+
|
|
1616
|
+
### AlertDialog.Header
|
|
1617
|
+
|
|
1618
|
+
Styled `<div>` (`.oui-dialog__header`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1619
|
+
|
|
1620
|
+
### AlertDialog.Title
|
|
1621
|
+
|
|
1622
|
+
### AlertDialog.Description
|
|
1623
|
+
|
|
1624
|
+
### AlertDialog.Body
|
|
1625
|
+
|
|
1626
|
+
Styled `<div>` (`.oui-dialog__body`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1627
|
+
|
|
1628
|
+
### AlertDialog.Footer
|
|
1629
|
+
|
|
1630
|
+
Styled `<div>` (`.oui-dialog__footer`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1631
|
+
|
|
1632
|
+
### AlertDialog.Close
|
|
1633
|
+
|
|
1634
|
+
Base UI `AlertDialog.Close` re-exported unchanged. See https://base-ui.com/react/components/alert-dialog.
|
|
1635
|
+
|
|
1636
|
+
## CommandPalette
|
|
1637
|
+
|
|
1638
|
+
component · Overlays
|
|
1639
|
+
|
|
1640
|
+
Searchable command menu in a dialog (Ctrl / ⌘ + K) for navigation and quick
|
|
1641
|
+
actions. Keyboard: arrows move, Enter chooses, Esc closes.
|
|
1642
|
+
|
|
1643
|
+
```tsx
|
|
1644
|
+
import { CommandPalette } from '@optimum-intelligence/opti-ui';
|
|
1645
|
+
```
|
|
1646
|
+
|
|
1647
|
+
| Prop | Type | Default | Description |
|
|
1648
|
+
| --- | --- | --- | --- |
|
|
1649
|
+
| `items` | `T[]` | | Commands to list. |
|
|
1650
|
+
| `onSelect?` | `(item: T) => void` | | Called for any chosen item, after the item's own `onSelect`. |
|
|
1651
|
+
| `open?` | `boolean` | | Whether the palette is open (controlled). |
|
|
1652
|
+
| `defaultOpen?` | `boolean` | `false` | Initial state when uncontrolled. |
|
|
1653
|
+
| `onOpenChange?` | `(open: boolean) => void` | | Called when the palette opens or closes. |
|
|
1654
|
+
| `search?` | `string` | | Search text (controlled). |
|
|
1655
|
+
| `defaultSearch?` | `string` | `''` | Initial search text when uncontrolled. |
|
|
1656
|
+
| `onSearchChange?` | `(search: string) => void` | | Called when the search text changes. |
|
|
1657
|
+
| `filter?` | `((item: T, search: string) => boolean) \| false` | | Custom match function, or `false` when `items` are already filtered (server-side search). By default every term must occur in the label, keywords or group. |
|
|
1658
|
+
| `maxResults?` | `number` | `50` | Cap on rendered results. |
|
|
1659
|
+
| `hotkey?` | `string \| false` | `'k'` | Key that toggles the palette together with Ctrl / ⌘. `false` disables the shortcut. |
|
|
1660
|
+
| `keepOpenOnSelect?` | `boolean` | | Keep the palette open after choosing an item. |
|
|
1661
|
+
| `title?` | `string` | `'Command palette'` | Accessible name of the dialog. |
|
|
1662
|
+
| `placeholder?` | `string` | `'Search…'` | Placeholder of the search input. |
|
|
1663
|
+
| `emptyText?` | `React.ReactNode` | `'No results found.'` | Shown when nothing matches. |
|
|
1664
|
+
| `loading?` | `boolean` | | Show a spinner in the search row while results load. |
|
|
1665
|
+
| `footer?` | `React.ReactNode` | | Content below the results (key hints, a retry button…). |
|
|
1666
|
+
| `className?` | `string` | | Class name for the palette popup. |
|
|
1667
|
+
|
|
1668
|
+
Also accepts all props of: `CommandItem = CommandItem>`.
|
|
1669
|
+
|
|
1670
|
+
## createToastManager
|
|
1671
|
+
|
|
1672
|
+
function · Overlays
|
|
1673
|
+
|
|
1674
|
+
Base UI `Toast.createToastManager` re-exported unchanged. See https://base-ui.com/react/components/toast.
|
|
1675
|
+
|
|
1676
|
+
```tsx
|
|
1677
|
+
import { createToastManager } from '@optimum-intelligence/opti-ui';
|
|
1678
|
+
```
|
|
1679
|
+
|
|
1680
|
+
## Dialog
|
|
1681
|
+
|
|
1682
|
+
compound · Overlays
|
|
1683
|
+
|
|
1684
|
+
Modal dialog and side sheet. Compose:
|
|
1685
|
+
`Dialog.Root` › `Dialog.Trigger` + `Dialog.Content` › `Dialog.Header` (`Title`, `Description`), `Dialog.Body`, `Dialog.Footer`.
|
|
1686
|
+
Use `render={<Button />}` on `Dialog.Trigger` / `Dialog.Close` to style them as buttons.
|
|
1687
|
+
|
|
1688
|
+
```tsx
|
|
1689
|
+
import { Dialog } from '@optimum-intelligence/opti-ui';
|
|
1690
|
+
```
|
|
1691
|
+
|
|
1692
|
+
### Dialog.Root
|
|
1693
|
+
|
|
1694
|
+
Base UI `Dialog.Root` re-exported unchanged. See https://base-ui.com/react/components/dialog.
|
|
1695
|
+
|
|
1696
|
+
### Dialog.Trigger
|
|
1697
|
+
|
|
1698
|
+
Base UI `Dialog.Trigger` re-exported unchanged. See https://base-ui.com/react/components/dialog.
|
|
1699
|
+
|
|
1700
|
+
### Dialog.Content
|
|
1701
|
+
|
|
1702
|
+
| Prop | Type | Default | Description |
|
|
1703
|
+
| --- | --- | --- | --- |
|
|
1704
|
+
| `size?` | `'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'` | `'md'` | Width of a centered dialog, or of a sheet. |
|
|
1705
|
+
| `placement?` | `'center' \| 'right' \| 'left' \| 'bottom'` | `'center'` | `center` modal, or a sheet docked to an edge. |
|
|
1706
|
+
| `showClose?` | `boolean` | `true` | Render the corner close button. |
|
|
1707
|
+
| `closeLabel?` | `string` | `'Close'` | Accessible name of the close button. |
|
|
1708
|
+
| `backdropProps?` | `BaseDialog.Backdrop.Props` | | Props for the backdrop behind the dialog. |
|
|
1709
|
+
|
|
1710
|
+
Also accepts all props of: `BaseDialog.Popup.Props`.
|
|
1711
|
+
|
|
1712
|
+
### Dialog.Header
|
|
1713
|
+
|
|
1714
|
+
Styled `<div>` (`.oui-dialog__header`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1715
|
+
|
|
1716
|
+
### Dialog.Title
|
|
1717
|
+
|
|
1718
|
+
### Dialog.Description
|
|
1719
|
+
|
|
1720
|
+
### Dialog.Body
|
|
1721
|
+
|
|
1722
|
+
Styled `<div>` (`.oui-dialog__body`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1723
|
+
|
|
1724
|
+
### Dialog.Footer
|
|
1725
|
+
|
|
1726
|
+
Styled `<div>` (`.oui-dialog__footer`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
1727
|
+
|
|
1728
|
+
### Dialog.Close
|
|
1729
|
+
|
|
1730
|
+
Base UI `Dialog.Close` re-exported unchanged. See https://base-ui.com/react/components/dialog.
|
|
1731
|
+
|
|
1732
|
+
### Dialog.createHandle
|
|
1733
|
+
|
|
1734
|
+
Base UI `Dialog.createHandle` re-exported unchanged. See https://base-ui.com/react/components/dialog.
|
|
1735
|
+
|
|
1736
|
+
## Drawer
|
|
1737
|
+
|
|
1738
|
+
component · Overlays
|
|
1739
|
+
|
|
1740
|
+
Side panel for inspecting or editing a record without leaving the page:
|
|
1741
|
+
pinned header, scrolling body, optional pinned footer. For a free-form
|
|
1742
|
+
sheet use `Dialog.Content` with `placement`.
|
|
1743
|
+
|
|
1744
|
+
```tsx
|
|
1745
|
+
import { Drawer } from '@optimum-intelligence/opti-ui';
|
|
1746
|
+
```
|
|
1747
|
+
|
|
1748
|
+
| Prop | Type | Default | Description |
|
|
1749
|
+
| --- | --- | --- | --- |
|
|
1750
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the drawer panel. |
|
|
1751
|
+
| `open?` | `boolean` | | Whether the drawer is open (controlled). |
|
|
1752
|
+
| `defaultOpen?` | `boolean` | `false` | Initial state when uncontrolled. |
|
|
1753
|
+
| `onOpenChange?` | `(open: boolean) => void` | | Called when the drawer opens or closes. |
|
|
1754
|
+
| `trigger?` | `React.ReactElement` | | Element that opens the drawer, e.g. `<Button>Details</Button>`. Omit when `open` is controlled. |
|
|
1755
|
+
| `title` | `React.ReactNode` | | Header title; also the drawer's accessible name. |
|
|
1756
|
+
| `eyebrow?` | `React.ReactNode` | | Small label above the title, e.g. the record type. |
|
|
1757
|
+
| `description?` | `React.ReactNode` | | Supporting text under the title. |
|
|
1758
|
+
| `actions?` | `React.ReactNode` | | Header content next to the close button (edit, delete, a menu…). |
|
|
1759
|
+
| `footer?` | `React.ReactNode` | | Pinned to the bottom, for form buttons. |
|
|
1760
|
+
| `side?` | `'right' \| 'left'` | `'right'` | Edge the drawer slides in from. |
|
|
1761
|
+
| `size?` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Width: sm 24rem, md 32rem (default), lg 48rem, xl 60rem. Override with `--oui-drawer-width`. |
|
|
1762
|
+
| `dismissible?` | `boolean` | `true` | Set to `false` to block Esc, outside clicks and the close button, e.g. while a form inside is saving. |
|
|
1763
|
+
| `modal?` | `boolean` | `true` | `false` leaves the page behind interactive and drops the backdrop. |
|
|
1764
|
+
| `closeLabel?` | `string` | `'Close'` | Accessible name of the close button. |
|
|
1765
|
+
| `className?` | `string` | | Class name for the drawer panel. |
|
|
1766
|
+
| `bodyProps?` | `React.HTMLAttributes<HTMLDivElement>` | | Props for the scrolling content area. |
|
|
1767
|
+
| `children?` | `React.ReactNode` | | Drawer body content. |
|
|
1768
|
+
|
|
1769
|
+
## Popover
|
|
1770
|
+
|
|
1771
|
+
compound · Overlays
|
|
1772
|
+
|
|
1773
|
+
Floating panel anchored to a trigger, for small forms, filters and details.
|
|
1774
|
+
|
|
1775
|
+
```tsx
|
|
1776
|
+
import { Popover } from '@optimum-intelligence/opti-ui';
|
|
1777
|
+
```
|
|
1778
|
+
|
|
1779
|
+
### Popover.Root
|
|
1780
|
+
|
|
1781
|
+
Base UI `Popover.Root` re-exported unchanged. See https://base-ui.com/react/components/popover.
|
|
1782
|
+
|
|
1783
|
+
### Popover.Trigger
|
|
1784
|
+
|
|
1785
|
+
Base UI `Popover.Trigger` re-exported unchanged. See https://base-ui.com/react/components/popover.
|
|
1786
|
+
|
|
1787
|
+
### Popover.Content
|
|
1788
|
+
|
|
1789
|
+
| Prop | Type | Default | Description |
|
|
1790
|
+
| --- | --- | --- | --- |
|
|
1791
|
+
| `side?` | `BasePopover.Positioner.Props['side']` | `'bottom'` | Which side of the trigger the popover opens on. |
|
|
1792
|
+
| `align?` | `BasePopover.Positioner.Props['align']` | `'center'` | Alignment along that side. |
|
|
1793
|
+
| `sideOffset?` | `BasePopover.Positioner.Props['sideOffset']` | `8` | Distance from the trigger in px. |
|
|
1794
|
+
| `arrow?` | `boolean` | | Show a small arrow pointing at the trigger. |
|
|
1795
|
+
| `positionerProps?` | `BasePopover.Positioner.Props` | | Props for the positioner element that places the popup. |
|
|
1796
|
+
|
|
1797
|
+
Also accepts all props of: `BasePopover.Popup.Props`.
|
|
1798
|
+
|
|
1799
|
+
### Popover.Title
|
|
1800
|
+
|
|
1801
|
+
### Popover.Description
|
|
1802
|
+
|
|
1803
|
+
### Popover.Close
|
|
1804
|
+
|
|
1805
|
+
Base UI `Popover.Close` re-exported unchanged. See https://base-ui.com/react/components/popover.
|
|
1806
|
+
|
|
1807
|
+
## PreviewCard
|
|
1808
|
+
|
|
1809
|
+
compound · Overlays
|
|
1810
|
+
|
|
1811
|
+
Card that appears when a link is hovered or focused, previewing what is behind it.
|
|
1812
|
+
`PreviewCard.Trigger` is the link itself. Keep the content supplementary: touch users never see it.
|
|
1813
|
+
|
|
1814
|
+
```tsx
|
|
1815
|
+
import { PreviewCard } from '@optimum-intelligence/opti-ui';
|
|
1816
|
+
```
|
|
1817
|
+
|
|
1818
|
+
### PreviewCard.Root
|
|
1819
|
+
|
|
1820
|
+
Base UI `PreviewCard.Root` re-exported unchanged. See https://base-ui.com/react/components/preview-card.
|
|
1821
|
+
|
|
1822
|
+
### PreviewCard.Trigger
|
|
1823
|
+
|
|
1824
|
+
Base UI `PreviewCard.Trigger` re-exported unchanged. See https://base-ui.com/react/components/preview-card.
|
|
1825
|
+
|
|
1826
|
+
### PreviewCard.Content
|
|
1827
|
+
|
|
1828
|
+
| Prop | Type | Default | Description |
|
|
1829
|
+
| --- | --- | --- | --- |
|
|
1830
|
+
| `side?` | `BasePreviewCard.Positioner.Props['side']` | `'bottom'` | Which side of the trigger the card opens on. |
|
|
1831
|
+
| `align?` | `BasePreviewCard.Positioner.Props['align']` | `'center'` | Alignment along that side. |
|
|
1832
|
+
| `sideOffset?` | `BasePreviewCard.Positioner.Props['sideOffset']` | `8` | Distance from the trigger in px. |
|
|
1833
|
+
| `arrow?` | `boolean` | | Show a small arrow pointing at the trigger. |
|
|
1834
|
+
| `positionerProps?` | `BasePreviewCard.Positioner.Props` | | Props for the positioner element that places the popup. |
|
|
1835
|
+
|
|
1836
|
+
Also accepts all props of: `BasePreviewCard.Popup.Props`.
|
|
1837
|
+
|
|
1838
|
+
## ToastProvider
|
|
1839
|
+
|
|
1840
|
+
component · Overlays
|
|
1841
|
+
|
|
1842
|
+
Mount once near the app root. Then call `useToast()` anywhere below, or pass
|
|
1843
|
+
a `toastManager` from `createToastManager()` to trigger toasts outside React.
|
|
1844
|
+
|
|
1845
|
+
```tsx
|
|
1846
|
+
import { ToastProvider } from '@optimum-intelligence/opti-ui';
|
|
1847
|
+
```
|
|
1848
|
+
|
|
1849
|
+
| Prop | Type | Default | Description |
|
|
1850
|
+
| --- | --- | --- | --- |
|
|
1851
|
+
| `children?` | `React.ReactNode` | | App content; toasts render over it. |
|
|
1852
|
+
| `placement?` | `'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' \| 'bottom-center' \| 'top-center'` | `'bottom-right'` | Screen corner or edge where toasts stack. |
|
|
1853
|
+
| `viewportClassName?` | `string` | | Class for the viewport (positioning container). |
|
|
1854
|
+
|
|
1855
|
+
Also accepts all props of: `Omit<BaseToast.Provider.Props, 'children'>`.
|
|
1856
|
+
|
|
1857
|
+
## Tooltip
|
|
1858
|
+
|
|
1859
|
+
compound · Overlays
|
|
1860
|
+
|
|
1861
|
+
`<Tooltip content="Export"><IconButton … /></Tooltip>`.
|
|
1862
|
+
Wrap the app in `Tooltip.Provider` so adjacent tooltips open instantly.
|
|
1863
|
+
|
|
1864
|
+
```tsx
|
|
1865
|
+
import { Tooltip } from '@optimum-intelligence/opti-ui';
|
|
1866
|
+
```
|
|
1867
|
+
|
|
1868
|
+
| Prop | Type | Default | Description |
|
|
1869
|
+
| --- | --- | --- | --- |
|
|
1870
|
+
| `content` | `React.ReactNode` | | Tooltip text. |
|
|
1871
|
+
| `children` | `React.ReactElement` | | The trigger. Must be a single element that accepts a ref (e.g. a Button). |
|
|
1872
|
+
| `side?` | `TooltipContentProps['side']` | | Which side of the trigger the tooltip shows on. |
|
|
1873
|
+
| `align?` | `TooltipContentProps['align']` | | Alignment along that side. |
|
|
1874
|
+
| `delay?` | `number` | | Hover delay in ms. |
|
|
1875
|
+
| `contentProps?` | `Omit<TooltipContentProps, 'children'>` | | Props for the tooltip popup (arrow, sideOffset, className…). |
|
|
1876
|
+
|
|
1877
|
+
Also accepts all props of: `Omit<BaseTooltip.Root.Props, 'children'>`.
|
|
1878
|
+
|
|
1879
|
+
### Tooltip.Provider
|
|
1880
|
+
|
|
1881
|
+
Base UI `Tooltip.Provider` re-exported unchanged. See https://base-ui.com/react/components/tooltip.
|
|
1882
|
+
|
|
1883
|
+
### Tooltip.Root
|
|
1884
|
+
|
|
1885
|
+
Base UI `Tooltip.Root` re-exported unchanged. See https://base-ui.com/react/components/tooltip.
|
|
1886
|
+
|
|
1887
|
+
### Tooltip.Trigger
|
|
1888
|
+
|
|
1889
|
+
Base UI `Tooltip.Trigger` re-exported unchanged. See https://base-ui.com/react/components/tooltip.
|
|
1890
|
+
|
|
1891
|
+
### Tooltip.Content
|
|
1892
|
+
|
|
1893
|
+
| Prop | Type | Default | Description |
|
|
1894
|
+
| --- | --- | --- | --- |
|
|
1895
|
+
| `side?` | `BaseTooltip.Positioner.Props['side']` | `'top'` | Which side of the trigger the tooltip shows on. |
|
|
1896
|
+
| `align?` | `BaseTooltip.Positioner.Props['align']` | `'center'` | Alignment along that side. |
|
|
1897
|
+
| `sideOffset?` | `BaseTooltip.Positioner.Props['sideOffset']` | `8` | Distance from the trigger in px. |
|
|
1898
|
+
| `arrow?` | `boolean` | `true` | Show a small arrow pointing at the trigger. |
|
|
1899
|
+
| `positionerProps?` | `BaseTooltip.Positioner.Props` | | Props for the positioner element that places the popup. |
|
|
1900
|
+
|
|
1901
|
+
Also accepts all props of: `BaseTooltip.Popup.Props`.
|
|
1902
|
+
|
|
1903
|
+
## useToast
|
|
1904
|
+
|
|
1905
|
+
hook · Overlays
|
|
1906
|
+
|
|
1907
|
+
Toast API with tone shortcuts: `toast.success({ title })`.
|
|
1908
|
+
|
|
1909
|
+
```tsx
|
|
1910
|
+
import { useToast } from '@optimum-intelligence/opti-ui';
|
|
1911
|
+
```
|
|
1912
|
+
|
|
1913
|
+
Signature: `useToast()`
|
|
1914
|
+
|
|
1915
|
+
# Disclosure & navigation
|
|
1916
|
+
|
|
1917
|
+
## Accordion
|
|
1918
|
+
|
|
1919
|
+
compound · Disclosure & navigation
|
|
1920
|
+
|
|
1921
|
+
Expandable sections. Compose `Accordion.Root` › `Accordion.Item` (give each a `value`) ›
|
|
1922
|
+
`Accordion.Trigger` + `Accordion.Panel`. Pass `multiple` to `Root` to allow several open at once.
|
|
1923
|
+
|
|
1924
|
+
```tsx
|
|
1925
|
+
import { Accordion } from '@optimum-intelligence/opti-ui';
|
|
1926
|
+
```
|
|
1927
|
+
|
|
1928
|
+
```tsx
|
|
1929
|
+
<Accordion.Root defaultValue={['a']}>
|
|
1930
|
+
<Accordion.Item value="a">
|
|
1931
|
+
<Accordion.Trigger>Billing</Accordion.Trigger>
|
|
1932
|
+
<Accordion.Panel>…</Accordion.Panel>
|
|
1933
|
+
</Accordion.Item>
|
|
1934
|
+
</Accordion.Root>
|
|
1935
|
+
```
|
|
1936
|
+
|
|
1937
|
+
### Accordion.Root
|
|
1938
|
+
|
|
1939
|
+
| Prop | Type | Default | Description |
|
|
1940
|
+
| --- | --- | --- | --- |
|
|
1941
|
+
| `variant?` | `'separated' \| 'plain'` | `'plain'` | `separated` renders each item as its own card; `plain` uses dividers. |
|
|
1942
|
+
|
|
1943
|
+
Also accepts all props of: `BaseAccordion.Root.Props`.
|
|
1944
|
+
|
|
1945
|
+
### Accordion.Item
|
|
1946
|
+
|
|
1947
|
+
### Accordion.Trigger
|
|
1948
|
+
|
|
1949
|
+
Header + trigger + chevron in one.
|
|
1950
|
+
|
|
1951
|
+
### Accordion.Panel
|
|
1952
|
+
|
|
1953
|
+
## Breadcrumb
|
|
1954
|
+
|
|
1955
|
+
component · Disclosure & navigation
|
|
1956
|
+
|
|
1957
|
+
One step of a breadcrumb trail. Pass a router link through `render`.
|
|
1958
|
+
|
|
1959
|
+
```tsx
|
|
1960
|
+
import { Breadcrumb } from '@optimum-intelligence/opti-ui';
|
|
1961
|
+
```
|
|
1962
|
+
|
|
1963
|
+
| Prop | Type | Default | Description |
|
|
1964
|
+
| --- | --- | --- | --- |
|
|
1965
|
+
| `current?` | `boolean` | `false` | Marks the page the user is on; it renders as text instead of a link. |
|
|
1966
|
+
|
|
1967
|
+
Also accepts all props of: `useRender.ComponentProps<'a', BreadcrumbState>`.
|
|
1968
|
+
|
|
1969
|
+
## Breadcrumbs
|
|
1970
|
+
|
|
1971
|
+
component · Disclosure & navigation
|
|
1972
|
+
|
|
1973
|
+
Trail of links to the pages above the current one. Each child becomes one step.
|
|
1974
|
+
|
|
1975
|
+
```tsx
|
|
1976
|
+
import { Breadcrumbs } from '@optimum-intelligence/opti-ui';
|
|
1977
|
+
```
|
|
1978
|
+
|
|
1979
|
+
| Prop | Type | Default | Description |
|
|
1980
|
+
| --- | --- | --- | --- |
|
|
1981
|
+
| `ref?` | `React.Ref<HTMLElement>` | | Ref to the `<nav>` element. |
|
|
1982
|
+
| `separator?` | `React.ReactNode` | | Shown between items. Defaults to a chevron. |
|
|
1983
|
+
|
|
1984
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLElement>`.
|
|
1985
|
+
|
|
1986
|
+
## Collapsible
|
|
1987
|
+
|
|
1988
|
+
compound · Disclosure & navigation
|
|
1989
|
+
|
|
1990
|
+
A single section that shows and hides: advanced options, "show more", filter groups.
|
|
1991
|
+
|
|
1992
|
+
```tsx
|
|
1993
|
+
import { Collapsible } from '@optimum-intelligence/opti-ui';
|
|
1994
|
+
```
|
|
1995
|
+
|
|
1996
|
+
### Collapsible.Root
|
|
1997
|
+
|
|
1998
|
+
### Collapsible.Trigger
|
|
1999
|
+
|
|
2000
|
+
| Prop | Type | Default | Description |
|
|
2001
|
+
| --- | --- | --- | --- |
|
|
2002
|
+
| `chevron?` | `boolean` | `true` | Show the chevron that turns when the panel opens. |
|
|
2003
|
+
|
|
2004
|
+
Also accepts all props of: `BaseCollapsible.Trigger.Props`.
|
|
2005
|
+
|
|
2006
|
+
### Collapsible.Panel
|
|
2007
|
+
|
|
2008
|
+
## getPageItems
|
|
2009
|
+
|
|
2010
|
+
function · Disclosure & navigation
|
|
2011
|
+
|
|
2012
|
+
Page numbers to render, with `'gap'` where pages are skipped.
|
|
2013
|
+
|
|
2014
|
+
```tsx
|
|
2015
|
+
import { getPageItems } from '@optimum-intelligence/opti-ui';
|
|
2016
|
+
```
|
|
2017
|
+
|
|
2018
|
+
Signature: `getPageItems(page: number, pageCount: number, siblingCount = 1)`
|
|
2019
|
+
|
|
2020
|
+
## Pagination
|
|
2021
|
+
|
|
2022
|
+
component · Disclosure & navigation
|
|
2023
|
+
|
|
2024
|
+
Controlled page navigation with an optional rows-per-page select.
|
|
2025
|
+
|
|
2026
|
+
```tsx
|
|
2027
|
+
import { Pagination } from '@optimum-intelligence/opti-ui';
|
|
2028
|
+
```
|
|
2029
|
+
|
|
2030
|
+
| Prop | Type | Default | Description |
|
|
2031
|
+
| --- | --- | --- | --- |
|
|
2032
|
+
| `ref?` | `React.Ref<HTMLElement>` | | Ref to the `<nav>` element. |
|
|
2033
|
+
| `page` | `number` | | Current page, starting at 1. |
|
|
2034
|
+
| `pageSize` | `number` | | Items per page. |
|
|
2035
|
+
| `total` | `number` | | Total number of items across all pages. |
|
|
2036
|
+
| `onPageChange` | `(page: number) => void` | | Called with the new page number. |
|
|
2037
|
+
| `onPageSizeChange?` | `(pageSize: number) => void` | | Passing this adds the rows-per-page select. |
|
|
2038
|
+
| `pageSizeOptions?` | `number[]` | `[10, 25, 50]` | Choices in the rows-per-page select. |
|
|
2039
|
+
| `variant?` | `'pages' \| 'simple'` | `'pages'` | `pages` shows numbered buttons; `simple` only previous / next. |
|
|
2040
|
+
| `siblingCount?` | `number` | `1` | Numbered pages shown on each side of the current one. |
|
|
2041
|
+
| `hideRange?` | `boolean` | | Hide the "11–20 of 87" summary. |
|
|
2042
|
+
| `labels?` | `Partial<PaginationLabels>` | | Override texts for localisation. |
|
|
2043
|
+
|
|
2044
|
+
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLElement>, 'onChange'>`.
|
|
2045
|
+
|
|
2046
|
+
## Stepper
|
|
2047
|
+
|
|
2048
|
+
component · Disclosure & navigation
|
|
2049
|
+
|
|
2050
|
+
Progress through an ordered sequence: a wizard, a checkout, a background job's phases.
|
|
2051
|
+
|
|
2052
|
+
```tsx
|
|
2053
|
+
import { Stepper } from '@optimum-intelligence/opti-ui';
|
|
2054
|
+
```
|
|
2055
|
+
|
|
2056
|
+
| Prop | Type | Default | Description |
|
|
2057
|
+
| --- | --- | --- | --- |
|
|
2058
|
+
| `ref?` | `React.Ref<HTMLOListElement>` | | Ref to the `<ol>` element. |
|
|
2059
|
+
| `steps` | `StepItem[]` | | The steps in order. |
|
|
2060
|
+
| `current?` | `number` | `0` | Index of the active step. Earlier steps are complete; `steps.length` completes all of them. |
|
|
2061
|
+
| `orientation?` | `'horizontal' \| 'vertical'` | `'horizontal'` | Lay the steps out in a row or a column. |
|
|
2062
|
+
| `size?` | `'sm' \| 'md'` | `'md'` | Marker and text size. |
|
|
2063
|
+
| `labels?` | `Partial<StepperLabels>` | | Screen-reader text for each status. |
|
|
2064
|
+
|
|
2065
|
+
Also accepts all props of: `React.OlHTMLAttributes<HTMLOListElement>`.
|
|
2066
|
+
|
|
2067
|
+
## Tabs
|
|
2068
|
+
|
|
2069
|
+
compound · Disclosure & navigation
|
|
2070
|
+
|
|
2071
|
+
`Tabs.Root` › `Tabs.List` › `Tabs.Tab`, then one `Tabs.Panel` per value.
|
|
2072
|
+
|
|
2073
|
+
```tsx
|
|
2074
|
+
import { Tabs } from '@optimum-intelligence/opti-ui';
|
|
2075
|
+
```
|
|
2076
|
+
|
|
2077
|
+
### Tabs.Root
|
|
2078
|
+
|
|
2079
|
+
### Tabs.List
|
|
2080
|
+
|
|
2081
|
+
| Prop | Type | Default | Description |
|
|
2082
|
+
| --- | --- | --- | --- |
|
|
2083
|
+
| `variant?` | `'underline' \| 'segmented'` | `'underline'` | `underline` (default) for page sections, `segmented` for compact switchers. |
|
|
2084
|
+
| `size?` | `'sm' \| 'md'` | `'md'` | Tab height and text size. |
|
|
2085
|
+
|
|
2086
|
+
Also accepts all props of: `BaseTabs.List.Props`.
|
|
2087
|
+
|
|
2088
|
+
### Tabs.Tab
|
|
2089
|
+
|
|
2090
|
+
### Tabs.Panel
|
|
2091
|
+
|
|
2092
|
+
# Feedback & data display
|
|
2093
|
+
|
|
2094
|
+
## Alert
|
|
2095
|
+
|
|
2096
|
+
component · Feedback & data display
|
|
2097
|
+
|
|
2098
|
+
Inline message for page- or section-level feedback.
|
|
2099
|
+
|
|
2100
|
+
```tsx
|
|
2101
|
+
import { Alert } from '@optimum-intelligence/opti-ui';
|
|
2102
|
+
```
|
|
2103
|
+
|
|
2104
|
+
| Prop | Type | Default | Description |
|
|
2105
|
+
| --- | --- | --- | --- |
|
|
2106
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the alert element. |
|
|
2107
|
+
| `tone?` | `'info' \| 'success' \| 'warning' \| 'danger' \| 'neutral'` | `'info'` | Semantic color and default icon. `danger` and `warning` announce as an alert role. |
|
|
2108
|
+
| `variant?` | `'soft' \| 'outline'` | `'soft'` | `soft` (tinted, default) or `outline`. |
|
|
2109
|
+
| `title?` | `React.ReactNode` | | Bold first line above the message. |
|
|
2110
|
+
| `icon?` | `React.ReactNode \| false` | | Custom icon, or `false` to hide it. |
|
|
2111
|
+
| `actions?` | `React.ReactNode` | | Buttons rendered after the message. |
|
|
2112
|
+
| `onDismiss?` | `() => void` | | Shows a dismiss button. |
|
|
2113
|
+
| `dismissLabel?` | `string` | `'Dismiss'` | Accessible name of the dismiss button. |
|
|
2114
|
+
|
|
2115
|
+
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>`.
|
|
2116
|
+
|
|
2117
|
+
## Avatar
|
|
2118
|
+
|
|
2119
|
+
component · Feedback & data display
|
|
2120
|
+
|
|
2121
|
+
User or entity picture with initials fallback.
|
|
2122
|
+
|
|
2123
|
+
```tsx
|
|
2124
|
+
import { Avatar } from '@optimum-intelligence/opti-ui';
|
|
2125
|
+
```
|
|
2126
|
+
|
|
2127
|
+
| Prop | Type | Default | Description |
|
|
2128
|
+
| --- | --- | --- | --- |
|
|
2129
|
+
| `src?` | `string` | | Image URL. Falls back to initials or `fallback` while loading or on error. |
|
|
2130
|
+
| `alt?` | `string` | | Image alt text. Defaults to `name`. |
|
|
2131
|
+
| `name?` | `string` | | Name used for initials when the image is missing. |
|
|
2132
|
+
| `fallback?` | `React.ReactNode` | | Explicit fallback content (overrides initials). |
|
|
2133
|
+
| `size?` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Diameter. |
|
|
2134
|
+
| `shape?` | `'circle' \| 'rounded'` | `'circle'` | Outline shape. |
|
|
2135
|
+
|
|
2136
|
+
Also accepts all props of: `BaseAvatar.Root.Props`.
|
|
2137
|
+
|
|
2138
|
+
## AvatarGroup
|
|
2139
|
+
|
|
2140
|
+
component · Feedback & data display
|
|
2141
|
+
|
|
2142
|
+
Overlapping row of `Avatar` children, with an optional "+N" overflow counter.
|
|
2143
|
+
|
|
2144
|
+
```tsx
|
|
2145
|
+
import { AvatarGroup } from '@optimum-intelligence/opti-ui';
|
|
2146
|
+
```
|
|
2147
|
+
|
|
2148
|
+
| Prop | Type | Default | Description |
|
|
2149
|
+
| --- | --- | --- | --- |
|
|
2150
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the group element. |
|
|
2151
|
+
| `max?` | `number` | | Show at most this many avatars, then a "+N" counter. |
|
|
2152
|
+
| `size?` | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Size applied to every avatar in the group. |
|
|
2153
|
+
|
|
2154
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
2155
|
+
|
|
2156
|
+
## Badge
|
|
2157
|
+
|
|
2158
|
+
component · Feedback & data display
|
|
2159
|
+
|
|
2160
|
+
Small status label.
|
|
2161
|
+
|
|
2162
|
+
```tsx
|
|
2163
|
+
import { Badge } from '@optimum-intelligence/opti-ui';
|
|
2164
|
+
```
|
|
2165
|
+
|
|
2166
|
+
```tsx
|
|
2167
|
+
<Badge tone="success">Online</Badge>
|
|
2168
|
+
```
|
|
2169
|
+
|
|
2170
|
+
| Prop | Type | Default | Description |
|
|
2171
|
+
| --- | --- | --- | --- |
|
|
2172
|
+
| `tone?` | `'neutral' \| 'accent' \| 'info' \| 'success' \| 'warning' \| 'danger'` | `'neutral'` | Semantic color. |
|
|
2173
|
+
| `variant?` | `'soft' \| 'solid' \| 'outline'` | `'soft'` | `soft` tinted, `solid` filled, `outline` bordered. |
|
|
2174
|
+
| `size?` | `'sm' \| 'md'` | `'md'` | Badge height and text size. |
|
|
2175
|
+
|
|
2176
|
+
Also accepts all props of: `useRender.ComponentProps<'span', BadgeState>`.
|
|
2177
|
+
|
|
2178
|
+
## DataTable
|
|
2179
|
+
|
|
2180
|
+
compound · Feedback & data display
|
|
2181
|
+
|
|
2182
|
+
`<DataTable data={…} columns={…} />` renders a complete table with search,
|
|
2183
|
+
filters, sorting, pagination, row selection, row actions and inline editing;
|
|
2184
|
+
columns declare what they take part in. Every piece of state works
|
|
2185
|
+
uncontrolled or controlled (`search` / `filterValues` / `sort` / `page` /
|
|
2186
|
+
`selection`), and with `mode="server"` the same state drives an API.
|
|
2187
|
+
|
|
2188
|
+
For another layout, create the table with `useDataTable` and compose the
|
|
2189
|
+
parts: `DataTable.Root`, `DataTable.Toolbar`, `DataTable.Search`,
|
|
2190
|
+
`DataTable.Filters`, `DataTable.Filter`, `DataTable.Actions`,
|
|
2191
|
+
`DataTable.Summary`, `DataTable.Content`, `DataTable.Pagination`.
|
|
2192
|
+
|
|
2193
|
+
```tsx
|
|
2194
|
+
import { DataTable } from '@optimum-intelligence/opti-ui';
|
|
2195
|
+
```
|
|
2196
|
+
|
|
2197
|
+
| Prop | Type | Default | Description |
|
|
2198
|
+
| --- | --- | --- | --- |
|
|
2199
|
+
| `layout?` | `'stable' \| 'auto'` | | `stable` (default) measures the columns once and holds their widths, keeps a short last page as tall as a full one, and keeps a row's height while it is edited: nothing moves while the table is used. `auto` leaves the layout to the browser, which fits the columns to the rows on screen. |
|
|
2200
|
+
| `maxHeight?` | `number \| string` | | Scrolls the rows inside this height and keeps the header in view. |
|
|
2201
|
+
| `virtualized?` | `boolean \| DataTableVirtualOptions` | | Renders only the rows in view, for thousands of rows without pagination. Rows are one line high: columns fit their longest value, so mark those with long text `truncate`. Scrolls inside `maxHeight` (default `32rem`). |
|
|
2202
|
+
| `onEndReached?` | `() => void` | | Called when the rows are scrolled near their end, once per row count: load and append the next rows. Needs `maxHeight` or `virtualized`. |
|
|
2203
|
+
| `empty?` | `React.ReactNode` | | Replaces the default empty state. |
|
|
2204
|
+
| `tableProps?` | `Omit<TableProps, 'children'>` | | Props for the underlying `Table` (className, wrapperProps, aria-*). |
|
|
2205
|
+
| `pageSizeOptions?` | `number[]` | | Choices in the rows-per-page select. |
|
|
2206
|
+
| `controlSize?` | `'sm' \| 'md'` | | Size of the search box and the filters. |
|
|
2207
|
+
| `toolbar?` | `React.ReactNode \| ((context: DataTableToolbarContext<T>) => React.ReactNode)` | | Extra toolbar content (export, add…). A function receives the processed rows. |
|
|
2208
|
+
| `className?` | `string` | | Class name for the table's root element. |
|
|
2209
|
+
|
|
2210
|
+
Also accepts all props of: `UseDataTableOptions<T>`, `Pick<TableProps, 'density' \| 'striped' \| 'stickyHeader'>`.
|
|
2211
|
+
|
|
2212
|
+
### DataTable.Root
|
|
2213
|
+
|
|
2214
|
+
Provides a table to the parts inside it.
|
|
2215
|
+
|
|
2216
|
+
| Prop | Type | Default | Description |
|
|
2217
|
+
| --- | --- | --- | --- |
|
|
2218
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the table's root element. |
|
|
2219
|
+
| `table` | `DataTableInstance<T>` | | The table from `useDataTable`. |
|
|
2220
|
+
|
|
2221
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
2222
|
+
|
|
2223
|
+
### DataTable.Toolbar
|
|
2224
|
+
|
|
2225
|
+
Styled `<div>` (`.oui-data-table__toolbar`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
2226
|
+
|
|
2227
|
+
### DataTable.Search
|
|
2228
|
+
|
|
2229
|
+
Search box of the table. Typing applies after the table's `searchDebounce`; clearing applies at once.
|
|
2230
|
+
|
|
2231
|
+
| Prop | Type | Default | Description |
|
|
2232
|
+
| --- | --- | --- | --- |
|
|
2233
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | | Control height. |
|
|
2234
|
+
| `clearLabel?` | `string` | | Accessible name of the clear button. |
|
|
2235
|
+
| `icon?` | `React.ReactNode` | | Replaces the leading search icon. |
|
|
2236
|
+
| `className?` | `string` | | Class name for the search box. |
|
|
2237
|
+
|
|
2238
|
+
Also accepts all props of: `Omit<BaseInput.Props, 'size'>`.
|
|
2239
|
+
|
|
2240
|
+
### DataTable.Filters
|
|
2241
|
+
|
|
2242
|
+
Every filter of the table, with a clear button while any is active. Children are added after the filters.
|
|
2243
|
+
|
|
2244
|
+
| Prop | Type | Default | Description |
|
|
2245
|
+
| --- | --- | --- | --- |
|
|
2246
|
+
| `size?` | `'sm' \| 'md'` | | Control height of every filter. |
|
|
2247
|
+
|
|
2248
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
2249
|
+
|
|
2250
|
+
### DataTable.Filter
|
|
2251
|
+
|
|
2252
|
+
The control of one filter: a dropdown, a toggle chip or a date range picker.
|
|
2253
|
+
|
|
2254
|
+
| Prop | Type | Default | Description |
|
|
2255
|
+
| --- | --- | --- | --- |
|
|
2256
|
+
| `id` | `string` | | Id of the filter: the column id, or the `id` given in `filters`. |
|
|
2257
|
+
| `size?` | `'sm' \| 'md'` | | Control height. |
|
|
2258
|
+
| `className?` | `string` | | Class name for the filter control. |
|
|
2259
|
+
|
|
2260
|
+
### DataTable.Actions
|
|
2261
|
+
|
|
2262
|
+
Styled `<div>` (`.oui-data-table__actions`). Accepts `className`, `style`, the `render` prop and all `<div>` attributes.
|
|
2263
|
+
|
|
2264
|
+
### DataTable.Summary
|
|
2265
|
+
|
|
2266
|
+
Row count, or the number of selected rows, with a spinner while loading.
|
|
2267
|
+
|
|
2268
|
+
### DataTable.Content
|
|
2269
|
+
|
|
2270
|
+
The table itself, with its loading, empty and error states.
|
|
2271
|
+
|
|
2272
|
+
| Prop | Type | Default | Description |
|
|
2273
|
+
| --- | --- | --- | --- |
|
|
2274
|
+
| `layout?` | `'stable' \| 'auto'` | | `stable` (default) measures the columns once and holds their widths, keeps a short last page as tall as a full one, and keeps a row's height while it is edited: nothing moves while the table is used. `auto` leaves the layout to the browser, which fits the columns to the rows on screen. |
|
|
2275
|
+
| `maxHeight?` | `number \| string` | | Scrolls the rows inside this height and keeps the header in view. |
|
|
2276
|
+
| `virtualized?` | `boolean \| DataTableVirtualOptions` | | Renders only the rows in view, for thousands of rows without pagination. Rows are one line high: columns fit their longest value, so mark those with long text `truncate`. Scrolls inside `maxHeight` (default `32rem`). |
|
|
2277
|
+
| `onEndReached?` | `() => void` | | Called when the rows are scrolled near their end, once per row count: load and append the next rows. Needs `maxHeight` or `virtualized`. |
|
|
2278
|
+
| `empty?` | `React.ReactNode` | | Replaces the default empty state. |
|
|
2279
|
+
| `tableProps?` | `Omit<TableProps, 'children'>` | | Props for the underlying `Table` (className, wrapperProps, aria-*). |
|
|
2280
|
+
|
|
2281
|
+
Also accepts all props of: `Pick<TableProps, 'density' \| 'striped' \| 'stickyHeader'>`.
|
|
2282
|
+
|
|
2283
|
+
### DataTable.Pagination
|
|
2284
|
+
|
|
2285
|
+
Page navigation of the table. Renders nothing when there are no rows, or the table is not paginated.
|
|
2286
|
+
|
|
2287
|
+
| Prop | Type | Default | Description |
|
|
2288
|
+
| --- | --- | --- | --- |
|
|
2289
|
+
| `ref?` | `React.Ref<HTMLElement>` | | Ref to the `<nav>` element. |
|
|
2290
|
+
| `pageSizeOptions?` | `number[]` | | Choices in the rows-per-page select. |
|
|
2291
|
+
| `variant?` | `'pages' \| 'simple'` | | `pages` shows numbered buttons; `simple` only previous / next. |
|
|
2292
|
+
| `siblingCount?` | `number` | | Numbered pages shown on each side of the current one. |
|
|
2293
|
+
| `hideRange?` | `boolean` | | Hide the "11–20 of 87" summary. |
|
|
2294
|
+
| `labels?` | `Partial<PaginationLabels>` | | Override texts for localisation. |
|
|
2295
|
+
|
|
2296
|
+
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLElement>, 'onChange'>`.
|
|
2297
|
+
|
|
2298
|
+
## EmptyState
|
|
2299
|
+
|
|
2300
|
+
component · Feedback & data display
|
|
2301
|
+
|
|
2302
|
+
Placeholder for empty lists, searches without results and first-run screens.
|
|
2303
|
+
|
|
2304
|
+
```tsx
|
|
2305
|
+
import { EmptyState } from '@optimum-intelligence/opti-ui';
|
|
2306
|
+
```
|
|
2307
|
+
|
|
2308
|
+
| Prop | Type | Default | Description |
|
|
2309
|
+
| --- | --- | --- | --- |
|
|
2310
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the root element. |
|
|
2311
|
+
| `icon?` | `React.ReactNode` | | Illustration or icon above the title. |
|
|
2312
|
+
| `title` | `React.ReactNode` | | What is missing, e.g. "No vehicles yet". |
|
|
2313
|
+
| `description?` | `React.ReactNode` | | Explains why it is empty or what to do next. |
|
|
2314
|
+
| `actions?` | `React.ReactNode` | | Buttons for the next step. |
|
|
2315
|
+
| `align?` | `'center' \| 'start'` | `'center'` | Center content (default) or align to start. |
|
|
2316
|
+
|
|
2317
|
+
Also accepts all props of: `Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>`.
|
|
2318
|
+
|
|
2319
|
+
## Meter
|
|
2320
|
+
|
|
2321
|
+
component · Feedback & data display
|
|
2322
|
+
|
|
2323
|
+
A measurement within a known range (quota, capacity, score).
|
|
2324
|
+
|
|
2325
|
+
```tsx
|
|
2326
|
+
import { Meter } from '@optimum-intelligence/opti-ui';
|
|
2327
|
+
```
|
|
2328
|
+
|
|
2329
|
+
| Prop | Type | Default | Description |
|
|
2330
|
+
| --- | --- | --- | --- |
|
|
2331
|
+
| `label?` | `React.ReactNode` | | Label above the bar. |
|
|
2332
|
+
| `showValue?` | `boolean` | `true` | Show the formatted value next to the label. Defaults to `true`. |
|
|
2333
|
+
| `tone?` | `'accent' \| 'primary' \| 'success' \| 'warning' \| 'danger'` | `'accent'` | Bar color. |
|
|
2334
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Bar thickness. |
|
|
2335
|
+
|
|
2336
|
+
Also accepts all props of: `BaseMeter.Root.Props`.
|
|
2337
|
+
|
|
2338
|
+
## Progress
|
|
2339
|
+
|
|
2340
|
+
component · Feedback & data display
|
|
2341
|
+
|
|
2342
|
+
Task completion. Pass `value={null}` for an indeterminate bar.
|
|
2343
|
+
|
|
2344
|
+
```tsx
|
|
2345
|
+
import { Progress } from '@optimum-intelligence/opti-ui';
|
|
2346
|
+
```
|
|
2347
|
+
|
|
2348
|
+
| Prop | Type | Default | Description |
|
|
2349
|
+
| --- | --- | --- | --- |
|
|
2350
|
+
| `label?` | `React.ReactNode` | | Label above the bar. |
|
|
2351
|
+
| `showValue?` | `boolean` | | Show the formatted value next to the label. |
|
|
2352
|
+
| `tone?` | `'accent' \| 'primary' \| 'success' \| 'warning' \| 'danger'` | `'accent'` | Bar color. |
|
|
2353
|
+
| `size?` | `'sm' \| 'md' \| 'lg'` | `'md'` | Bar thickness. |
|
|
2354
|
+
|
|
2355
|
+
Also accepts all props of: `BaseProgress.Root.Props`.
|
|
2356
|
+
|
|
2357
|
+
## Skeleton
|
|
2358
|
+
|
|
2359
|
+
component · Feedback & data display
|
|
2360
|
+
|
|
2361
|
+
Pulsing placeholder for content that is still loading.
|
|
2362
|
+
|
|
2363
|
+
```tsx
|
|
2364
|
+
import { Skeleton } from '@optimum-intelligence/opti-ui';
|
|
2365
|
+
```
|
|
2366
|
+
|
|
2367
|
+
| Prop | Type | Default | Description |
|
|
2368
|
+
| --- | --- | --- | --- |
|
|
2369
|
+
| `ref?` | `React.Ref<HTMLSpanElement>` | | Ref to the placeholder element. |
|
|
2370
|
+
| `width?` | `number \| string` | | Width in px (number) or any CSS length. |
|
|
2371
|
+
| `height?` | `number \| string` | | Height in px (number) or any CSS length. |
|
|
2372
|
+
| `circle?` | `boolean` | | Render as a circle (uses `width` for both dimensions). |
|
|
2373
|
+
| `radius?` | `number \| string` | | Corner radius in px (number) or any CSS length. |
|
|
2374
|
+
|
|
2375
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLSpanElement>`.
|
|
2376
|
+
|
|
2377
|
+
## SkeletonText
|
|
2378
|
+
|
|
2379
|
+
component · Feedback & data display
|
|
2380
|
+
|
|
2381
|
+
Skeleton placeholder shaped like a paragraph; the last line is shorter.
|
|
2382
|
+
|
|
2383
|
+
```tsx
|
|
2384
|
+
import { SkeletonText } from '@optimum-intelligence/opti-ui';
|
|
2385
|
+
```
|
|
2386
|
+
|
|
2387
|
+
| Prop | Type | Default | Description |
|
|
2388
|
+
| --- | --- | --- | --- |
|
|
2389
|
+
| `ref?` | `React.Ref<HTMLDivElement>` | | Ref to the wrapper element. |
|
|
2390
|
+
| `lines?` | `number` | `3` | Number of placeholder lines. |
|
|
2391
|
+
|
|
2392
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLDivElement>`.
|
|
2393
|
+
|
|
2394
|
+
## Spinner
|
|
2395
|
+
|
|
2396
|
+
component · Feedback & data display
|
|
2397
|
+
|
|
2398
|
+
Indeterminate loading indicator that follows `currentColor`.
|
|
2399
|
+
|
|
2400
|
+
```tsx
|
|
2401
|
+
import { Spinner } from '@optimum-intelligence/opti-ui';
|
|
2402
|
+
```
|
|
2403
|
+
|
|
2404
|
+
| Prop | Type | Default | Description |
|
|
2405
|
+
| --- | --- | --- | --- |
|
|
2406
|
+
| `ref?` | `React.Ref<HTMLSpanElement>` | | Ref to the spinner element. |
|
|
2407
|
+
| `size?` | `number \| string` | | Diameter, e.g. `1rem` or `24`. Defaults to `1.25em`. |
|
|
2408
|
+
| `label?` | `string \| null` | `'Loading'` | Accessible label. Set to `null` when a parent already announces loading. |
|
|
2409
|
+
|
|
2410
|
+
Also accepts all props of: `React.HTMLAttributes<HTMLSpanElement>`.
|
|
2411
|
+
|
|
2412
|
+
## Table
|
|
2413
|
+
|
|
2414
|
+
component · Feedback & data display
|
|
2415
|
+
|
|
2416
|
+
Styled HTML table inside a horizontally scrolling wrapper. Compose with `TableHeader`, `TableBody`,
|
|
2417
|
+
`TableFooter`, `TableRow`, `TableHead`, `TableCell` and `TableCaption`. For search, filters, sorting
|
|
2418
|
+
and pagination use `DataTable` instead.
|
|
2419
|
+
|
|
2420
|
+
```tsx
|
|
2421
|
+
import { Table } from '@optimum-intelligence/opti-ui';
|
|
2422
|
+
```
|
|
2423
|
+
|
|
2424
|
+
```tsx
|
|
2425
|
+
<Table striped>
|
|
2426
|
+
<TableHeader>
|
|
2427
|
+
<TableRow><TableHead>Site</TableHead><TableHead align="end">kWh</TableHead></TableRow>
|
|
2428
|
+
</TableHeader>
|
|
2429
|
+
<TableBody>
|
|
2430
|
+
<TableRow><TableCell>Győr</TableCell><TableCell numeric>1,204</TableCell></TableRow>
|
|
2431
|
+
</TableBody>
|
|
2432
|
+
</Table>
|
|
2433
|
+
```
|
|
2434
|
+
|
|
2435
|
+
| Prop | Type | Default | Description |
|
|
2436
|
+
| --- | --- | --- | --- |
|
|
2437
|
+
| `ref?` | `React.Ref<HTMLTableElement>` | | Ref to the `<table>`. |
|
|
2438
|
+
| `density?` | `'compact' \| 'normal' \| 'comfortable'` | `'normal'` | Row height and cell padding. `normal` suits data-heavy screens; `comfortable` adds air for short tables. |
|
|
2439
|
+
| `striped?` | `boolean` | | Alternating row background. |
|
|
2440
|
+
| `hoverable?` | `boolean` | `true` | Highlight rows on hover. |
|
|
2441
|
+
| `stickyHeader?` | `boolean` | | Keep the header visible while the wrapper scrolls (set a max height on it). |
|
|
2442
|
+
| `wrapperProps?` | `React.HTMLAttributes<HTMLDivElement>` | | Props for the horizontally scrolling wrapper. |
|
|
2443
|
+
|
|
2444
|
+
Also accepts all props of: `React.TableHTMLAttributes<HTMLTableElement>`.
|
|
2445
|
+
|
|
2446
|
+
## TableBody
|
|
2447
|
+
|
|
2448
|
+
compound · Feedback & data display
|
|
2449
|
+
|
|
2450
|
+
Styled `<tbody>` (`.oui-table__body`). Accepts `className`, `style`, the `render` prop and all `<tbody>` attributes.
|
|
2451
|
+
|
|
2452
|
+
```tsx
|
|
2453
|
+
import { TableBody } from '@optimum-intelligence/opti-ui';
|
|
2454
|
+
```
|
|
2455
|
+
|
|
2456
|
+
### TableBody.displayName
|
|
2457
|
+
|
|
2458
|
+
## TableCaption
|
|
2459
|
+
|
|
2460
|
+
compound · Feedback & data display
|
|
2461
|
+
|
|
2462
|
+
Styled `<caption>` (`.oui-table__caption`). Accepts `className`, `style`, the `render` prop and all `<caption>` attributes.
|
|
2463
|
+
|
|
2464
|
+
```tsx
|
|
2465
|
+
import { TableCaption } from '@optimum-intelligence/opti-ui';
|
|
2466
|
+
```
|
|
2467
|
+
|
|
2468
|
+
### TableCaption.displayName
|
|
2469
|
+
|
|
2470
|
+
## TableCell
|
|
2471
|
+
|
|
2472
|
+
component · Feedback & data display
|
|
2473
|
+
|
|
2474
|
+
Body cell (`<td>`). `numeric` right-aligns and uses tabular figures.
|
|
2475
|
+
|
|
2476
|
+
```tsx
|
|
2477
|
+
import { TableCell } from '@optimum-intelligence/opti-ui';
|
|
2478
|
+
```
|
|
2479
|
+
|
|
2480
|
+
| Prop | Type | Default | Description |
|
|
2481
|
+
| --- | --- | --- | --- |
|
|
2482
|
+
| `ref?` | `React.Ref<HTMLTableCellElement>` | | Ref to the `<td>`. |
|
|
2483
|
+
| `align?` | `Align` | | Horizontal alignment. Defaults to `end` when `numeric`, else `start`. |
|
|
2484
|
+
| `numeric?` | `boolean` | | Tabular figures for numeric columns. |
|
|
2485
|
+
|
|
2486
|
+
Also accepts all props of: `Omit<React.TdHTMLAttributes<HTMLTableCellElement>, 'align'>`.
|
|
2487
|
+
|
|
2488
|
+
## TableFooter
|
|
2489
|
+
|
|
2490
|
+
compound · Feedback & data display
|
|
2491
|
+
|
|
2492
|
+
Styled `<tfoot>` (`.oui-table__footer`). Accepts `className`, `style`, the `render` prop and all `<tfoot>` attributes.
|
|
2493
|
+
|
|
2494
|
+
```tsx
|
|
2495
|
+
import { TableFooter } from '@optimum-intelligence/opti-ui';
|
|
2496
|
+
```
|
|
2497
|
+
|
|
2498
|
+
### TableFooter.displayName
|
|
2499
|
+
|
|
2500
|
+
## TableHead
|
|
2501
|
+
|
|
2502
|
+
component · Feedback & data display
|
|
2503
|
+
|
|
2504
|
+
Column header cell (`<th>`), optionally a sort button.
|
|
2505
|
+
|
|
2506
|
+
```tsx
|
|
2507
|
+
import { TableHead } from '@optimum-intelligence/opti-ui';
|
|
2508
|
+
```
|
|
2509
|
+
|
|
2510
|
+
| Prop | Type | Default | Description |
|
|
2511
|
+
| --- | --- | --- | --- |
|
|
2512
|
+
| `ref?` | `React.Ref<HTMLTableCellElement>` | | Ref to the `<th>`. |
|
|
2513
|
+
| `align?` | `Align` | `'start'` | Horizontal alignment of the header content. |
|
|
2514
|
+
| `sort?` | `SortDirection` | | Current sort of this column. Passing it (even `false`) makes the header sortable. |
|
|
2515
|
+
| `onSort?` | `() => void` | | Called when the sortable header is clicked. |
|
|
2516
|
+
|
|
2517
|
+
Also accepts all props of: `Omit<React.ThHTMLAttributes<HTMLTableCellElement>, 'align'>`.
|
|
2518
|
+
|
|
2519
|
+
## TableHeader
|
|
2520
|
+
|
|
2521
|
+
compound · Feedback & data display
|
|
2522
|
+
|
|
2523
|
+
Styled `<thead>` (`.oui-table__header`). Accepts `className`, `style`, the `render` prop and all `<thead>` attributes.
|
|
2524
|
+
|
|
2525
|
+
```tsx
|
|
2526
|
+
import { TableHeader } from '@optimum-intelligence/opti-ui';
|
|
2527
|
+
```
|
|
2528
|
+
|
|
2529
|
+
### TableHeader.displayName
|
|
2530
|
+
|
|
2531
|
+
## TableRow
|
|
2532
|
+
|
|
2533
|
+
compound · Feedback & data display
|
|
2534
|
+
|
|
2535
|
+
Styled `<tr>` (`.oui-table__row`). Accepts `className`, `style`, the `render` prop and all `<tr>` attributes.
|
|
2536
|
+
|
|
2537
|
+
```tsx
|
|
2538
|
+
import { TableRow } from '@optimum-intelligence/opti-ui';
|
|
2539
|
+
```
|
|
2540
|
+
|
|
2541
|
+
### TableRow.displayName
|
|
2542
|
+
|
|
2543
|
+
## Tag
|
|
2544
|
+
|
|
2545
|
+
component · Feedback & data display
|
|
2546
|
+
|
|
2547
|
+
Label for a value the user can take away again: an active filter, a recipient, a keyword.
|
|
2548
|
+
|
|
2549
|
+
```tsx
|
|
2550
|
+
import { Tag } from '@optimum-intelligence/opti-ui';
|
|
2551
|
+
```
|
|
2552
|
+
|
|
2553
|
+
| Prop | Type | Default | Description |
|
|
2554
|
+
| --- | --- | --- | --- |
|
|
2555
|
+
| `tone?` | `'neutral' \| 'accent' \| 'info' \| 'success' \| 'warning' \| 'danger'` | `'neutral'` | Semantic color. |
|
|
2556
|
+
| `size?` | `'sm' \| 'md'` | `'md'` | Tag height. |
|
|
2557
|
+
| `icon?` | `React.ReactNode` | | Leading icon. |
|
|
2558
|
+
| `onRemove?` | `() => void` | | Adds the remove button. |
|
|
2559
|
+
| `removeLabel?` | `string` | | Accessible name of the remove button. Defaults to "Remove <text>". |
|
|
2560
|
+
| `disabled?` | `boolean` | `false` | Dims the tag and disables its remove button. |
|
|
2561
|
+
|
|
2562
|
+
Also accepts all props of: `useRender.ComponentProps<'span', TagState>`.
|
|
2563
|
+
|
|
2564
|
+
## useDataTable
|
|
2565
|
+
|
|
2566
|
+
hook · Feedback & data display
|
|
2567
|
+
|
|
2568
|
+
State and row processing of a `DataTable`, without any markup. Pass the
|
|
2569
|
+
result to `DataTable.Root` to lay the parts out yourself, or read `rows`,
|
|
2570
|
+
`filterValues` and the rest to drive something else (an export, a chart).
|
|
2571
|
+
|
|
2572
|
+
```tsx
|
|
2573
|
+
import { useDataTable } from '@optimum-intelligence/opti-ui';
|
|
2574
|
+
```
|
|
2575
|
+
|
|
2576
|
+
| Prop | Type | Default | Description |
|
|
2577
|
+
| --- | --- | --- | --- |
|
|
2578
|
+
| `data` | `T[]` | | All rows, or in server mode the rows of the current page. |
|
|
2579
|
+
| `columns` | `DataTableColumn<T>[]` | | Column definitions: id, header, cell renderer, sorting, filter and layout options. |
|
|
2580
|
+
| `mode?` | `'client' \| 'server'` | `'client'` | `server` renders `data` as it is: search, filtering, sorting and pagination are left to the API, driven by the `search` / `filterValues` / `sort` / `page` callbacks. |
|
|
2581
|
+
| `total?` | `number` | | Server mode: number of rows across all pages. |
|
|
2582
|
+
| `loading?` | `boolean` | `false` | Shows placeholder rows when there is no data yet, and dims the rows during a refetch. |
|
|
2583
|
+
| `error?` | `React.ReactNode` | | Error message shown in place of the rows. |
|
|
2584
|
+
| `onRetry?` | `() => void` | | Adds a retry button to the error message. |
|
|
2585
|
+
| `getRowId?` | `(row: T, index: number) => string` | | Stable id per row, needed for selection and editing. Defaults to `row.id`, then the index. |
|
|
2586
|
+
| `locale?` | `string` | | Language whose alphabet orders sorted text and filter options (`"hu"`). Defaults to the browser's. |
|
|
2587
|
+
| `searchable?` | `boolean` | `true` | Show the search box (default `true`). |
|
|
2588
|
+
| `search?` | `string` | | Search text (controlled). |
|
|
2589
|
+
| `defaultSearch?` | `string` | `''` | Initial search text when uncontrolled. |
|
|
2590
|
+
| `onSearchChange?` | `(search: string) => void` | | Called when the search text changes (after `searchDebounce`). |
|
|
2591
|
+
| `searchDebounce?` | `number` | | Milliseconds of typing pause before the search applies. Defaults to 300 in server mode, 0 otherwise. |
|
|
2592
|
+
| `filter?` | `(row: T, search: string) => boolean` | | Replaces the built-in search, which matches every term against the searchable columns. |
|
|
2593
|
+
| `filters?` | `DataTableFilter<T>[]` | | Toolbar filters that are not tied to a column. Columns add theirs with `filter`. |
|
|
2594
|
+
| `filterValues?` | `DataTableFilterValues` | | Filter values by filter id (controlled). |
|
|
2595
|
+
| `defaultFilterValues?` | `DataTableFilterValues` | | Initial filter values when uncontrolled. |
|
|
2596
|
+
| `onFilterValuesChange?` | `(values: DataTableFilterValues) => void` | | Called with all filter values when one changes or they are cleared. |
|
|
2597
|
+
| `sort?` | `DataTableSort \| null` | | Column sort (controlled); `null` for none. |
|
|
2598
|
+
| `defaultSort?` | `DataTableSort \| null` | `null` | Initial sort when uncontrolled. |
|
|
2599
|
+
| `onSortChange?` | `(sort: DataTableSort \| null) => void` | | Called when the user sorts a column. |
|
|
2600
|
+
| `paginated?` | `boolean` | `true` | Paginate rows (default `true`). |
|
|
2601
|
+
| `page?` | `number` | | Current page, starting at 1 (controlled). |
|
|
2602
|
+
| `onPageChange?` | `(page: number) => void` | | Called when the page changes. |
|
|
2603
|
+
| `pageSize?` | `number` | | Rows per page (controlled). |
|
|
2604
|
+
| `defaultPageSize?` | `number` | `10` | Initial rows per page when uncontrolled. |
|
|
2605
|
+
| `onPageSizeChange?` | `(pageSize: number) => void` | | Called when the rows per page change. |
|
|
2606
|
+
| `selection?` | `string[]` | | Selected row ids. Passing `onSelectionChange` adds the checkbox column. Select-all covers every filtered row, or in server mode the current page. |
|
|
2607
|
+
| `onSelectionChange?` | `(selection: string[]) => void` | | Called with the selected row ids. |
|
|
2608
|
+
| `onRowClick?` | `(row: T) => void` | | Makes rows clickable and keyboard-activatable (Enter). |
|
|
2609
|
+
| `rowLabel?` | `(row: T) => string` | | Accessible name of a row, used by row selection and clickable rows. |
|
|
2610
|
+
| `rowActions?` | `(row: T) => DataTableRowAction[] \| React.ReactNode` | | Trailing cell of each row: icon buttons, or any content (a menu, a link). |
|
|
2611
|
+
| `rowTone?` | `(row: T) => DataTableRowTone \| null \| undefined` | | Tints a row to flag its state. |
|
|
2612
|
+
| `rowProps?` | `(row: T) => React.HTMLAttributes<HTMLTableRowElement> & Record<`data-${string}`, unknown>` | | Extra props for a row's `<tr>` (`className`, `style`, `data-*`). |
|
|
2613
|
+
| `onRowSave?` | `(row: T, original: T) => void \| Promise<void>` | | Adds an edit action to each row; columns with `edit` turn into inputs. Called with the edited row. Return a promise to keep the row open while it saves; a rejected one leaves it open for another try. |
|
|
2614
|
+
| `onRowDelete?` | `(row: T) => void` | | Adds a delete action, shown while a row is edited, or on every row without `onRowSave`. |
|
|
2615
|
+
| `labels?` | `Partial<DataTableLabels>` | | Override texts for localisation. |
|
|
2616
|
+
|
|
2617
|
+
## useDataTableContext
|
|
2618
|
+
|
|
2619
|
+
hook · Feedback & data display
|
|
2620
|
+
|
|
2621
|
+
The table of the surrounding `DataTable.Root`, for building custom parts.
|
|
2622
|
+
|
|
2623
|
+
```tsx
|
|
2624
|
+
import { useDataTableContext } from '@optimum-intelligence/opti-ui';
|
|
2625
|
+
```
|
|
2626
|
+
|
|
2627
|
+
Signature: `useDataTableContext()`
|
|
2628
|
+
|
|
2629
|
+
# Icons & utilities
|
|
2630
|
+
|
|
2631
|
+
## cx
|
|
2632
|
+
|
|
2633
|
+
function · Icons & utilities
|
|
2634
|
+
|
|
2635
|
+
Joins truthy class names.
|
|
2636
|
+
|
|
2637
|
+
```tsx
|
|
2638
|
+
import { cx } from '@optimum-intelligence/opti-ui';
|
|
2639
|
+
```
|
|
2640
|
+
|
|
2641
|
+
Signature: `cx(...classes: ClassValue[])`
|
|
2642
|
+
|
|
2643
|
+
## Icons
|
|
2644
|
+
|
|
2645
|
+
icons · Icons & utilities
|
|
2646
|
+
|
|
2647
|
+
Small built-in stroke icon set. Every icon renders an `<svg>` that follows the font size and `currentColor`.
|
|
2648
|
+
|
|
2649
|
+
```tsx
|
|
2650
|
+
import { ArrowDownIcon } from '@optimum-intelligence/opti-ui';
|
|
2651
|
+
```
|
|
2652
|
+
|
|
2653
|
+
Icons: `ArrowDownIcon`, `ArrowUpIcon`, `CalendarIcon`, `CheckIcon`, `ChevronDownIcon`, `ChevronLeftIcon`, `ChevronRightIcon`, `ChevronUpIcon`, `ChevronsLeftIcon`, `ChevronsRightIcon`, `ChevronsUpDownIcon`, `CircleCheckIcon`, `CircleIcon`, `CircleXIcon`, `ClockIcon`, `ExternalLinkIcon`, `EyeIcon`, `EyeOffIcon`, `FileIcon`, `InfoIcon`, `MenuIcon`, `MinusIcon`, `MoreHorizontalIcon`, `PencilIcon`, `PlusIcon`, `SearchIcon`, `TrashIcon`, `TrendingDownIcon`, `TrendingUpIcon`, `TriangleAlertIcon`, `UploadIcon`, `XIcon`
|
|
2654
|
+
|
|
2655
|
+
| Prop | Type | Default | Description |
|
|
2656
|
+
| --- | --- | --- | --- |
|
|
2657
|
+
| `size?` | `number \| string` | | Width and height. Defaults to `1em` so icons follow the font size. |
|
|
2658
|
+
|
|
2659
|
+
## matchesQuery
|
|
2660
|
+
|
|
2661
|
+
function · Icons & utilities
|
|
2662
|
+
|
|
2663
|
+
True when every whitespace-separated term of `query` occurs in `text`. An empty query matches.
|
|
2664
|
+
|
|
2665
|
+
```tsx
|
|
2666
|
+
import { matchesQuery } from '@optimum-intelligence/opti-ui';
|
|
2667
|
+
```
|
|
2668
|
+
|
|
2669
|
+
Signature: `matchesQuery(text: unknown, query: string)`
|
|
2670
|
+
|
|
2671
|
+
## normalizeText
|
|
2672
|
+
|
|
2673
|
+
function · Icons & utilities
|
|
2674
|
+
|
|
2675
|
+
Lower-cases and strips diacritics, so "gyor" matches "Győr".
|
|
2676
|
+
|
|
2677
|
+
```tsx
|
|
2678
|
+
import { normalizeText } from '@optimum-intelligence/opti-ui';
|
|
2679
|
+
```
|
|
2680
|
+
|
|
2681
|
+
Signature: `normalizeText(value: unknown)`
|
|
2682
|
+
|
|
2683
|
+
## usePortalContainer
|
|
2684
|
+
|
|
2685
|
+
hook · Icons & utilities
|
|
2686
|
+
|
|
2687
|
+
Returns the element popups should portal into: the nearest `ThemeProvider`, or
|
|
2688
|
+
`undefined` for the document body. Pass it as `container` when building a custom portalled popup.
|
|
2689
|
+
|
|
2690
|
+
```tsx
|
|
2691
|
+
import { usePortalContainer } from '@optimum-intelligence/opti-ui';
|
|
2692
|
+
```
|
|
2693
|
+
|
|
2694
|
+
Signature: `usePortalContainer()`
|
|
2695
|
+
|
|
2696
|
+
## withClass
|
|
2697
|
+
|
|
2698
|
+
function · Icons & utilities
|
|
2699
|
+
|
|
2700
|
+
Prepends a library class to a Base UI `className` prop, preserving the
|
|
2701
|
+
function form so consumers can still derive classes from component state.
|
|
2702
|
+
|
|
2703
|
+
```tsx
|
|
2704
|
+
import { withClass } from '@optimum-intelligence/opti-ui';
|
|
2705
|
+
```
|
|
2706
|
+
|
|
2707
|
+
Signature: `withClass(base: string, className: StateClassName<State>,)`
|