@nexub/mcp 0.0.0-stage → 1.7.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 +40 -2
- package/dist/skill/SKILL.md +97 -0
- package/dist/skill/references/components/accordion.md +77 -0
- package/dist/skill/references/components/activity-feed.md +33 -0
- package/dist/skill/references/components/alert-dialog.md +48 -0
- package/dist/skill/references/components/alert.md +54 -0
- package/dist/skill/references/components/amount.md +34 -0
- package/dist/skill/references/components/auth-card.md +33 -0
- package/dist/skill/references/components/autocomplete.md +54 -0
- package/dist/skill/references/components/avatar-group.md +26 -0
- package/dist/skill/references/components/avatar.md +48 -0
- package/dist/skill/references/components/badge.md +71 -0
- package/dist/skill/references/components/banner.md +32 -0
- package/dist/skill/references/components/bento-grid.md +42 -0
- package/dist/skill/references/components/box.md +35 -0
- package/dist/skill/references/components/breadcrumb.md +61 -0
- package/dist/skill/references/components/button-group.md +43 -0
- package/dist/skill/references/components/button.md +118 -0
- package/dist/skill/references/components/callout.md +27 -0
- package/dist/skill/references/components/card.md +74 -0
- package/dist/skill/references/components/checkbox-card.md +49 -0
- package/dist/skill/references/components/checkbox.md +51 -0
- package/dist/skill/references/components/chip.md +35 -0
- package/dist/skill/references/components/citation.md +61 -0
- package/dist/skill/references/components/code-inline.md +25 -0
- package/dist/skill/references/components/collapsible.md +71 -0
- package/dist/skill/references/components/combobox.md +40 -0
- package/dist/skill/references/components/conversation.md +100 -0
- package/dist/skill/references/components/data-table.md +69 -0
- package/dist/skill/references/components/date-picker.md +56 -0
- package/dist/skill/references/components/date-range-picker.md +48 -0
- package/dist/skill/references/components/dialog.md +57 -0
- package/dist/skill/references/components/drawer.md +79 -0
- package/dist/skill/references/components/empty-state.md +77 -0
- package/dist/skill/references/components/error-state.md +37 -0
- package/dist/skill/references/components/error-summary.md +71 -0
- package/dist/skill/references/components/eyebrow-chip.md +28 -0
- package/dist/skill/references/components/filter-bar.md +36 -0
- package/dist/skill/references/components/filter-chip.md +26 -0
- package/dist/skill/references/components/flex.md +47 -0
- package/dist/skill/references/components/form-field.md +26 -0
- package/dist/skill/references/components/gradient-divider.md +13 -0
- package/dist/skill/references/components/grid.md +39 -0
- package/dist/skill/references/components/heading.md +46 -0
- package/dist/skill/references/components/helper-text.md +31 -0
- package/dist/skill/references/components/hover-card.md +34 -0
- package/dist/skill/references/components/icon-button.md +44 -0
- package/dist/skill/references/components/info-list.md +25 -0
- package/dist/skill/references/components/input.md +78 -0
- package/dist/skill/references/components/kbd.md +42 -0
- package/dist/skill/references/components/label.md +37 -0
- package/dist/skill/references/components/link.md +38 -0
- package/dist/skill/references/components/list-detail.md +27 -0
- package/dist/skill/references/components/media-card.md +61 -0
- package/dist/skill/references/components/message-bubble.md +68 -0
- package/dist/skill/references/components/money-input.md +30 -0
- package/dist/skill/references/components/motion-collapse.md +57 -0
- package/dist/skill/references/components/motion-fade.md +64 -0
- package/dist/skill/references/components/motion-scale.md +54 -0
- package/dist/skill/references/components/motion-slide.md +60 -0
- package/dist/skill/references/components/navigation-rail.md +29 -0
- package/dist/skill/references/components/notification-item.md +29 -0
- package/dist/skill/references/components/number-input.md +30 -0
- package/dist/skill/references/components/number-ticker.md +44 -0
- package/dist/skill/references/components/pagination.md +52 -0
- package/dist/skill/references/components/password-input.md +28 -0
- package/dist/skill/references/components/plan-card.md +34 -0
- package/dist/skill/references/components/popover.md +53 -0
- package/dist/skill/references/components/progress.md +39 -0
- package/dist/skill/references/components/prompt-input.md +95 -0
- package/dist/skill/references/components/radio-card.md +83 -0
- package/dist/skill/references/components/radio-group.md +57 -0
- package/dist/skill/references/components/rating.md +39 -0
- package/dist/skill/references/components/scroll-area.md +57 -0
- package/dist/skill/references/components/search-input.md +22 -0
- package/dist/skill/references/components/segmented-control.md +44 -0
- package/dist/skill/references/components/select.md +43 -0
- package/dist/skill/references/components/separator.md +30 -0
- package/dist/skill/references/components/settings-section.md +31 -0
- package/dist/skill/references/components/sheet.md +51 -0
- package/dist/skill/references/components/skeleton.md +38 -0
- package/dist/skill/references/components/slider.md +31 -0
- package/dist/skill/references/components/spinner.md +32 -0
- package/dist/skill/references/components/split-button.md +43 -0
- package/dist/skill/references/components/stack.md +35 -0
- package/dist/skill/references/components/stat-card.md +49 -0
- package/dist/skill/references/components/status-pill.md +37 -0
- package/dist/skill/references/components/step-indicator.md +29 -0
- package/dist/skill/references/components/streaming-text.md +53 -0
- package/dist/skill/references/components/switch.md +36 -0
- package/dist/skill/references/components/table.md +89 -0
- package/dist/skill/references/components/tabs.md +51 -0
- package/dist/skill/references/components/tag.md +25 -0
- package/dist/skill/references/components/text-gradient.md +30 -0
- package/dist/skill/references/components/text.md +45 -0
- package/dist/skill/references/components/textarea.md +40 -0
- package/dist/skill/references/components/thinking-indicator.md +50 -0
- package/dist/skill/references/components/toast.md +141 -0
- package/dist/skill/references/components/toggle-group.md +35 -0
- package/dist/skill/references/components/toggle.md +32 -0
- package/dist/skill/references/components/tooltip.md +34 -0
- package/dist/skill/references/components/user-card.md +27 -0
- package/dist/skill/references/components.md +192 -0
- package/dist/skill/references/tokens.md +234 -0
- package/package.json +41 -3
- package/src/cli.js +9 -0
- package/src/server.js +98 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Password Input
|
|
2
|
+
|
|
3
|
+
A password field with a built-in toggle to reveal or hide the entered value.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Form & Input · Status: stable
|
|
6
|
+
- Import: `import { PasswordInput } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/password-input
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `placeholder` | `string` | | Placeholder text shown when the field is empty. |
|
|
14
|
+
| `invalid` | `boolean` | | Applies error styling to indicate a validation failure. |
|
|
15
|
+
| `disabled` | `boolean` | | Disables the input. |
|
|
16
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | | Controls font size and padding. |
|
|
17
|
+
|
|
18
|
+
## Example: Default
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
<PasswordInput placeholder="Enter password…" />
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Example: Invalid
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
<PasswordInput invalid placeholder="Password is too short" />
|
|
28
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# PlanCard
|
|
2
|
+
|
|
3
|
+
Pricing plan card with feature checklist, badge, and CTA button.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/patterns` · Category: Marketing · Status: stable
|
|
6
|
+
- Import: `import { PlanCard } from '@nexub/patterns';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/patterns/plan-card
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `name` (required) | `string` | | Plan name (e.g. "Pro"). |
|
|
14
|
+
| `price` (required) | `string` | | Price string (e.g. "$49/mo"). |
|
|
15
|
+
| `description` | `string` | | Short plan description. |
|
|
16
|
+
| `features` | `string[]` | | List of included features. |
|
|
17
|
+
| `highlighted` | `boolean` | `false` | Applies brand accent styling for recommended plans. |
|
|
18
|
+
| `badge` | `string` | | Label for the plan badge (e.g. "Most Popular"). |
|
|
19
|
+
| `ctaLabel` | `string` | `'Get started'` | CTA button label. |
|
|
20
|
+
| `onCta` | `() => void` | | CTA button click handler. |
|
|
21
|
+
|
|
22
|
+
## Example: Default
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
<PlanCard
|
|
26
|
+
name="Pro"
|
|
27
|
+
price="$49/mo"
|
|
28
|
+
description="Everything you need to scale."
|
|
29
|
+
features={['Unlimited projects', 'Priority support', 'Custom domains', 'Analytics']}
|
|
30
|
+
highlighted
|
|
31
|
+
badge="Most Popular"
|
|
32
|
+
ctaLabel="Start free trial"
|
|
33
|
+
/>
|
|
34
|
+
```
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Popover
|
|
2
|
+
|
|
3
|
+
Floating content panel anchored to a trigger element.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Overlays · Status: stable
|
|
6
|
+
- Import: `import { Popover } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/popover
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `Popover.Root` | `compound` | | Root provider that manages open/close state. |
|
|
14
|
+
| `Popover.Trigger` | `compound` | | Element that toggles the popover on click. |
|
|
15
|
+
| `Popover.Content` | `compound` | | The floating content panel. |
|
|
16
|
+
| `Popover.Arrow` | `compound` | | Optional arrow pointing to the trigger. |
|
|
17
|
+
| `Popover.Close` | `compound` | | Button that closes the popover. |
|
|
18
|
+
| `side` | `'top' \| 'right' \| 'bottom' \| 'left'` | | Preferred side of the trigger to render the content. |
|
|
19
|
+
| `align` | `'start' \| 'center' \| 'end'` | | Alignment of the content relative to the trigger. |
|
|
20
|
+
| `sideOffset` | `number` | | Distance in pixels between the trigger and the content. |
|
|
21
|
+
| `surface` | `'solid' \| 'glass'` | `'solid'` | Glass material on Popover.Content — see Foundations → Materials. |
|
|
22
|
+
|
|
23
|
+
## Example: Default
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
<Popover.Root>
|
|
27
|
+
<Popover.Trigger asChild>
|
|
28
|
+
<Button variant="outline">Open popover</Button>
|
|
29
|
+
</Popover.Trigger>
|
|
30
|
+
<Popover.Content>
|
|
31
|
+
<Text size="body-sm">Popover content goes here.</Text>
|
|
32
|
+
</Popover.Content>
|
|
33
|
+
</Popover.Root>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Example: With close button
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<Popover.Root>
|
|
40
|
+
<Popover.Trigger asChild>
|
|
41
|
+
<Button variant="outline">Settings</Button>
|
|
42
|
+
</Popover.Trigger>
|
|
43
|
+
<Popover.Content side="bottom" align="end" sideOffset={8}>
|
|
44
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
|
45
|
+
<Text weight="semibold">Preferences</Text>
|
|
46
|
+
<Text size="body-sm" tone="secondary">Adjust your display settings.</Text>
|
|
47
|
+
<Popover.Close asChild>
|
|
48
|
+
<Button variant="ghost" size="sm">Close</Button>
|
|
49
|
+
</Popover.Close>
|
|
50
|
+
</div>
|
|
51
|
+
</Popover.Content>
|
|
52
|
+
</Popover.Root>
|
|
53
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Progress
|
|
2
|
+
|
|
3
|
+
Horizontal progress bar with optional tone and animation.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Loading States · Status: stable
|
|
6
|
+
- Import: `import { Progress } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/progress
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `value` | `number` | | Current progress value between 0 and max. |
|
|
14
|
+
| `max` | `number` | `100` | Maximum value of the progress bar. |
|
|
15
|
+
| `tone` | `'neutral' \| 'info' \| 'success' \| 'warning' \| 'danger'` | | Semantic colour tone of the filled track. |
|
|
16
|
+
| `animated` | `boolean` | `false` | Adds a stripes-in-motion animation to the filled track. |
|
|
17
|
+
|
|
18
|
+
## Example: Default
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
<Progress value={65} />
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Example: Tones
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
28
|
+
<Progress value={80} tone="info" />
|
|
29
|
+
<Progress value={60} tone="success" />
|
|
30
|
+
<Progress value={45} tone="warning" />
|
|
31
|
+
<Progress value={30} tone="danger" />
|
|
32
|
+
</div>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Example: Animated
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<Progress value={40} animated tone="info" />
|
|
39
|
+
```
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Prompt Input
|
|
2
|
+
|
|
3
|
+
The composer for a chat: an auto-growing text field with Send, which turns into Stop while a reply streams.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: AI · Status: beta
|
|
6
|
+
- Import: `import { PromptInput } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/prompt-input
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
|
|
11
|
+
- The message box of a chat or assistant.
|
|
12
|
+
- Any free-text prompt that starts a long-running, stoppable generation.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
|
|
16
|
+
- Ordinary forms: use Textarea, where Enter adds a line.
|
|
17
|
+
- Search: use SearchInput.
|
|
18
|
+
|
|
19
|
+
## Props
|
|
20
|
+
|
|
21
|
+
| Prop | Type | Default | Description |
|
|
22
|
+
| --- | --- | --- | --- |
|
|
23
|
+
| `value / defaultValue / onValueChange` | `string` | | Controlled or uncontrolled text. Uncontrolled input clears itself after a submit. |
|
|
24
|
+
| `onSubmit` | `(value: string) => void` | | Called with the text on Enter or Send. Not called while empty, disabled or not `idle`. |
|
|
25
|
+
| `onStop` | `() => void` | | Called by Stop, or Escape in the field, while `status="streaming"`. |
|
|
26
|
+
| `status` | `'idle' \| 'submitting' \| 'streaming'` | `'idle'` | `streaming` swaps Send for Stop; `submitting` holds Send until the request is accepted. |
|
|
27
|
+
| `maxRows` | `number` | `8` | Rows the field grows to before it scrolls. |
|
|
28
|
+
| `attachments` | `ReactNode` | | Rendered above the text, e.g. removable Chips. |
|
|
29
|
+
| `actions` | `ReactNode` | | Rendered bottom-start, e.g. an attach IconButton or a model picker. |
|
|
30
|
+
| `surface` | `'solid' \| 'glass'` | `'solid'` | Glass material for composers floating over content. |
|
|
31
|
+
| `label` | `string` | `messages.promptLabel ('Message')` | Accessible name of the text field. |
|
|
32
|
+
| `messages` | `Partial<PromptInputMessages>` | | Local overrides for `promptLabel`, `sendMessage`, `stopGenerating`, `promptHint`. |
|
|
33
|
+
| `textareaClassName` | `string` | | Class for the textarea; `className` goes to the outer container. |
|
|
34
|
+
|
|
35
|
+
## Example: Default
|
|
36
|
+
|
|
37
|
+
Enter sends, Shift+Enter adds a line. Send stays inert until there is text.
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
<PromptInput placeholder="Ask anything" onSubmit={(text) => send(text)} />
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Example: Attachments and actions
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
<PromptInput
|
|
47
|
+
placeholder="Ask about these files"
|
|
48
|
+
attachments={
|
|
49
|
+
<>
|
|
50
|
+
<Chip onRemove={() => remove('q3-report.pdf')}>q3-report.pdf</Chip>
|
|
51
|
+
<Chip onRemove={() => remove('pricing.csv')}>pricing.csv</Chip>
|
|
52
|
+
</>
|
|
53
|
+
}
|
|
54
|
+
actions={
|
|
55
|
+
<>
|
|
56
|
+
<IconButton size="sm" label="Attach files"><Paperclip /></IconButton>
|
|
57
|
+
<IconButton size="sm" label="Search the web"><Globe /></IconButton>
|
|
58
|
+
</>
|
|
59
|
+
}
|
|
60
|
+
/>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Example: Streaming
|
|
64
|
+
|
|
65
|
+
Send a message: the button turns into Stop for three seconds. Stop or Escape ends it early.
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
const [status, setStatus] = React.useState<PromptInputStatus>('idle');
|
|
69
|
+
const timer = React.useRef<ReturnType<typeof setTimeout>>();
|
|
70
|
+
|
|
71
|
+
function send() {
|
|
72
|
+
setStatus('streaming');
|
|
73
|
+
timer.current = setTimeout(() => setStatus('idle'), 3000);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function stop() {
|
|
77
|
+
clearTimeout(timer.current);
|
|
78
|
+
setStatus('idle');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
<PromptInput placeholder="Ask anything" status={status} onSubmit={send} onStop={stop} />
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Accessibility
|
|
85
|
+
|
|
86
|
+
- Roles: textbox (multiline), button (Send / Stop)
|
|
87
|
+
- `Enter`: Sends. Ignored while an IME composition is open.
|
|
88
|
+
- `Shift + Enter`: New line.
|
|
89
|
+
- `Escape`: Stops the reply while streaming.
|
|
90
|
+
- Focus stays in the field after sending, so the user can type the next message straight away.
|
|
91
|
+
- An empty field keeps Send focusable with `aria-disabled`, rather than removing it from the tab order.
|
|
92
|
+
- The field is named by `label` (default "Message") and described by the Enter/Shift+Enter hint.
|
|
93
|
+
- Send and Stop are icon buttons with their own names; the swap does not move focus.
|
|
94
|
+
|
|
95
|
+
Related: [message-bubble](message-bubble.md), [conversation](conversation.md), [textarea](textarea.md)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Radio Card
|
|
2
|
+
|
|
3
|
+
A radio group where each option is a whole card: title, description and optional icon, one choice.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Form Controls · Status: beta
|
|
6
|
+
- Import: `import { RadioCard } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/radio-card
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
|
|
11
|
+
- Two to six options that each need a sentence of explanation, like plans or regions.
|
|
12
|
+
- A choice important enough to deserve the space.
|
|
13
|
+
|
|
14
|
+
## When not to use
|
|
15
|
+
|
|
16
|
+
- Short labels with no description: use RadioGroup.
|
|
17
|
+
- More than six options: use Select or Combobox.
|
|
18
|
+
- Cards that hold links or buttons: the whole card is the control, so use Card with CardLink.
|
|
19
|
+
|
|
20
|
+
## Props
|
|
21
|
+
|
|
22
|
+
| Prop | Type | Default | Description |
|
|
23
|
+
| --- | --- | --- | --- |
|
|
24
|
+
| `RadioCardGroup columns` | `1 \| 2 \| 3 \| 4` | `1` | Grid columns. Collapses to one column on narrow screens. |
|
|
25
|
+
| `RadioCardGroup value / defaultValue / onValueChange` | `string` | | Radix RadioGroup props; the group also takes `disabled`, `name`, `required`. |
|
|
26
|
+
| `value` (required) | `string` | | The option this card selects. |
|
|
27
|
+
| `title` (required) | `ReactNode` | | The card’s accessible name. |
|
|
28
|
+
| `description` | `ReactNode` | | Secondary text, exposed as the accessible description. |
|
|
29
|
+
| `icon` | `ReactNode` | | Leading icon. Turns primary when selected. |
|
|
30
|
+
| `children` | `ReactNode` | | Extra content under the description. Keep it non-interactive: the whole card is the control. |
|
|
31
|
+
| `disabled` | `boolean` | `false` | Disables this card only. |
|
|
32
|
+
|
|
33
|
+
## Example: Plan picker
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
const [plan, setPlan] = React.useState('team');
|
|
37
|
+
|
|
38
|
+
<RadioCardGroup aria-label="Plan" columns={3} value={plan} onValueChange={setPlan}>
|
|
39
|
+
<RadioCard value="solo" icon={<User />} title="Solo" description="One seat, core features.">
|
|
40
|
+
<span className="text-sm font-medium">$0 / month</span>
|
|
41
|
+
</RadioCard>
|
|
42
|
+
<RadioCard value="team" icon={<Users />} title="Team" description="Up to 20 seats, shared workspaces.">
|
|
43
|
+
<span className="text-sm font-medium">$12 / seat</span>
|
|
44
|
+
</RadioCard>
|
|
45
|
+
<RadioCard value="enterprise" icon={<Building2 />} title="Enterprise" description="SSO, audit logs, priority support.">
|
|
46
|
+
<span className="text-sm font-medium">Contact sales</span>
|
|
47
|
+
</RadioCard>
|
|
48
|
+
</RadioCardGroup>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Example: Columns
|
|
52
|
+
|
|
53
|
+
Two columns from the sm breakpoint up, one below.
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
<RadioCardGroup aria-label="Billing" columns={2} defaultValue="yearly">
|
|
57
|
+
<RadioCard value="monthly" title="Monthly" description="Billed every month." />
|
|
58
|
+
<RadioCard value="yearly" title="Yearly" description="Two months free." />
|
|
59
|
+
</RadioCardGroup>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Example: Disabled
|
|
63
|
+
|
|
64
|
+
Disable one card, or pass `disabled` to the group to disable all of them.
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
<RadioCardGroup aria-label="Region" columns={2} defaultValue="eu">
|
|
68
|
+
<RadioCard value="eu" title="Europe" description="Frankfurt" />
|
|
69
|
+
<RadioCard value="us" title="United States" description="Virginia" />
|
|
70
|
+
<RadioCard value="ap" title="Asia Pacific" description="Coming soon" disabled />
|
|
71
|
+
</RadioCardGroup>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Accessibility
|
|
75
|
+
|
|
76
|
+
- Roles: radiogroup, radio (each card)
|
|
77
|
+
- `Tab`: Moves focus into the group, to the selected card.
|
|
78
|
+
- `Arrow keys`: Move between cards and select.
|
|
79
|
+
- `Space`: Selects the focused card.
|
|
80
|
+
- The title is the accessible name and the description is the accessible description.
|
|
81
|
+
- Give the group an `aria-label` or `aria-labelledby`.
|
|
82
|
+
|
|
83
|
+
Related: [radio-group](radio-group.md), [checkbox-card](checkbox-card.md), [card](card.md)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Radio Group
|
|
2
|
+
|
|
3
|
+
Group of mutually exclusive radio inputs.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Form Controls · Status: stable
|
|
6
|
+
- Import: `import { RadioGroup } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/radio-group
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `RadioGroup.Root` | `compound` | | Root provider that manages selection state. |
|
|
14
|
+
| `RadioGroup.Item` | `compound` | | Individual radio option within the group. |
|
|
15
|
+
| `value` | `string` | | The controlled selected value. |
|
|
16
|
+
| `defaultValue` | `string` | | The initial selected value when uncontrolled. |
|
|
17
|
+
| `onValueChange` | `(value: string) => void` | | Callback fired when the selection changes. |
|
|
18
|
+
| `disabled` | `boolean` | | Disables all items in the group. |
|
|
19
|
+
| `orientation` | `'horizontal' \| 'vertical'` | | Layout orientation of the radio items. |
|
|
20
|
+
|
|
21
|
+
## Example: Default
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
<RadioGroup.Root defaultValue="option-2">
|
|
25
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
|
26
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
27
|
+
<RadioGroup.Item value="option-1" id="r1" />
|
|
28
|
+
<Label htmlFor="r1">Option one</Label>
|
|
29
|
+
</div>
|
|
30
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
31
|
+
<RadioGroup.Item value="option-2" id="r2" />
|
|
32
|
+
<Label htmlFor="r2">Option two</Label>
|
|
33
|
+
</div>
|
|
34
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
35
|
+
<RadioGroup.Item value="option-3" id="r3" />
|
|
36
|
+
<Label htmlFor="r3">Option three</Label>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</RadioGroup.Root>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Example: Horizontal
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
<RadioGroup.Root defaultValue="monthly" orientation="horizontal">
|
|
46
|
+
<div style={{ display: 'flex', gap: '16px' }}>
|
|
47
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
48
|
+
<RadioGroup.Item value="monthly" id="monthly" />
|
|
49
|
+
<Label htmlFor="monthly">Monthly</Label>
|
|
50
|
+
</div>
|
|
51
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
52
|
+
<RadioGroup.Item value="annual" id="annual" />
|
|
53
|
+
<Label htmlFor="annual">Annual</Label>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</RadioGroup.Root>
|
|
57
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Rating
|
|
2
|
+
|
|
3
|
+
Star rating input, supports controlled and read-only modes.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Interactive · Status: stable
|
|
6
|
+
- Import: `import { Rating } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/rating
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `value` | `number` | | The controlled rating value. |
|
|
14
|
+
| `max` | `number` | `5` | Maximum number of stars. |
|
|
15
|
+
| `readOnly` | `boolean` | `false` | Prevents user interaction when true. |
|
|
16
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | | Size of the star icons. |
|
|
17
|
+
| `onValueChange` | `(value: number) => void` | | Callback fired when the user selects a new rating. |
|
|
18
|
+
|
|
19
|
+
## Example: Default
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
<Rating defaultValue={3} />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Example: Read-only
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
<Rating value={4} readOnly />
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Example: Sizes
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
35
|
+
<Rating defaultValue={3} size="sm" />
|
|
36
|
+
<Rating defaultValue={3} size="md" />
|
|
37
|
+
<Rating defaultValue={3} size="lg" />
|
|
38
|
+
</div>
|
|
39
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Scroll Area
|
|
2
|
+
|
|
3
|
+
Scrollable container with custom styled scrollbars.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Disclosure · Status: stable
|
|
6
|
+
- Import: `import { ScrollArea } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/scroll-area
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `type` | `'auto' \| 'always' \| 'scroll' \| 'hover'` | `'hover'` | Controls when the scrollbar is visible. "hover" shows it on mouse-over, "scroll" while scrolling, "always" always, "auto" when content overflows. |
|
|
14
|
+
| `scrollHideDelay` | `number` | `600` | Milliseconds before the scrollbar hides after the user stops interacting (only applies to types "scroll" and "hover"). |
|
|
15
|
+
| `orientation` | `'vertical' \| 'horizontal' \| 'both'` | `'vertical'` | Which axis(es) to make scrollable. |
|
|
16
|
+
| `className` | `string` | | Additional CSS class names applied to the viewport wrapper. |
|
|
17
|
+
| `style` | `React.CSSProperties` | | Inline styles applied to the viewport wrapper. |
|
|
18
|
+
|
|
19
|
+
## Example: Default
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
<ScrollArea style={{ height: '200px', width: '280px', border: '1px solid var(--color-border-default)', borderRadius: 'var(--radius-md)', padding: '12px' }}>
|
|
23
|
+
{Array.from({ length: 20 }, (_, i) => (
|
|
24
|
+
<div key={i} style={{ padding: '4px 0', fontSize: '0.875rem', color: 'var(--color-text-secondary)' }}>
|
|
25
|
+
Item {i + 1}
|
|
26
|
+
</div>
|
|
27
|
+
))}
|
|
28
|
+
</ScrollArea>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Example: Horizontal
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
<ScrollArea orientation="horizontal" style={{ width: '320px', border: '1px solid var(--color-border-default)', borderRadius: 'var(--radius-md)', padding: '12px' }}>
|
|
35
|
+
<div style={{ display: 'flex', gap: '8px', width: 'max-content' }}>
|
|
36
|
+
{Array.from({ length: 12 }, (_, i) => (
|
|
37
|
+
<div
|
|
38
|
+
key={i}
|
|
39
|
+
style={{
|
|
40
|
+
width: '80px',
|
|
41
|
+
height: '80px',
|
|
42
|
+
background: 'var(--color-bg-subtle)',
|
|
43
|
+
borderRadius: 'var(--radius-sm)',
|
|
44
|
+
display: 'flex',
|
|
45
|
+
alignItems: 'center',
|
|
46
|
+
justifyContent: 'center',
|
|
47
|
+
fontSize: '0.75rem',
|
|
48
|
+
color: 'var(--color-text-secondary)',
|
|
49
|
+
flexShrink: 0,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
Card {i + 1}
|
|
53
|
+
</div>
|
|
54
|
+
))}
|
|
55
|
+
</div>
|
|
56
|
+
</ScrollArea>
|
|
57
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Search Input
|
|
2
|
+
|
|
3
|
+
A text input pre-wired with a search icon and a clear button for filtering content.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Form & Input · Status: stable
|
|
6
|
+
- Import: `import { SearchInput } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/search-input
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `placeholder` | `string` | | Placeholder text shown when empty. |
|
|
14
|
+
| `value` | `string` | | Controlled value of the search field. |
|
|
15
|
+
| `onClear` | `() => void` | | Called when the user clicks the clear button. |
|
|
16
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | | Controls font size and padding. |
|
|
17
|
+
|
|
18
|
+
## Example: Default
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
<SearchInput placeholder="Search…" />
|
|
22
|
+
```
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Segmented Control
|
|
2
|
+
|
|
3
|
+
Tab-style control for mutually exclusive selections.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Interactive · Status: stable
|
|
6
|
+
- Import: `import { SegmentedControl } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/segmented-control
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Size of the segmented control. |
|
|
14
|
+
| `value` | `string` | | The controlled selected value. |
|
|
15
|
+
| `defaultValue` | `string` | | The initial selected value when uncontrolled. |
|
|
16
|
+
|
|
17
|
+
## Example: Default
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
<SegmentedControl.Root defaultValue="month">
|
|
21
|
+
<SegmentedControl.Item value="day">Day</SegmentedControl.Item>
|
|
22
|
+
<SegmentedControl.Item value="week">Week</SegmentedControl.Item>
|
|
23
|
+
<SegmentedControl.Item value="month">Month</SegmentedControl.Item>
|
|
24
|
+
</SegmentedControl.Root>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Example: Sizes
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
31
|
+
<SegmentedControl.Root defaultValue="b" size="sm">
|
|
32
|
+
<SegmentedControl.Item value="a">Small A</SegmentedControl.Item>
|
|
33
|
+
<SegmentedControl.Item value="b">Small B</SegmentedControl.Item>
|
|
34
|
+
</SegmentedControl.Root>
|
|
35
|
+
<SegmentedControl.Root defaultValue="b" size="md">
|
|
36
|
+
<SegmentedControl.Item value="a">Medium A</SegmentedControl.Item>
|
|
37
|
+
<SegmentedControl.Item value="b">Medium B</SegmentedControl.Item>
|
|
38
|
+
</SegmentedControl.Root>
|
|
39
|
+
<SegmentedControl.Root defaultValue="b" size="lg">
|
|
40
|
+
<SegmentedControl.Item value="a">Large A</SegmentedControl.Item>
|
|
41
|
+
<SegmentedControl.Item value="b">Large B</SegmentedControl.Item>
|
|
42
|
+
</SegmentedControl.Root>
|
|
43
|
+
</div>
|
|
44
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Select
|
|
2
|
+
|
|
3
|
+
Accessible dropdown select built on Radix UI. Supports groups and search.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Form Controls · Status: stable
|
|
6
|
+
- Import: `import { Select } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/select
|
|
8
|
+
|
|
9
|
+
## When to use
|
|
10
|
+
|
|
11
|
+
- Choosing a single option from a list of 5+ items
|
|
12
|
+
- When screen space is limited and a dropdown collapses the options
|
|
13
|
+
- Selecting a region, country, currency, or other enumerated value
|
|
14
|
+
- Filtering or configuring a setting with predefined choices
|
|
15
|
+
|
|
16
|
+
## When not to use
|
|
17
|
+
|
|
18
|
+
- Fewer than 5 options — use RadioGroup to keep choices visible
|
|
19
|
+
- Searching or typing to find an option — use Combobox instead
|
|
20
|
+
- Multi-select — use Combobox or a checkbox list
|
|
21
|
+
- Boolean on/off choices — use Switch or Checkbox
|
|
22
|
+
|
|
23
|
+
## Props
|
|
24
|
+
|
|
25
|
+
| Prop | Type | Default | Description |
|
|
26
|
+
| --- | --- | --- | --- |
|
|
27
|
+
| `value` | `string` | | Controlled selected value. |
|
|
28
|
+
| `onValueChange` | `(value: string) => void` | | Callback when value changes. |
|
|
29
|
+
| `placeholder` | `string` | | Placeholder when no value selected. |
|
|
30
|
+
| `disabled` | `boolean` | `false` | Disables the select. |
|
|
31
|
+
|
|
32
|
+
## Example: Default
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
<Select.Root>
|
|
36
|
+
<Select.Trigger placeholder="Pick a fruit" />
|
|
37
|
+
<Select.Content>
|
|
38
|
+
<Select.Item value="apple">Apple</Select.Item>
|
|
39
|
+
<Select.Item value="banana">Banana</Select.Item>
|
|
40
|
+
<Select.Item value="cherry">Cherry</Select.Item>
|
|
41
|
+
</Select.Content>
|
|
42
|
+
</Select.Root>
|
|
43
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Separator
|
|
2
|
+
|
|
3
|
+
A horizontal or vertical visual divider.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/react` · Category: Dividers · Status: stable
|
|
6
|
+
- Import: `import { Separator } from '@nexub/react';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/components/separator
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `orientation` | `'horizontal' \| 'vertical'` | `'horizontal'` | Direction of the separator line. |
|
|
14
|
+
| `decorative` | `boolean` | `true` | When true, the separator is hidden from the accessibility tree. |
|
|
15
|
+
|
|
16
|
+
## Example: Default
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
<Separator />
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Example: Vertical
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
<div style={{ display: 'flex', height: '32px', alignItems: 'center', gap: '16px' }}>
|
|
26
|
+
<span>Left</span>
|
|
27
|
+
<Separator orientation="vertical" />
|
|
28
|
+
<span>Right</span>
|
|
29
|
+
</div>
|
|
30
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# SettingsSection
|
|
2
|
+
|
|
3
|
+
Grouped settings panel with title, description, and action area.
|
|
4
|
+
|
|
5
|
+
- Package: `@nexub/patterns` · Category: Layout · Status: stable
|
|
6
|
+
- Import: `import { SettingsSection } from '@nexub/patterns';`
|
|
7
|
+
- Docs: https://nexub-ds-docs.pages.dev/patterns/settings-section
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `title` (required) | `string` | | Section heading. |
|
|
14
|
+
| `description` | `string` | | Supporting description for the section. |
|
|
15
|
+
| `children` (required) | `React.ReactNode` | | Settings controls. |
|
|
16
|
+
| `action` | `React.ReactNode` | | Primary action (e.g. save button). |
|
|
17
|
+
|
|
18
|
+
## Example: Default
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
<SettingsSection
|
|
22
|
+
title="Profile"
|
|
23
|
+
description="Update your personal information."
|
|
24
|
+
action={<Button size="sm">Save changes</Button>}
|
|
25
|
+
>
|
|
26
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px', maxWidth: '400px' }}>
|
|
27
|
+
<Input placeholder="Display name" />
|
|
28
|
+
<Input placeholder="Email address" type="email" />
|
|
29
|
+
</div>
|
|
30
|
+
</SettingsSection>
|
|
31
|
+
```
|