@7onic-ui/tokens 0.2.4 → 0.2.6
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/llms.txt +247 -1993
- package/package.json +1 -1
package/llms.txt
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
# 7onic Design System — AI Guide (
|
|
1
|
+
# 7onic Design System — AI Guide (Tokens)
|
|
2
2
|
|
|
3
3
|
## What is 7onic?
|
|
4
4
|
|
|
5
|
-
Token-driven
|
|
6
|
-
|
|
5
|
+
Token-driven design system. Single source of truth — design tokens to code.
|
|
6
|
+
Use the token system to style any project with consistent colors, spacing, typography, and more.
|
|
7
7
|
|
|
8
8
|
- Documentation: https://7onic.design
|
|
9
|
-
- npm: `@7onic-ui/
|
|
10
|
-
- For tokens
|
|
9
|
+
- npm: `@7onic-ui/tokens` (design tokens)
|
|
10
|
+
- For components + tokens guide, see: https://7onic.design/llms-full.txt
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
# ═══ SECTION 1: PROJECT SETUP
|
|
14
|
+
# ═══ SECTION 1: PROJECT SETUP ═══
|
|
15
15
|
|
|
16
16
|
## How to Start
|
|
17
17
|
|
|
@@ -23,19 +23,18 @@ Before writing any code, present this checklist and wait for answers:
|
|
|
23
23
|
2. **Dark mode** — Yes or no?
|
|
24
24
|
3. **Font** — Use default, or custom font? If custom, which font?
|
|
25
25
|
4. **Locale** — Which language(s)? (for CJK font loading)
|
|
26
|
-
5. **What are you building?** — Describe the project
|
|
27
26
|
|
|
28
|
-
**If the user answers in natural language
|
|
27
|
+
**If the user answers in natural language**, extract the answers. **If any item is missing, ask a follow-up question for the missing items only.** Do not proceed until all 4 items are answered.
|
|
29
28
|
|
|
30
29
|
### Step 2: Execute full setup (all at once, do not skip any)
|
|
31
30
|
|
|
32
31
|
After receiving answers, execute ALL of the following in order. Every step is mandatory.
|
|
33
32
|
|
|
34
|
-
**2-1. Install
|
|
33
|
+
**2-1. Install package (skip if already installed):**
|
|
35
34
|
```bash
|
|
36
|
-
npm install @7onic-ui/
|
|
35
|
+
npm install @7onic-ui/tokens
|
|
37
36
|
```
|
|
38
|
-
> Check package.json first. If
|
|
37
|
+
> Check package.json first. If already listed in dependencies, skip this step.
|
|
39
38
|
|
|
40
39
|
**2-2. Create or update globals.css with token imports:**
|
|
41
40
|
|
|
@@ -53,11 +52,11 @@ npm install @7onic-ui/react @7onic-ui/tokens lucide-react
|
|
|
53
52
|
@import "@7onic-ui/tokens/tailwind/v4-theme.css";
|
|
54
53
|
```
|
|
55
54
|
|
|
56
|
-
> **Vite + Tailwind v4**:
|
|
55
|
+
> **Vite + Tailwind v4**: `npx 7onic init` auto-injects `@import "tailwindcss"` if not present, and automatically configures the `@/` path alias (`tsconfig.app.json` + `vite.config.ts`). No manual CSS or alias setup needed.
|
|
57
56
|
|
|
58
57
|
**Existing project with Tailwind v3** (detect from tailwind.config.js):
|
|
59
58
|
```css
|
|
60
|
-
/* globals.css */
|
|
59
|
+
/* globals.css — @import must come BEFORE @tailwind directives */
|
|
61
60
|
@import '@7onic-ui/tokens/css/variables.css';
|
|
62
61
|
@import '@7onic-ui/tokens/css/themes/light.css';
|
|
63
62
|
@import '@7onic-ui/tokens/css/themes/dark.css'; /* omit ONLY if dark mode = no */
|
|
@@ -70,10 +69,7 @@ npm install @7onic-ui/react @7onic-ui/tokens lucide-react
|
|
|
70
69
|
const preset = require('@7onic-ui/tokens/tailwind/v3-preset')
|
|
71
70
|
module.exports = {
|
|
72
71
|
presets: [preset],
|
|
73
|
-
content: [
|
|
74
|
-
'./src/**/*.{js,ts,jsx,tsx}',
|
|
75
|
-
'./node_modules/@7onic-ui/react/dist/**/*.{js,mjs}',
|
|
76
|
-
],
|
|
72
|
+
content: ['./src/**/*.{js,ts,jsx,tsx}'],
|
|
77
73
|
}
|
|
78
74
|
```
|
|
79
75
|
|
|
@@ -85,15 +81,12 @@ module.exports = {
|
|
|
85
81
|
**2-4. Apply user's answers:**
|
|
86
82
|
|
|
87
83
|
- Dark mode = yes → implement dark mode toggle (see below)
|
|
88
|
-
- Custom font → load font
|
|
89
|
-
- **Next.js**: use `next/font/google`
|
|
90
|
-
- **Vite / Remix**: use Fontsource (`npm install @fontsource/inter`, then `import '@fontsource/inter/400.css'` in `src/main.tsx`) or Google Fonts CDN
|
|
91
|
-
- Then set `--font-family-sans` in CSS
|
|
84
|
+
- Custom font → load font (next/font for Next.js, CDN for Vite) + set `--font-family-sans`
|
|
92
85
|
- Locale includes Japanese → load Noto Sans JP font
|
|
93
86
|
- Locale includes Korean → load Noto Sans KR font
|
|
94
87
|
|
|
95
88
|
**2-5. Verify setup is complete before writing any UI code:**
|
|
96
|
-
- [ ]
|
|
89
|
+
- [ ] Package installed (@7onic-ui/tokens)
|
|
97
90
|
- [ ] globals.css has ALL required imports in correct order
|
|
98
91
|
- [ ] Body has `bg-background text-foreground`
|
|
99
92
|
- [ ] Dark mode toggle (if selected)
|
|
@@ -111,48 +104,28 @@ import { Search, Settings, ChevronDown, X } from 'lucide-react'
|
|
|
111
104
|
// ❌ Legacy alias — avoid
|
|
112
105
|
import { SearchIcon, SettingsIcon } from 'lucide-react'
|
|
113
106
|
|
|
114
|
-
// ⚠️ Name collision with
|
|
115
|
-
import { Badge } from '@7onic-ui/react'
|
|
107
|
+
// ⚠️ Name collision with your own component — use alias
|
|
116
108
|
import { Badge as BadgeIcon } from 'lucide-react'
|
|
117
109
|
```
|
|
118
110
|
|
|
119
|
-
### Step 3:
|
|
111
|
+
### Step 3: Start building
|
|
120
112
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
```tsx
|
|
124
|
-
import { Toaster } from '@7onic-ui/react'
|
|
125
|
-
|
|
126
|
-
// In your root layout (e.g., app/layout.tsx)
|
|
127
|
-
<body className="bg-background text-foreground">
|
|
128
|
-
{children}
|
|
129
|
-
<Toaster position="bottom-right" />
|
|
130
|
-
</body>
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### Step 4: Start building
|
|
134
|
-
|
|
135
|
-
Design freely based on user's project description. Always use 7onic components + tokens.
|
|
136
|
-
|
|
137
|
-
### Component Dependencies (auto-install during development)
|
|
138
|
-
|
|
139
|
-
| Component | Additional Package | When to install |
|
|
140
|
-
|---|---|---|
|
|
141
|
-
| Chart (Bar, Line, Area, Pie) | `recharts` | `npm install recharts` — import from `@7onic-ui/react/chart` (separate entry point) |
|
|
113
|
+
Use token classes for all styling. See Token Reference below.
|
|
142
114
|
|
|
143
115
|
---
|
|
144
116
|
|
|
145
|
-
|
|
117
|
+
# ═══ SECTION 2: AI RULES ═══
|
|
118
|
+
|
|
119
|
+
## ⛔ Core Principle
|
|
146
120
|
|
|
147
|
-
|
|
121
|
+
**Token values are user-defined.** Every project has different brand colors, spacing, and design decisions. The token NAMES are the API — never assume or hardcode specific values.
|
|
148
122
|
|
|
149
|
-
|
|
123
|
+
## Whitelist — ONLY These Are Allowed
|
|
150
124
|
|
|
151
|
-
|
|
125
|
+
When writing any code, you may ONLY use:
|
|
152
126
|
|
|
153
|
-
1. **
|
|
154
|
-
2. **
|
|
155
|
-
3. **Tailwind structural utilities** — layout, positioning, display, overflow, sizing, and more:
|
|
127
|
+
1. **Token classes** — colors, spacing, typography, radius, shadows, z-index, icon sizes, duration, easing, opacity, scale (listed in Token Reference below)
|
|
128
|
+
2. **Tailwind structural utilities** — layout, positioning, display, overflow, sizing, and more:
|
|
156
129
|
- Layout: flex, grid, block, inline, hidden, container
|
|
157
130
|
- Position: relative, absolute, fixed, sticky, top-0, inset-0
|
|
158
131
|
- Flex/Grid: items-center, justify-between, gap-4, col-span-2
|
|
@@ -169,84 +142,38 @@ Design freely based on user's project description. Always use 7onic components +
|
|
|
169
142
|
- ⚠️ Utilities that implicitly use color (divide, border) must be paired with a token color:
|
|
170
143
|
`divide-y divide-border` ✅ / `divide-y` alone ❌ (may not adapt to dark mode)
|
|
171
144
|
`border border-border` ✅ / `border` alone ❌
|
|
172
|
-
|
|
145
|
+
3. **Tailwind visual utilities using token values** — gradients, transforms, transitions:
|
|
173
146
|
- Gradient: bg-gradient-to-r, from-primary, to-secondary (token colors only)
|
|
174
147
|
- Transform: rotate-45, translate-x-1
|
|
175
148
|
- Transition: transition-all, transition-colors (with token durations)
|
|
176
149
|
- Backdrop: backdrop-blur, backdrop-blur-sm
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
150
|
+
4. **Responsive prefixes** — sm:, md:, lg:, xl:, 2xl: (on allowed classes only)
|
|
151
|
+
5. **State prefixes** — hover:, focus:, active:, disabled: (on allowed classes only, token values only)
|
|
152
|
+
6. **Layout dimension arbitrary values** — height and width ONLY: h-[300px], max-w-[1200px], min-h-screen (when no token fits)
|
|
153
|
+
7. **Opacity modifier** — append `/0-100` to any token color for transparency:
|
|
181
154
|
- `bg-primary/50`, `text-foreground/70`, `border-border/30`
|
|
182
155
|
- Do NOT use `opacity-*` utility as a workaround — it affects the entire element including children
|
|
183
156
|
- `bg-primary/10` ✅ (only background is transparent) / `bg-primary opacity-10` ❌ (children also become transparent)
|
|
184
157
|
|
|
185
|
-
9. **Token-first rule** — Before adding any Tailwind utility, check if the property is already included in a design token. Typography tokens (`text-sm`, `text-md`, etc.) include both font-size AND line-height as a pair. Do NOT override with Tailwind line-height utilities:
|
|
186
|
-
- `text-sm` ✅ (token provides font-size + line-height)
|
|
187
|
-
- `text-sm leading-relaxed` ❌ (overrides token line-height)
|
|
188
|
-
- `text-sm leading-none` ❌ (overrides token line-height)
|
|
189
|
-
- `text-sm leading-[18px]` ❌ (hardcodes line-height)
|
|
190
|
-
|
|
191
158
|
**Everything not in this list is FORBIDDEN.**
|
|
192
159
|
|
|
193
160
|
⚠️ **Gradient/visual utilities must use token colors only:** `from-primary to-secondary` ✅ / `from-blue-500 to-purple-600` ❌
|
|
194
161
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
```
|
|
198
|
-
Step 1: Does a 7onic component exist for this?
|
|
199
|
-
→ YES: Use the component. Style via Props (variant/size/color).
|
|
200
|
-
className ONLY for layout (margin, width, flex positioning).
|
|
201
|
-
→ NO: Step 2
|
|
202
|
-
|
|
203
|
-
Step 2: Is this a layout/structural element? (flex container, grid, section wrapper)
|
|
204
|
-
→ YES: Use div/section + token classes only.
|
|
205
|
-
→ NO: Step 3
|
|
206
|
-
|
|
207
|
-
Step 3: Re-check the 42 components. Most UI can be built with component combinations.
|
|
208
|
-
→ Still no match: Use div + token classes only.
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### ❌ Forbidden Patterns
|
|
212
|
-
|
|
213
|
-
```tsx
|
|
214
|
-
// ❌ HTML instead of components
|
|
215
|
-
<button className="bg-primary rounded-lg px-4 py-2"> → <Button>
|
|
216
|
-
<input className="border rounded-lg px-3 h-10"> → <Input>
|
|
217
|
-
<div className="border rounded-xl p-6 shadow-sm"> → <Card>
|
|
218
|
-
<table className="w-full"> → <Table>
|
|
219
|
-
|
|
220
|
-
// ❌ className overriding component styles
|
|
221
|
-
<Button className="bg-blue-500 text-white"> → <Button color="primary">
|
|
222
|
-
<Badge className="bg-red-100 text-red-700"> → <Badge color="error">
|
|
223
|
-
|
|
224
|
-
// ❌ Raw Tailwind colors
|
|
225
|
-
bg-blue-500, text-gray-700, bg-white, border-gray-200
|
|
226
|
-
|
|
227
|
-
// ❌ Dark mode prefix
|
|
228
|
-
dark:bg-gray-900, dark:text-white
|
|
229
|
-
|
|
230
|
-
// ❌ Arbitrary values (except layout dimensions)
|
|
231
|
-
p-[17px], text-[13px], rounded-[7px], z-[999]
|
|
232
|
-
|
|
233
|
-
// ❌ Inline styles
|
|
234
|
-
style={{ color: '#333', padding: '20px' }}
|
|
162
|
+
## ❌ Forbidden — Never Use These
|
|
235
163
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
### When User Requests Custom Values
|
|
164
|
+
| Category | Forbidden | Use Instead |
|
|
165
|
+
|---|---|---|
|
|
166
|
+
| Raw colors | `bg-blue-500`, `text-gray-700`, `bg-white` | `bg-primary`, `text-foreground`, `bg-background` |
|
|
167
|
+
| Dark prefix | `dark:bg-gray-900`, `dark:text-white` | Semantic tokens auto-adapt |
|
|
168
|
+
| Arbitrary values | `p-[17px]`, `text-[13px]`, `rounded-[7px]`, `z-[999]` | `p-4`, `text-sm`, `rounded-md`, `z-modal` |
|
|
169
|
+
| Icon sizing | `w-4 h-4`, `w-5 h-5` | `icon-sm`, `icon-md` |
|
|
170
|
+
| Raw durations | `duration-150`, `duration-200` | `duration-micro`, `duration-normal` |
|
|
171
|
+
| Raw shadows | `shadow-[0_2px_4px...]` | `shadow-sm` |
|
|
172
|
+
| Inline styles | `style={{ color: '#333' }}` | `className="text-foreground"` |
|
|
173
|
+
| @apply raw | `@apply bg-blue-500` | `@apply bg-primary` |
|
|
174
|
+
| Hardcoded hex | `#FF5733`, `rgb(51,51,51)` | Token classes |
|
|
175
|
+
|
|
176
|
+
## When User Requests Custom Values
|
|
250
177
|
|
|
251
178
|
If the user explicitly asks for a value outside the token system:
|
|
252
179
|
|
|
@@ -261,64 +188,22 @@ User: "Apply it"
|
|
|
261
188
|
AI: → Apply the custom value
|
|
262
189
|
```
|
|
263
190
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
| AI writing code on its own | Token system ONLY — never bypass |
|
|
269
|
-
|
|
270
|
-
### Third-Party Libraries
|
|
271
|
-
|
|
272
|
-
When a feature is needed that no 7onic component covers (map, video player, rich text editor, etc.):
|
|
273
|
-
|
|
274
|
-
- **Do NOT install any library without asking the user first**
|
|
275
|
-
- Ask: "Which library would you like to use for [feature]?"
|
|
276
|
-
- Install and use only after user's choice
|
|
277
|
-
|
|
278
|
-
### Token Customization Is the User's Responsibility
|
|
279
|
-
|
|
280
|
-
The token system covers all UI needs out of the box. As AI, use existing tokens only.
|
|
281
|
-
|
|
282
|
-
If the user needs custom values beyond existing tokens, they will handle it separately.
|
|
283
|
-
Customization guide: https://7onic.design/components/theming
|
|
284
|
-
|
|
285
|
-
**Never modify generated token files** — these are auto-generated from figma-tokens.json via sync-tokens. AI must never edit, add to, or delete from: `variables.css`, `light.css`, `dark.css`, `v3-preset.js`, `v4-theme.css`, `index.js`, `index.mjs`, `index.d.ts`, `tokens.json`
|
|
286
|
-
|
|
287
|
-
### Self-Check (after writing ANY code)
|
|
288
|
-
|
|
289
|
-
Before presenting code to the user, scan your own output for violations:
|
|
290
|
-
|
|
291
|
-
- [ ] Any raw color class? (`bg-blue-*`, `text-gray-*`, `bg-white`, `border-gray-*`)
|
|
292
|
-
- [ ] Any arbitrary value? (`p-[*]`, `text-[*]`, `rounded-[*]`, `z-[*]`)
|
|
293
|
-
- [ ] Any inline style? (`style={{ }}`)
|
|
294
|
-
- [ ] Any `dark:` prefix?
|
|
295
|
-
- [ ] Any `w-N h-N` for icons instead of `icon-*`?
|
|
296
|
-
- [ ] Any `<button>`, `<input>`, `<table>` instead of 7onic components?
|
|
297
|
-
- [ ] Any Radix direct import?
|
|
298
|
-
- [ ] Any className overriding component visual styles?
|
|
299
|
-
- [ ] Any `divide-*` or `border` without a token color? (`divide-y` alone → `divide-y divide-border`)
|
|
300
|
-
- [ ] Any `opacity-*` on element instead of color modifier? (`bg-primary opacity-10` → `bg-primary/10`)
|
|
301
|
-
|
|
302
|
-
**If ANY violation is found → fix it before showing code to the user.**
|
|
303
|
-
**Do NOT present code with violations. Fix first, then present.**
|
|
304
|
-
|
|
305
|
-
---
|
|
306
|
-
|
|
307
|
-
**When in doubt, check the documentation** — if component Props, token usage, or patterns are unclear, refer to the official docs before guessing:
|
|
308
|
-
- Component pages: `https://7onic.design/components/{name}` (e.g., `/components/button`, `/components/navigation-menu`)
|
|
309
|
-
- Token pages: `https://7onic.design/design-tokens/{name}` (e.g., `/design-tokens/colors`, `/design-tokens/spacing`)
|
|
310
|
-
- Do not guess — verify from documentation first
|
|
191
|
+
**Rule:**
|
|
192
|
+
- User request within token range → execute immediately
|
|
193
|
+
- User request outside token range → ask "custom value, bypass tokens?" → execute only after confirmation
|
|
194
|
+
- AI writing code on its own → token system ONLY, never bypass
|
|
311
195
|
|
|
312
196
|
---
|
|
313
197
|
|
|
314
|
-
## Dark Mode
|
|
198
|
+
## Dark Mode
|
|
315
199
|
|
|
316
|
-
Dark mode
|
|
200
|
+
Dark mode is **automatic** when using semantic tokens. No `dark:` prefix needed.
|
|
317
201
|
|
|
318
202
|
| ❌ NEVER | ✅ CORRECT |
|
|
319
203
|
|---|---|
|
|
320
204
|
| `bg-white dark:bg-gray-900` | `bg-background` |
|
|
321
205
|
| `text-gray-900 dark:text-gray-100` | `text-foreground` |
|
|
206
|
+
| `text-gray-500 dark:text-gray-400` | `text-muted` |
|
|
322
207
|
| `border-gray-200 dark:border-gray-700` | `border-border` |
|
|
323
208
|
|
|
324
209
|
### Dark Mode Toggle Implementation
|
|
@@ -342,1875 +227,244 @@ Strategy: `dark` class on `<html>` element.
|
|
|
342
227
|
|
|
343
228
|
---
|
|
344
229
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
> Token values depend on the user's project configuration. Never assume specific hex values.
|
|
348
|
-
|
|
349
|
-
**Semantic Colors (theme-aware):**
|
|
350
|
-
- Background: `background`, `background-paper`, `background-elevated`, `background-muted`
|
|
351
|
-
- Text: `foreground`, `text-muted`, `text-subtle`, `text-link`, `text-primary`
|
|
352
|
-
- Status text: `text-info`, `text-success`, `text-error`, `text-warning`
|
|
353
|
-
- Intent (×6): `{intent}`, `{intent}-hover`, `{intent}-active`, `{intent}-tint`, `{intent}-foreground` — where intent = primary, secondary, success, warning, error, info
|
|
354
|
-
- Border: `border`, `border-subtle`, `border-strong`
|
|
355
|
-
- State: `disabled`, `disabled-text`, `focus-ring`, `focus-ring-error`
|
|
356
|
-
|
|
357
|
-
**Spacing:** 0, 0.5(2px), 1(4px), 1.5(6px), 2(8px), 2.5(10px), 3(12px), 3.5(14px), 4(16px), 5(20px), 6(24px), 7(28px), 8(32px), 10(40px), 12(48px), 14(56px), 16(64px), 20(80px), 24(96px)
|
|
358
|
-
|
|
359
|
-
**Font:** `font-sans` (user-defined), `font-mono` (user-defined)
|
|
360
|
-
**Font Sizes:** text-2xs(11px), text-xs(12px), text-sm(13px), text-md(14px), text-base(16px), text-lg(18px), text-xl(20px), text-2xl(24px), text-3xl(30px), text-4xl(36px), text-5xl(48px)
|
|
361
|
-
**Font Weights:** font-normal(400), font-semibold(600), font-bold(700)
|
|
362
|
-
|
|
363
|
-
**Radius:** rounded-none(0), rounded-sm(2), rounded-base(4), rounded-md(6), rounded-lg(8), rounded-xl(12), rounded-2xl(16), rounded-3xl(24), rounded-full(9999)
|
|
364
|
-
|
|
365
|
-
**Shadows:** shadow-xs, shadow-sm, shadow-md, shadow-lg, shadow-xl
|
|
366
|
-
|
|
367
|
-
**Z-Index:** z-sticky(100), z-dropdown(1000), z-overlay(1100), z-modal(2000), z-popover(2100), z-tooltip(2200), z-toast(3000)
|
|
368
|
-
|
|
369
|
-
**Icon Sizes:** icon-2xs(12px), icon-xs(14px), icon-sm(16px), icon-md(20px), icon-lg(24px), icon-xl(32px)
|
|
370
|
-
|
|
371
|
-
**Duration:** duration-instant(0), duration-fast(100), duration-micro(150), duration-normal(200), duration-slow(300), duration-slower(400), duration-slowest(500), duration-spin(1000)
|
|
372
|
-
|
|
373
|
-
**Easing:** ease-linear, ease-ease, ease-ease-in, ease-ease-out, ease-ease-in-out
|
|
374
|
-
|
|
375
|
-
**Opacity:** opacity-0 to opacity-100 (5% increments)
|
|
376
|
-
|
|
377
|
-
**Scale:** scale-50, scale-75, scale-95, scale-pressed(0.98)
|
|
378
|
-
|
|
379
|
-
**Breakpoints:** sm(640), md(768), lg(1024), xl(1280), 2xl(1536)
|
|
380
|
-
|
|
381
|
-
For detailed token reference, see: https://7onic.design/llms.txt
|
|
382
|
-
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
# ═══ SECTION 2: COMPONENT IMPORT PATTERNS ═══
|
|
386
|
-
|
|
387
|
-
## Import
|
|
388
|
-
|
|
389
|
-
```tsx
|
|
390
|
-
// All components from single package
|
|
391
|
-
import { Button, Card, Input, Toast } from '@7onic-ui/react'
|
|
392
|
-
```
|
|
393
|
-
|
|
394
|
-
## Namespace Pattern (Compound Components)
|
|
395
|
-
|
|
396
|
-
21 compound components use namespace imports. Access sub-components via dot notation:
|
|
397
|
-
|
|
398
|
-
```tsx
|
|
399
|
-
import { Card } from '@7onic-ui/react'
|
|
400
|
-
|
|
401
|
-
// ✅ Namespace usage (preferred)
|
|
402
|
-
<Card>
|
|
403
|
-
<Card.Header>
|
|
404
|
-
<Card.Title>Title</Card.Title>
|
|
405
|
-
<Card.Description>Description</Card.Description>
|
|
406
|
-
</Card.Header>
|
|
407
|
-
<Card.Content>Content</Card.Content>
|
|
408
|
-
<Card.Footer>Footer</Card.Footer>
|
|
409
|
-
</Card>
|
|
410
|
-
|
|
411
|
-
// ✅ Named exports also work (backwards compatible)
|
|
412
|
-
import { Card, CardHeader, CardTitle, CardContent } from '@7onic-ui/react'
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
### Compound Components List (24)
|
|
416
|
-
|
|
417
|
-
Accordion, Alert, Avatar, Breadcrumb, Card, ChatInput, ChatMessage, Chart, Drawer, DropdownMenu, Field, MetricCard, Modal, NavigationMenu, Pagination, Popover, QuickReply, RadioGroup, Segmented, Select, Table, Tabs, ToggleGroup, Tooltip
|
|
418
|
-
|
|
419
|
-
### Standalone Components (16)
|
|
420
|
-
|
|
421
|
-
Badge, Button, ButtonGroup, Checkbox, Divider, IconButton, Input, Progress, Skeleton, Slider, Spinner, Switch, Textarea, Toast, Toggle, TypingIndicator
|
|
422
|
-
|
|
423
|
-
---
|
|
424
|
-
|
|
425
|
-
# ═══ SECTION 3: ALL COMPONENTS (42) ═══
|
|
426
|
-
|
|
427
|
-
---
|
|
428
|
-
|
|
429
|
-
## Forms
|
|
430
|
-
|
|
431
|
-
### Button
|
|
432
|
-
|
|
433
|
-
```tsx
|
|
434
|
-
import { Button } from '@7onic-ui/react'
|
|
435
|
-
|
|
436
|
-
<Button variant="solid" color="primary" size="default">Submit</Button>
|
|
437
|
-
<Button variant="outline" color="default" leftIcon={<Icon />}>Cancel</Button>
|
|
438
|
-
<Button loading>Processing...</Button>
|
|
439
|
-
<Button variant="link" color="primary">Learn more</Button>
|
|
440
|
-
```
|
|
441
|
-
|
|
442
|
-
| Prop | Type | Default | Description |
|
|
443
|
-
|---|---|---|---|
|
|
444
|
-
| variant | `'solid' \| 'outline' \| 'ghost' \| 'link'` | `'solid'` | Visual style |
|
|
445
|
-
| color | `'default' \| 'primary' \| 'secondary' \| 'destructive'` | `'default'` | Color scheme |
|
|
446
|
-
| size | `'xs' \| 'sm' \| 'md' \| 'default' \| 'lg'` | `'default'` | Height: 28/32/36/40/48px |
|
|
447
|
-
| radius | `'none' \| 'sm' \| 'base' \| 'default' \| 'lg' \| 'xl' \| '2xl' \| '3xl' \| 'full'` | `'default'` | Border radius |
|
|
448
|
-
| loading | `boolean` | `false` | Shows spinner, disables button |
|
|
449
|
-
| leftIcon | `ReactNode` | — | Icon before label |
|
|
450
|
-
| rightIcon | `ReactNode` | — | Icon after label |
|
|
451
|
-
| fullWidth | `boolean` | `false` | `w-full` |
|
|
452
|
-
| selected | `boolean` | — | Selected state (outline/ghost) |
|
|
453
|
-
| fontWeight | `'normal' \| 'semibold'` | per variant | Override font weight |
|
|
454
|
-
| pressEffect | `boolean` | `true` | Scale-down on press |
|
|
455
|
-
| asChild | `boolean` | `false` | Render as child element (Slot) |
|
|
456
|
-
| disabled | `boolean` | `false` | Disabled state |
|
|
457
|
-
|
|
458
|
-
**Icon sizing by button size:** xs/sm → icon-xs(14px), md/default/lg → icon-sm(16px)
|
|
459
|
-
|
|
460
|
-
---
|
|
461
|
-
|
|
462
|
-
### IconButton
|
|
463
|
-
|
|
464
|
-
```tsx
|
|
465
|
-
import { IconButton } from '@7onic-ui/react'
|
|
466
|
-
|
|
467
|
-
<IconButton variant="ghost" size="default" aria-label="Settings">
|
|
468
|
-
<SettingsIcon />
|
|
469
|
-
</IconButton>
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
| Prop | Type | Default | Description |
|
|
473
|
-
|---|---|---|---|
|
|
474
|
-
| variant | `'solid' \| 'outline' \| 'ghost' \| 'subtle'` | `'solid'` | Visual style |
|
|
475
|
-
| color | `'default' \| 'primary' \| 'secondary' \| 'destructive'` | `'default'` | Color scheme |
|
|
476
|
-
| size | `'xs' \| 'sm' \| 'md' \| 'default' \| 'lg'` | `'default'` | 28/32/36/40/48px (square) |
|
|
477
|
-
| radius | Same as Button | `'default'` | Border radius |
|
|
478
|
-
| loading | `boolean` | `false` | Shows spinner |
|
|
479
|
-
| pressEffect | `boolean` | `true` | Scale-down on press |
|
|
480
|
-
| asChild | `boolean` | `false` | Slot pattern |
|
|
481
|
-
|
|
482
|
-
**Icon sizing:** xs → icon-xs(14px), sm/md → icon-sm(16px), default → icon-md(20px), lg → icon-lg(24px)
|
|
483
|
-
**Always provide `aria-label`** — no visible text.
|
|
484
|
-
|
|
485
|
-
---
|
|
486
|
-
|
|
487
|
-
### ButtonGroup
|
|
488
|
-
|
|
489
|
-
```tsx
|
|
490
|
-
import { Button, ButtonGroup } from '@7onic-ui/react'
|
|
491
|
-
|
|
492
|
-
<ButtonGroup variant="outline" size="default" attached>
|
|
493
|
-
<Button>Left</Button>
|
|
494
|
-
<Button>Center</Button>
|
|
495
|
-
<Button>Right</Button>
|
|
496
|
-
</ButtonGroup>
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
| Prop | Type | Default | Description |
|
|
500
|
-
|---|---|---|---|
|
|
501
|
-
| variant | `'outline' \| 'ghost'` | — | Applied to all children |
|
|
502
|
-
| size | Button sizes | — | Applied to all children |
|
|
503
|
-
| radius | Button radius values | — | Applied to all children |
|
|
504
|
-
| fontWeight | `'normal' \| 'semibold'` | — | Applied to all children |
|
|
505
|
-
| orientation | `'horizontal' \| 'vertical'` | `'horizontal'` | Layout direction |
|
|
506
|
-
| attached | `boolean` | `false` | Overlapping borders |
|
|
507
|
-
| disabled | `boolean` | `false` | Disable all children |
|
|
508
|
-
|
|
509
|
-
Provides context — child Buttons inherit variant/size/radius automatically.
|
|
510
|
-
|
|
511
|
-
---
|
|
512
|
-
|
|
513
|
-
### Input
|
|
514
|
-
|
|
515
|
-
```tsx
|
|
516
|
-
import { Input } from '@7onic-ui/react'
|
|
517
|
-
|
|
518
|
-
<Input placeholder="Email" size="default" />
|
|
519
|
-
<Input variant="filled" leftIcon={<SearchIcon />} />
|
|
520
|
-
<Input error rightIcon={<AlertIcon />} />
|
|
521
|
-
```
|
|
522
|
-
|
|
523
|
-
| Prop | Type | Default | Description |
|
|
524
|
-
|---|---|---|---|
|
|
525
|
-
| variant | `'default' \| 'filled'` | `'default'` | Border or filled background |
|
|
526
|
-
| size | `'xs' \| 'sm' \| 'default' \| 'lg' \| 'xl'` | `'default'` | Height: 36/40/44/48/56px |
|
|
527
|
-
| radius | `'none' \| 'sm' \| 'base' \| 'default' \| 'lg' \| 'xl' \| '2xl' \| '3xl' \| 'full'` | `'default'` | Border radius |
|
|
528
|
-
| error | `boolean` | `false` | Error border state |
|
|
529
|
-
| focusRing | `boolean` | `false` | Explicit focus ring (vs keyboard-only) |
|
|
530
|
-
| leftIcon | `ReactNode` | — | Left icon |
|
|
531
|
-
| rightIcon | `ReactNode` | — | Right icon |
|
|
532
|
-
|
|
533
|
-
**Works with Field wrapper** for label, error, char count. See Field section.
|
|
534
|
-
|
|
535
|
-
---
|
|
536
|
-
|
|
537
|
-
### Textarea
|
|
538
|
-
|
|
539
|
-
```tsx
|
|
540
|
-
import { Textarea } from '@7onic-ui/react'
|
|
541
|
-
|
|
542
|
-
<Textarea placeholder="Message" rows={4} resize="vertical" />
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
| Prop | Type | Default | Description |
|
|
546
|
-
|---|---|---|---|
|
|
547
|
-
| variant | `'default' \| 'filled'` | `'default'` | Border or filled |
|
|
548
|
-
| size | `'compact' \| 'default'` | `'default'` | Padding density |
|
|
549
|
-
| radius | Same as Input | `'default'` | Border radius |
|
|
550
|
-
| resize | `'none' \| 'vertical' \| 'horizontal' \| 'both'` | `'vertical'` | Resize handle |
|
|
551
|
-
| error | `boolean` | `false` | Error state |
|
|
552
|
-
| focusRing | `boolean` | `false` | Explicit focus ring |
|
|
553
|
-
|
|
554
|
-
---
|
|
555
|
-
|
|
556
|
-
### Select
|
|
557
|
-
|
|
558
|
-
```tsx
|
|
559
|
-
import { Select } from '@7onic-ui/react'
|
|
560
|
-
|
|
561
|
-
<Select>
|
|
562
|
-
<Select.Trigger>
|
|
563
|
-
<Select.Value placeholder="Choose option" />
|
|
564
|
-
</Select.Trigger>
|
|
565
|
-
<Select.Content>
|
|
566
|
-
<Select.Item value="a">Option A</Select.Item>
|
|
567
|
-
<Select.Item value="b">Option B</Select.Item>
|
|
568
|
-
<Select.Group>
|
|
569
|
-
<Select.Label>Group</Select.Label>
|
|
570
|
-
<Select.Item value="c">Option C</Select.Item>
|
|
571
|
-
</Select.Group>
|
|
572
|
-
</Select.Content>
|
|
573
|
-
</Select>
|
|
574
|
-
```
|
|
575
|
-
|
|
576
|
-
| Prop (Root) | Type | Default | Description |
|
|
577
|
-
|---|---|---|---|
|
|
578
|
-
| size | `'xs' \| 'sm' \| 'default' \| 'lg' \| 'xl'` | `'default'` | Trigger height |
|
|
579
|
-
| radius | Same as Input | `'default'` | Border radius |
|
|
580
|
-
| value | `string` | — | Controlled value |
|
|
581
|
-
| defaultValue | `string` | — | Uncontrolled default |
|
|
582
|
-
| onValueChange | `(value: string) => void` | — | Change handler |
|
|
583
|
-
|
|
584
|
-
**Sub-components:** Select.Trigger, Select.Value, Select.Content, Select.Item, Select.Group, Select.Label, Select.Separator
|
|
585
|
-
|
|
586
|
-
---
|
|
587
|
-
|
|
588
|
-
### DropdownMenu
|
|
589
|
-
|
|
590
|
-
```tsx
|
|
591
|
-
import { DropdownMenu } from '@7onic-ui/react'
|
|
592
|
-
|
|
593
|
-
<DropdownMenu>
|
|
594
|
-
<DropdownMenu.Trigger asChild>
|
|
595
|
-
<Button variant="outline">Options</Button>
|
|
596
|
-
</DropdownMenu.Trigger>
|
|
597
|
-
<DropdownMenu.Content>
|
|
598
|
-
<DropdownMenu.Item>Edit</DropdownMenu.Item>
|
|
599
|
-
<DropdownMenu.Item>Duplicate</DropdownMenu.Item>
|
|
600
|
-
<DropdownMenu.Separator />
|
|
601
|
-
<DropdownMenu.Item className="text-error">Delete</DropdownMenu.Item>
|
|
602
|
-
</DropdownMenu.Content>
|
|
603
|
-
</DropdownMenu>
|
|
604
|
-
```
|
|
605
|
-
|
|
606
|
-
| Prop (Content) | Type | Default | Description |
|
|
607
|
-
|---|---|---|---|
|
|
608
|
-
| radius | `'md' \| 'lg' \| 'xl'` | `'lg'` | Border radius |
|
|
609
|
-
| size | `'sm' \| 'md' \| 'lg'` | `'md'` | Item density |
|
|
610
|
-
| flush | `boolean` | `false` | Full-width items (no padding) |
|
|
611
|
-
| sideOffset | `number` | `4` | Gap from trigger |
|
|
612
|
-
|
|
613
|
-
**Sub-components:** DropdownMenu.Trigger, DropdownMenu.Content, DropdownMenu.Item, DropdownMenu.CheckboxItem, DropdownMenu.RadioItem, DropdownMenu.Label, DropdownMenu.Separator, DropdownMenu.Group, DropdownMenu.Sub, DropdownMenu.SubTrigger, DropdownMenu.SubContent, DropdownMenu.Shortcut
|
|
614
|
-
|
|
615
|
-
---
|
|
616
|
-
|
|
617
|
-
### Checkbox
|
|
618
|
-
|
|
619
|
-
```tsx
|
|
620
|
-
import { Checkbox } from '@7onic-ui/react'
|
|
621
|
-
|
|
622
|
-
<Checkbox label="Accept terms" />
|
|
623
|
-
<Checkbox size="lg" color="primary" checked />
|
|
624
|
-
<Checkbox checked="indeterminate" />
|
|
625
|
-
```
|
|
626
|
-
|
|
627
|
-
| Prop | Type | Default | Description |
|
|
628
|
-
|---|---|---|---|
|
|
629
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Checkbox size |
|
|
630
|
-
| radius | `'none' \| 'sm' \| 'md'` | `'sm'` | Border radius |
|
|
631
|
-
| weight | `'thin' \| 'bold'` | `'bold'` | Checkmark thickness |
|
|
632
|
-
| color | `'default' \| 'primary'` | `'default'` | Checked color |
|
|
633
|
-
| label | `string` | — | Label text |
|
|
634
|
-
| checked | `boolean \| 'indeterminate'` | — | Controlled state |
|
|
635
|
-
| defaultChecked | `boolean` | — | Uncontrolled default |
|
|
636
|
-
| onCheckedChange | `(checked: boolean \| 'indeterminate') => void` | — | Change handler |
|
|
637
|
-
| disabled | `boolean` | `false` | Disabled state |
|
|
638
|
-
|
|
639
|
-
---
|
|
640
|
-
|
|
641
|
-
### RadioGroup
|
|
642
|
-
|
|
643
|
-
```tsx
|
|
644
|
-
import { RadioGroup } from '@7onic-ui/react'
|
|
645
|
-
|
|
646
|
-
<RadioGroup defaultValue="a">
|
|
647
|
-
<RadioGroup.Item value="a" label="Option A" />
|
|
648
|
-
<RadioGroup.Item value="b" label="Option B" />
|
|
649
|
-
<RadioGroup.Item value="c" label="Option C" disabled />
|
|
650
|
-
</RadioGroup>
|
|
651
|
-
```
|
|
652
|
-
|
|
653
|
-
| Prop (Root) | Type | Default | Description |
|
|
654
|
-
|---|---|---|---|
|
|
655
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Radio size |
|
|
656
|
-
| weight | `'thin' \| 'bold'` | `'bold'` | Indicator thickness |
|
|
657
|
-
| color | `'default' \| 'primary'` | `'default'` | Selected color |
|
|
658
|
-
| orientation | `'horizontal' \| 'vertical'` | `'vertical'` | Layout direction |
|
|
659
|
-
| value | `string` | — | Controlled value |
|
|
660
|
-
| defaultValue | `string` | — | Uncontrolled default |
|
|
661
|
-
| onValueChange | `(value: string) => void` | — | Change handler |
|
|
662
|
-
|
|
663
|
-
**Sub-components:** RadioGroup.Item (with `label` prop)
|
|
664
|
-
|
|
665
|
-
---
|
|
666
|
-
|
|
667
|
-
### Switch
|
|
668
|
-
|
|
669
|
-
```tsx
|
|
670
|
-
import { Switch } from '@7onic-ui/react'
|
|
671
|
-
|
|
672
|
-
<Switch label="Notifications" />
|
|
673
|
-
<Switch size="lg" color="primary" defaultChecked />
|
|
674
|
-
<Switch startLabel="Off" endLabel="On" />
|
|
675
|
-
```
|
|
676
|
-
|
|
677
|
-
| Prop | Type | Default | Description |
|
|
678
|
-
|---|---|---|---|
|
|
679
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Track size |
|
|
680
|
-
| color | `'default' \| 'primary' \| 'success' \| 'warning' \| 'error'` | `'default'` | Active track color |
|
|
681
|
-
| label | `string` | — | Label text |
|
|
682
|
-
| labelPosition | `'start' \| 'end' \| 'top' \| 'bottom'` | `'end'` | Label placement |
|
|
683
|
-
| startLabel | `string` | — | Left label (off state) |
|
|
684
|
-
| endLabel | `string` | — | Right label (on state) |
|
|
685
|
-
| checkedIcon | `ReactNode` | — | Icon when checked |
|
|
686
|
-
| uncheckedIcon | `ReactNode` | — | Icon when unchecked |
|
|
687
|
-
| checked | `boolean` | — | Controlled state |
|
|
688
|
-
| defaultChecked | `boolean` | — | Uncontrolled default |
|
|
689
|
-
| onCheckedChange | `(checked: boolean) => void` | — | Change handler |
|
|
690
|
-
| disabled | `boolean` | `false` | Disabled state |
|
|
691
|
-
|
|
692
|
-
---
|
|
693
|
-
|
|
694
|
-
### Toggle
|
|
695
|
-
|
|
696
|
-
```tsx
|
|
697
|
-
import { Toggle } from '@7onic-ui/react'
|
|
698
|
-
|
|
699
|
-
<Toggle variant="default" aria-label="Bold">
|
|
700
|
-
<BoldIcon />
|
|
701
|
-
</Toggle>
|
|
702
|
-
<Toggle variant="outline" pressed>Active</Toggle>
|
|
703
|
-
```
|
|
704
|
-
|
|
705
|
-
| Prop | Type | Default | Description |
|
|
706
|
-
|---|---|---|---|
|
|
707
|
-
| variant | `'default' \| 'outline' \| 'ghost' \| 'outline-ghost'` | `'default'` | Visual style |
|
|
708
|
-
| size | `'xs' \| 'sm' \| 'md' \| 'default' \| 'lg'` | `'default'` | 28/32/36/40/48px |
|
|
709
|
-
| radius | Same as Button | `'default'` | Border radius |
|
|
710
|
-
| fontWeight | `'normal' \| 'semibold'` | per variant | Font weight |
|
|
711
|
-
| iconOnly | `boolean` | `false` | Square mode (no text padding) |
|
|
712
|
-
| pressEffect | `boolean` | `true` | Scale-down on press |
|
|
713
|
-
| pressed | `boolean` | — | Controlled state |
|
|
714
|
-
| defaultPressed | `boolean` | — | Uncontrolled default |
|
|
715
|
-
| onPressedChange | `(pressed: boolean) => void` | — | Change handler |
|
|
716
|
-
|
|
717
|
-
---
|
|
718
|
-
|
|
719
|
-
### ToggleGroup
|
|
720
|
-
|
|
721
|
-
```tsx
|
|
722
|
-
import { ToggleGroup } from '@7onic-ui/react'
|
|
723
|
-
|
|
724
|
-
<ToggleGroup type="single" defaultValue="center">
|
|
725
|
-
<ToggleGroup.Item value="left"><AlignLeftIcon /></ToggleGroup.Item>
|
|
726
|
-
<ToggleGroup.Item value="center"><AlignCenterIcon /></ToggleGroup.Item>
|
|
727
|
-
<ToggleGroup.Item value="right"><AlignRightIcon /></ToggleGroup.Item>
|
|
728
|
-
</ToggleGroup>
|
|
729
|
-
```
|
|
230
|
+
# ═══ SECTION 3: TOKEN REFERENCE ═══
|
|
730
231
|
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
| type | `'single' \| 'multiple'` | required | Selection mode |
|
|
734
|
-
| variant | `'default' \| 'outline'` | `'default'` | Visual style |
|
|
735
|
-
| size | `'xs' \| 'sm' \| 'md' \| 'default' \| 'lg'` | `'default'` | Item size |
|
|
736
|
-
| radius | Same as Button | `'default'` | Border radius |
|
|
737
|
-
| fontWeight | `'normal' \| 'semibold'` | per variant | Font weight |
|
|
738
|
-
| orientation | `'horizontal' \| 'vertical'` | `'horizontal'` | Layout direction |
|
|
739
|
-
| value | `string \| string[]` | — | Controlled value |
|
|
740
|
-
| defaultValue | `string \| string[]` | — | Uncontrolled default |
|
|
741
|
-
| onValueChange | `(value) => void` | — | Change handler |
|
|
742
|
-
|
|
743
|
-
**Sub-components:** ToggleGroup.Item
|
|
232
|
+
> Token values depend on the user's project configuration.
|
|
233
|
+
> The names below are the API. Never assume specific hex values.
|
|
744
234
|
|
|
745
|
-
|
|
235
|
+
## Colors — Semantic (theme-aware, USE THESE)
|
|
746
236
|
|
|
747
|
-
|
|
237
|
+
**Background:**
|
|
238
|
+
- `background` — main page background
|
|
239
|
+
- `background-paper` — card/surface background
|
|
240
|
+
- `background-elevated` — elevated surface (above paper)
|
|
241
|
+
- `background-muted` — subtle/subdued background
|
|
748
242
|
|
|
749
|
-
|
|
750
|
-
|
|
243
|
+
**Text:**
|
|
244
|
+
- `foreground` (alias: `text`) — primary text
|
|
245
|
+
- `text-muted` — secondary text, lower emphasis
|
|
246
|
+
- `text-subtle` — tertiary text, lowest emphasis
|
|
247
|
+
- `text-link` — link color
|
|
248
|
+
- `text-primary` — brand-colored text
|
|
751
249
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
<Segmented.Item value="active">Active</Segmented.Item>
|
|
755
|
-
<Segmented.Item value="inactive">Inactive</Segmented.Item>
|
|
756
|
-
</Segmented>
|
|
757
|
-
```
|
|
250
|
+
**Intent Status:**
|
|
251
|
+
- `text-info` / `text-success` / `text-error` / `text-warning`
|
|
758
252
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
| defaultValue | `string` | — | Uncontrolled default |
|
|
767
|
-
| onValueChange | `(value: string) => void` | — | Change handler |
|
|
253
|
+
**Intent Colors (each has 5 variants):**
|
|
254
|
+
- `primary` / `primary-hover` / `primary-active` / `primary-tint` / `primary-foreground`
|
|
255
|
+
- `secondary` / `secondary-hover` / `secondary-active` / `secondary-tint` / `secondary-foreground`
|
|
256
|
+
- `success` / `success-hover` / `success-active` / `success-tint` / `success-foreground`
|
|
257
|
+
- `warning` / `warning-hover` / `warning-active` / `warning-tint` / `warning-foreground`
|
|
258
|
+
- `error` / `error-hover` / `error-active` / `error-tint` / `error-foreground`
|
|
259
|
+
- `info` / `info-hover` / `info-active` / `info-tint` / `info-foreground`
|
|
768
260
|
|
|
769
|
-
**
|
|
770
|
-
|
|
261
|
+
**Border:**
|
|
262
|
+
- `border` — default border
|
|
263
|
+
- `border-subtle` — lighter/softer border
|
|
264
|
+
- `border-strong` — stronger/darker border
|
|
771
265
|
|
|
772
|
-
|
|
266
|
+
**State:**
|
|
267
|
+
- `disabled` — disabled background
|
|
268
|
+
- `disabled-text` — disabled text
|
|
269
|
+
- `focus-ring` — focus indicator
|
|
270
|
+
- `focus-ring-error` — error focus indicator
|
|
773
271
|
|
|
774
|
-
|
|
272
|
+
## Colors — Primitive (raw palette, use sparingly)
|
|
775
273
|
|
|
776
|
-
|
|
777
|
-
|
|
274
|
+
7 color families, each with 50–900 shades (10 steps):
|
|
275
|
+
`gray`, `primary`, `secondary`, `blue`, `green`, `red`, `yellow`
|
|
778
276
|
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
277
|
+
Usage: `bg-primary-100`, `text-gray-600`, `border-blue-300`
|
|
278
|
+
**Prefer semantic tokens over primitives** — primitives don't auto-adapt to dark mode.
|
|
279
|
+
**Note:** The actual colors of each palette depend on the user's token configuration.
|
|
782
280
|
|
|
783
|
-
|
|
784
|
-
|---|---|---|---|
|
|
785
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Track/thumb size |
|
|
786
|
-
| color | `'default' \| 'primary'` | `'default'` | Active track color |
|
|
787
|
-
| showTooltip | `'auto' \| 'always' \| 'never'` | `'auto'` | Tooltip display |
|
|
788
|
-
| formatLabel | `(value: number) => string` | — | Tooltip value formatter |
|
|
789
|
-
| startContent | `ReactNode` | — | Left content (label/icon) |
|
|
790
|
-
| endContent | `ReactNode` | — | Right content (label/icon) |
|
|
791
|
-
| orientation | `'horizontal' \| 'vertical'` | `'horizontal'` | Direction |
|
|
792
|
-
| value | `number[]` | — | Controlled value(s) |
|
|
793
|
-
| defaultValue | `number[]` | — | Uncontrolled default |
|
|
794
|
-
| onValueChange | `(value: number[]) => void` | — | Change handler |
|
|
795
|
-
| min | `number` | `0` | Minimum value |
|
|
796
|
-
| max | `number` | `100` | Maximum value |
|
|
797
|
-
| step | `number` | `1` | Step increment |
|
|
281
|
+
## Spacing
|
|
798
282
|
|
|
799
|
-
|
|
283
|
+
| Token | Value | Common Use |
|
|
284
|
+
|---|---|---|
|
|
285
|
+
| `0` | 0 | Reset |
|
|
286
|
+
| `0.5` | 2px | Micro gap |
|
|
287
|
+
| `1` | 4px | Tight gap |
|
|
288
|
+
| `1.5` | 6px | Small gap |
|
|
289
|
+
| `2` | 8px | Default gap |
|
|
290
|
+
| `2.5` | 10px | — |
|
|
291
|
+
| `3` | 12px | Section gap |
|
|
292
|
+
| `3.5` | 14px | — |
|
|
293
|
+
| `4` | 16px | Card padding |
|
|
294
|
+
| `5` | 20px | — |
|
|
295
|
+
| `6` | 24px | Section padding |
|
|
296
|
+
| `7` | 28px | — |
|
|
297
|
+
| `8` | 32px | Large padding |
|
|
298
|
+
| `10` | 40px | — |
|
|
299
|
+
| `12` | 48px | — |
|
|
300
|
+
| `14` | 56px | — |
|
|
301
|
+
| `16` | 64px | Page margin |
|
|
302
|
+
| `20` | 80px | — |
|
|
303
|
+
| `24` | 96px | Hero spacing |
|
|
304
|
+
|
|
305
|
+
## Typography
|
|
306
|
+
|
|
307
|
+
**Font Families:**
|
|
308
|
+
- `font-sans` — sans-serif body font (user-defined)
|
|
309
|
+
- `font-mono` — monospace code font (user-defined)
|
|
310
|
+
|
|
311
|
+
**Font Sizes:**
|
|
312
|
+
|
|
313
|
+
| Class | Size | Line Height | Use Case |
|
|
314
|
+
|---|---|---|---|
|
|
315
|
+
| `text-2xs` | 11px | 16px | Fine print |
|
|
316
|
+
| `text-xs` | 12px | 18px | Caption, badge |
|
|
317
|
+
| `text-sm` | 13px | 20px | Body small, table |
|
|
318
|
+
| `text-md` | 14px | 22px | Body default |
|
|
319
|
+
| `text-base` | 16px | 26px | Body large |
|
|
320
|
+
| `text-lg` | 18px | 28px | Subtitle |
|
|
321
|
+
| `text-xl` | 20px | 30px | Title |
|
|
322
|
+
| `text-2xl` | 24px | 34px | Heading |
|
|
323
|
+
| `text-3xl` | 30px | 40px | Hero subtitle |
|
|
324
|
+
| `text-4xl` | 36px | 46px | Hero title |
|
|
325
|
+
| `text-5xl` | 48px | 58px | Display |
|
|
326
|
+
|
|
327
|
+
**Font Weights:**
|
|
328
|
+
- `font-normal` (400) — body text
|
|
329
|
+
- `font-semibold` (600) — labels, emphasis
|
|
330
|
+
- `font-bold` (700) — headings
|
|
331
|
+
|
|
332
|
+
## Border Radius
|
|
333
|
+
|
|
334
|
+
| Class | Value | Use Case |
|
|
335
|
+
|---|---|---|
|
|
336
|
+
| `rounded-none` | 0px | Square |
|
|
337
|
+
| `rounded-sm` | 2px | Subtle |
|
|
338
|
+
| `rounded-base` | 4px | Default (checkbox) |
|
|
339
|
+
| `rounded-md` | 6px | Default (button) |
|
|
340
|
+
| `rounded-lg` | 8px | Card, input |
|
|
341
|
+
| `rounded-xl` | 12px | Large card |
|
|
342
|
+
| `rounded-2xl` | 16px | Modal |
|
|
343
|
+
| `rounded-3xl` | 24px | Pill shape |
|
|
344
|
+
| `rounded-full` | 9999px | Circle, pill button |
|
|
345
|
+
|
|
346
|
+
## Shadows
|
|
347
|
+
|
|
348
|
+
| Class | Description |
|
|
349
|
+
|---|---|
|
|
350
|
+
| `shadow-xs` | Barely visible — subtle elevation |
|
|
351
|
+
| `shadow-sm` | Default card shadow |
|
|
352
|
+
| `shadow-md` | Dropdown, popover |
|
|
353
|
+
| `shadow-lg` | Modal, drawer |
|
|
354
|
+
| `shadow-xl` | Floating action |
|
|
800
355
|
|
|
801
|
-
|
|
356
|
+
Shadows automatically adapt between light and dark themes.
|
|
802
357
|
|
|
803
|
-
|
|
804
|
-
import { Field, Input, Textarea } from '@7onic-ui/react'
|
|
805
|
-
|
|
806
|
-
<Field error="Invalid email">
|
|
807
|
-
<Field.Label required>Email</Field.Label>
|
|
808
|
-
<Input placeholder="you@example.com" />
|
|
809
|
-
<Field.Error />
|
|
810
|
-
</Field>
|
|
811
|
-
|
|
812
|
-
<Field>
|
|
813
|
-
<Field.Label>Bio</Field.Label>
|
|
814
|
-
<Textarea placeholder="Tell us about yourself" maxLength={200} />
|
|
815
|
-
<Field.CharCount />
|
|
816
|
-
</Field>
|
|
817
|
-
```
|
|
358
|
+
## Z-Index (named stack)
|
|
818
359
|
|
|
819
|
-
|
|
|
820
|
-
|
|
821
|
-
|
|
|
822
|
-
|
|
|
823
|
-
|
|
|
360
|
+
| Class | Value | Use Case |
|
|
361
|
+
|---|---|---|
|
|
362
|
+
| `z-0` | 0 | Default |
|
|
363
|
+
| `z-10`–`z-50` | 10–50 | Layout layers |
|
|
364
|
+
| `z-sticky` | 100 | Sticky header |
|
|
365
|
+
| `z-dropdown` | 1000 | Dropdown menu |
|
|
366
|
+
| `z-overlay` | 1100 | Overlay/backdrop |
|
|
367
|
+
| `z-modal` | 2000 | Modal dialog |
|
|
368
|
+
| `z-popover` | 2100 | Popover |
|
|
369
|
+
| `z-tooltip` | 2200 | Tooltip |
|
|
370
|
+
| `z-toast` | 3000 | Toast notification |
|
|
824
371
|
|
|
825
|
-
**
|
|
826
|
-
**Context:** Input, Textarea, Checkbox, RadioGroup, Select auto-detect Field context for error/disabled/id.
|
|
372
|
+
**Never use arbitrary z-index values.** Always use these named tokens.
|
|
827
373
|
|
|
828
|
-
|
|
374
|
+
## Icon Sizes (6-step scale)
|
|
829
375
|
|
|
830
|
-
|
|
376
|
+
| Class | Size | Use Case |
|
|
377
|
+
|---|---|---|
|
|
378
|
+
| `icon-2xs` | 12px | Badge icon, small indicator |
|
|
379
|
+
| `icon-xs` | 14px | xs/sm button icon, tag |
|
|
380
|
+
| `icon-sm` | 16px | Default button icon, form element |
|
|
381
|
+
| `icon-md` | 20px | Navigation, default icon button |
|
|
382
|
+
| `icon-lg` | 24px | Large icon button, card |
|
|
383
|
+
| `icon-xl` | 32px | Hero, feature icon |
|
|
831
384
|
|
|
832
|
-
|
|
385
|
+
**Never use `w-4 h-4` for icons.** Always use `icon-{size}` classes.
|
|
833
386
|
|
|
834
|
-
|
|
835
|
-
import { Avatar } from '@7onic-ui/react'
|
|
836
|
-
|
|
837
|
-
<Avatar size="default">
|
|
838
|
-
<Avatar.Image src="/photo.jpg" alt="User" />
|
|
839
|
-
<Avatar.Fallback name="John Doe" colorized />
|
|
840
|
-
</Avatar>
|
|
841
|
-
|
|
842
|
-
<Avatar.Group max={3}>
|
|
843
|
-
<Avatar><Avatar.Image src="/a.jpg" /><Avatar.Fallback>A</Avatar.Fallback></Avatar>
|
|
844
|
-
<Avatar><Avatar.Image src="/b.jpg" /><Avatar.Fallback>B</Avatar.Fallback></Avatar>
|
|
845
|
-
<Avatar><Avatar.Image src="/c.jpg" /><Avatar.Fallback>C</Avatar.Fallback></Avatar>
|
|
846
|
-
<Avatar><Avatar.Fallback>+2</Avatar.Fallback></Avatar>
|
|
847
|
-
</Avatar.Group>
|
|
848
|
-
```
|
|
387
|
+
## Duration
|
|
849
388
|
|
|
850
|
-
|
|
|
851
|
-
|
|
852
|
-
|
|
|
853
|
-
|
|
|
854
|
-
|
|
|
389
|
+
| Class | Value | Use Case |
|
|
390
|
+
|---|---|---|
|
|
391
|
+
| `duration-instant` | 0ms | No animation |
|
|
392
|
+
| `duration-fast` | 100ms | Micro interactions |
|
|
393
|
+
| `duration-micro` | 150ms | Button press, toggle |
|
|
394
|
+
| `duration-normal` | 200ms | Default transition |
|
|
395
|
+
| `duration-slow` | 300ms | Panel slide |
|
|
396
|
+
| `duration-slower` | 400ms | Page transition |
|
|
397
|
+
| `duration-slowest` | 500ms | Complex animation |
|
|
398
|
+
| `duration-spin` | 1000ms | Spinner rotation |
|
|
855
399
|
|
|
856
|
-
|
|
857
|
-
|---|---|---|---|
|
|
858
|
-
| name | `string` | — | Auto-generates initials |
|
|
859
|
-
| colorized | `boolean` | `false` | Deterministic color from name hash |
|
|
860
|
-
| colorVariant | `'vivid' \| 'soft'` | `'vivid'` | Color intensity |
|
|
400
|
+
## Easing
|
|
861
401
|
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
402
|
+
- `ease-linear` — constant speed
|
|
403
|
+
- `ease-ease` — natural acceleration/deceleration
|
|
404
|
+
- `ease-ease-in` — slow start
|
|
405
|
+
- `ease-ease-out` — slow end
|
|
406
|
+
- `ease-ease-in-out` — slow start and end
|
|
867
407
|
|
|
868
|
-
|
|
408
|
+
## Opacity
|
|
869
409
|
|
|
870
|
-
|
|
410
|
+
21-step scale: `opacity-0`, `opacity-5`, `opacity-10` ... `opacity-95`, `opacity-100`
|
|
411
|
+
Each 5% increment. Values: 0, 0.05, 0.10 ... 0.95, 1.0
|
|
871
412
|
|
|
872
|
-
|
|
413
|
+
## Scale (Transform)
|
|
873
414
|
|
|
874
|
-
|
|
875
|
-
|
|
415
|
+
| Class | Value | Use Case |
|
|
416
|
+
|---|---|---|
|
|
417
|
+
| `scale-50` | 0.5 | Half size |
|
|
418
|
+
| `scale-75` | 0.75 | Reduced |
|
|
419
|
+
| `scale-95` | 0.95 | Hover shrink |
|
|
420
|
+
| `scale-pressed` | 0.98 | Button press effect |
|
|
876
421
|
|
|
877
|
-
|
|
878
|
-
<Badge variant="subtle" color="success" dot>Active</Badge>
|
|
879
|
-
<Badge variant="outline" removable onRemove={() => {}}>Tag</Badge>
|
|
880
|
-
```
|
|
422
|
+
## Breakpoints
|
|
881
423
|
|
|
882
|
-
|
|
|
883
|
-
|
|
884
|
-
|
|
|
885
|
-
|
|
|
886
|
-
|
|
|
887
|
-
|
|
|
888
|
-
|
|
|
889
|
-
| dot | `boolean` | `false` | Status dot indicator |
|
|
890
|
-
| removable | `boolean` | `false` | Shows remove button |
|
|
891
|
-
| onRemove | `() => void` | — | Remove handler |
|
|
892
|
-
| asChild | `boolean` | `false` | Slot pattern |
|
|
424
|
+
| Class | Min Width | Use Case |
|
|
425
|
+
|---|---|---|
|
|
426
|
+
| `sm:` | 640px | Mobile landscape |
|
|
427
|
+
| `md:` | 768px | Tablet |
|
|
428
|
+
| `lg:` | 1024px | Desktop |
|
|
429
|
+
| `xl:` | 1280px | Wide desktop |
|
|
430
|
+
| `2xl:` | 1536px | Ultra-wide |
|
|
893
431
|
|
|
894
432
|
---
|
|
895
433
|
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
```tsx
|
|
899
|
-
import { Card } from '@7onic-ui/react'
|
|
900
|
-
|
|
901
|
-
<Card variant="default" interactive>
|
|
902
|
-
<Card.Image src="/cover.jpg" overlay overlayOpacity={40} />
|
|
903
|
-
<Card.Header>
|
|
904
|
-
<Card.Title icon={<StarIcon />}>Featured</Card.Title>
|
|
905
|
-
<Card.Description>Card description</Card.Description>
|
|
906
|
-
<Card.Action><IconButton variant="ghost"><MoreIcon /></IconButton></Card.Action>
|
|
907
|
-
</Card.Header>
|
|
908
|
-
<Card.Content>Main content</Card.Content>
|
|
909
|
-
<Card.Footer>Footer actions</Card.Footer>
|
|
910
|
-
</Card>
|
|
911
|
-
```
|
|
912
|
-
|
|
913
|
-
| Prop (Root) | Type | Default | Description |
|
|
914
|
-
|---|---|---|---|
|
|
915
|
-
| variant | `'default' \| 'outline' \| 'ghost'` | `'default'` | Visual style |
|
|
916
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Padding scale |
|
|
917
|
-
| radius | `'sm' \| 'base' \| 'md' \| 'lg' \| 'xl' \| '2xl'` | `'xl'` | Border radius |
|
|
918
|
-
| direction | `'vertical' \| 'horizontal'` | `'vertical'` | Layout direction |
|
|
919
|
-
| interactive | `boolean` | `false` | Hover shadow + lift |
|
|
920
|
-
| asChild | `boolean` | `false` | Slot pattern |
|
|
921
|
-
|
|
922
|
-
| Prop (Image) | Type | Default | Description |
|
|
923
|
-
|---|---|---|---|
|
|
924
|
-
| overlay | `boolean` | `false` | Gradient overlay |
|
|
925
|
-
| overlayOpacity | `10-90` | `60` | Overlay darkness |
|
|
434
|
+
# ═══ SECTION 4: TOKEN CUSTOMIZATION ═══
|
|
926
435
|
|
|
927
|
-
|
|
436
|
+
## ⛔ Rule for AI: Use Existing Tokens Only
|
|
928
437
|
|
|
929
|
-
|
|
438
|
+
The token system is comprehensive — semantic colors, primitives, spacing, typography, radius, shadows, z-index, icon sizes, duration, easing, opacity, scale, and breakpoints cover all UI needs.
|
|
930
439
|
|
|
931
|
-
|
|
440
|
+
**Every visual value you need already exists as a token.** Use it.
|
|
932
441
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
<Table.Row>
|
|
939
|
-
<Table.Head sortable sortDirection="asc" onSort={() => {}}>Name</Table.Head>
|
|
940
|
-
<Table.Head align="right">Amount</Table.Head>
|
|
941
|
-
</Table.Row>
|
|
942
|
-
</Table.Header>
|
|
943
|
-
<Table.Body>
|
|
944
|
-
<Table.Row interactive>
|
|
945
|
-
<Table.Cell>John</Table.Cell>
|
|
946
|
-
<Table.Cell align="right">$100</Table.Cell>
|
|
947
|
-
</Table.Row>
|
|
948
|
-
</Table.Body>
|
|
949
|
-
</Table>
|
|
950
|
-
```
|
|
442
|
+
- **Always use token names** (`bg-primary`, `text-foreground`, `rounded-lg`) — never hardcode values
|
|
443
|
+
- **Never assume specific color values** — token values are defined by the user's project
|
|
444
|
+
- **Never add CSS variables, hex values, or arbitrary Tailwind values**
|
|
445
|
+
- **Token customization is the user's responsibility** — if the user needs custom values, they will handle it separately. See: https://7onic.design/components/theming
|
|
446
|
+
- **Never modify generated token files** — the following files are auto-generated from figma-tokens.json via sync-tokens. AI must never edit, add to, or delete from these files: `variables.css`, `light.css`, `dark.css`, `v3-preset.js`, `v4-theme.css`, `index.js`, `index.mjs`, `index.d.ts`, `tokens.json`
|
|
951
447
|
|
|
952
|
-
|
|
953
|
-
|---|---|---|---|
|
|
954
|
-
| variant | `'default' \| 'bordered' \| 'striped'` | `'default'` | Visual style |
|
|
955
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Cell padding |
|
|
956
|
-
| stickyHeader | `boolean` | `false` | Sticky header row |
|
|
448
|
+
### Self-Check (after writing ANY code)
|
|
957
449
|
|
|
958
|
-
|
|
959
|
-
|---|---|---|---|
|
|
960
|
-
| align | `'left' \| 'center' \| 'right'` | `'left'` | Text alignment |
|
|
961
|
-
| sortable | `boolean` | `false` | Shows sort indicator |
|
|
962
|
-
| sortDirection | `'asc' \| 'desc' \| null` | — | Current sort state |
|
|
963
|
-
| onSort | `() => void` | — | Sort handler |
|
|
450
|
+
Before presenting code to the user, scan your own output for violations:
|
|
964
451
|
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
452
|
+
- [ ] Any raw color class? (`bg-blue-*`, `text-gray-*`, `bg-white`, `border-gray-*`)
|
|
453
|
+
- [ ] Any arbitrary value? (`p-[*]`, `text-[*]`, `rounded-[*]`, `z-[*]`)
|
|
454
|
+
- [ ] Any inline style? (`style={{ }}`)
|
|
455
|
+
- [ ] Any `dark:` prefix?
|
|
456
|
+
- [ ] Any `w-N h-N` for icons instead of `icon-*`?
|
|
457
|
+
- [ ] Any `divide-*` or `border` without a token color? (`divide-y` alone → `divide-y divide-border`)
|
|
458
|
+
- [ ] Any `opacity-*` on element instead of color modifier? (`bg-primary opacity-10` → `bg-primary/10`)
|
|
969
459
|
|
|
970
|
-
**
|
|
460
|
+
**If ANY violation is found → fix it before showing code to the user.**
|
|
461
|
+
**Do NOT present code with violations. Fix first, then present.**
|
|
971
462
|
|
|
972
463
|
---
|
|
973
464
|
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
```tsx
|
|
979
|
-
import { Tabs } from '@7onic-ui/react'
|
|
980
|
-
|
|
981
|
-
<Tabs defaultValue="tab1">
|
|
982
|
-
<Tabs.List variant="line" size="default">
|
|
983
|
-
<Tabs.Trigger value="tab1">Tab 1</Tabs.Trigger>
|
|
984
|
-
<Tabs.Trigger value="tab2">Tab 2</Tabs.Trigger>
|
|
985
|
-
</Tabs.List>
|
|
986
|
-
<Tabs.Content value="tab1">Content 1</Tabs.Content>
|
|
987
|
-
<Tabs.Content value="tab2">Content 2</Tabs.Content>
|
|
988
|
-
</Tabs>
|
|
989
|
-
```
|
|
990
|
-
|
|
991
|
-
| Prop (List) | Type | Default | Description |
|
|
992
|
-
|---|---|---|---|
|
|
993
|
-
| variant | `'line' \| 'enclosed' \| 'pill'` | `'line'` | Tab style |
|
|
994
|
-
| size | `'sm' \| 'md' \| 'default' \| 'lg'` | `'default'` | Tab size |
|
|
995
|
-
| fitted | `boolean` | `false` | Full width tabs |
|
|
996
|
-
| color | `'default' \| 'primary'` | `'default'` | Active tab color |
|
|
997
|
-
| radius | `'none' \| 'sm' \| 'md' \| 'default' \| 'lg' \| 'full'` | `'default'` | Border radius (enclosed/pill) |
|
|
998
|
-
|
|
999
|
-
**Sub-components:** Tabs.List, Tabs.Trigger, Tabs.Content
|
|
1000
|
-
|
|
1001
|
-
---
|
|
1002
|
-
|
|
1003
|
-
### Accordion
|
|
1004
|
-
|
|
1005
|
-
```tsx
|
|
1006
|
-
import { Accordion } from '@7onic-ui/react'
|
|
1007
|
-
|
|
1008
|
-
<Accordion type="single" collapsible defaultValue="item-1">
|
|
1009
|
-
<Accordion.Item value="item-1">
|
|
1010
|
-
<Accordion.Trigger>Section 1</Accordion.Trigger>
|
|
1011
|
-
<Accordion.Content>Content 1</Accordion.Content>
|
|
1012
|
-
</Accordion.Item>
|
|
1013
|
-
<Accordion.Item value="item-2">
|
|
1014
|
-
<Accordion.Trigger>Section 2</Accordion.Trigger>
|
|
1015
|
-
<Accordion.Content>Content 2</Accordion.Content>
|
|
1016
|
-
</Accordion.Item>
|
|
1017
|
-
</Accordion>
|
|
1018
|
-
```
|
|
1019
|
-
|
|
1020
|
-
| Prop (Root) | Type | Default | Description |
|
|
1021
|
-
|---|---|---|---|
|
|
1022
|
-
| type | `'single' \| 'multiple'` | required | Expansion mode |
|
|
1023
|
-
| variant | `'default' \| 'bordered' \| 'splitted'` | `'default'` | Visual style |
|
|
1024
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Padding scale |
|
|
1025
|
-
| iconPosition | `'left' \| 'right'` | `'right'` | Chevron placement |
|
|
1026
|
-
| collapsible | `boolean` | `false` | Allow all closed (single only) |
|
|
1027
|
-
|
|
1028
|
-
**Sub-components:** Accordion.Item, Accordion.Trigger (with `icon` prop), Accordion.Content
|
|
1029
|
-
|
|
1030
|
-
---
|
|
1031
|
-
|
|
1032
|
-
### Divider
|
|
1033
|
-
|
|
1034
|
-
```tsx
|
|
1035
|
-
import { Divider } from '@7onic-ui/react'
|
|
1036
|
-
|
|
1037
|
-
<Divider />
|
|
1038
|
-
<Divider variant="dashed" color="muted" />
|
|
1039
|
-
<Divider label="OR" labelPosition="center" />
|
|
1040
|
-
<Divider orientation="vertical" />
|
|
1041
|
-
```
|
|
1042
|
-
|
|
1043
|
-
| Prop | Type | Default | Description |
|
|
1044
|
-
|---|---|---|---|
|
|
1045
|
-
| orientation | `'horizontal' \| 'vertical'` | `'horizontal'` | Direction |
|
|
1046
|
-
| variant | `'solid' \| 'dashed' \| 'dotted'` | `'solid'` | Line style |
|
|
1047
|
-
| color | `'default' \| 'muted' \| 'strong'` | `'default'` | Line color |
|
|
1048
|
-
| spacing | `'sm' \| 'md' \| 'default' \| 'lg'` | `'default'` | Margin around line |
|
|
1049
|
-
| label | `string` | — | Center label text |
|
|
1050
|
-
| labelPosition | `'left' \| 'center' \| 'right'` | `'center'` | Label placement |
|
|
1051
|
-
|
|
1052
|
-
---
|
|
1053
|
-
|
|
1054
|
-
## Overlay
|
|
1055
|
-
|
|
1056
|
-
### Modal
|
|
1057
|
-
|
|
1058
|
-
```tsx
|
|
1059
|
-
import { Modal, Button } from '@7onic-ui/react'
|
|
1060
|
-
|
|
1061
|
-
<Modal>
|
|
1062
|
-
<Modal.Trigger asChild>
|
|
1063
|
-
<Button>Open Modal</Button>
|
|
1064
|
-
</Modal.Trigger>
|
|
1065
|
-
<Modal.Portal>
|
|
1066
|
-
<Modal.Overlay />
|
|
1067
|
-
<Modal.Content size="md">
|
|
1068
|
-
<Modal.Header>
|
|
1069
|
-
<Modal.Title>Confirm</Modal.Title>
|
|
1070
|
-
<Modal.Description>Are you sure?</Modal.Description>
|
|
1071
|
-
</Modal.Header>
|
|
1072
|
-
<Modal.Body>Modal body content</Modal.Body>
|
|
1073
|
-
<Modal.Footer>
|
|
1074
|
-
<Modal.Close asChild><Button variant="outline">Cancel</Button></Modal.Close>
|
|
1075
|
-
<Button color="primary">Confirm</Button>
|
|
1076
|
-
</Modal.Footer>
|
|
1077
|
-
</Modal.Content>
|
|
1078
|
-
</Modal.Portal>
|
|
1079
|
-
</Modal>
|
|
1080
|
-
```
|
|
1081
|
-
|
|
1082
|
-
| Prop (Content) | Type | Default | Description |
|
|
1083
|
-
|---|---|---|---|
|
|
1084
|
-
| size | `'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'` | `'md'` | Modal width |
|
|
1085
|
-
| scrollBehavior | `'inside' \| 'outside'` | `'inside'` | Scroll target |
|
|
1086
|
-
| showCloseButton | `boolean` | `true` | Show X button |
|
|
1087
|
-
|
|
1088
|
-
**Sub-components:** Modal.Trigger, Modal.Portal, Modal.Overlay, Modal.Content, Modal.Header, Modal.Title, Modal.Description, Modal.Body, Modal.Footer, Modal.Close
|
|
1089
|
-
|
|
1090
|
-
**Required structure:** Portal → Overlay + Content. Don't forget Portal and Overlay.
|
|
1091
|
-
|
|
1092
|
-
---
|
|
1093
|
-
|
|
1094
|
-
### Drawer
|
|
1095
|
-
|
|
1096
|
-
```tsx
|
|
1097
|
-
import { Drawer, Button } from '@7onic-ui/react'
|
|
1098
|
-
|
|
1099
|
-
<Drawer>
|
|
1100
|
-
<Drawer.Trigger asChild>
|
|
1101
|
-
<Button>Open Drawer</Button>
|
|
1102
|
-
</Drawer.Trigger>
|
|
1103
|
-
<Drawer.Portal>
|
|
1104
|
-
<Drawer.Overlay />
|
|
1105
|
-
<Drawer.Content side="right" size="md">
|
|
1106
|
-
<Drawer.Header>
|
|
1107
|
-
<Drawer.Title>Settings</Drawer.Title>
|
|
1108
|
-
</Drawer.Header>
|
|
1109
|
-
<Drawer.Body>Content</Drawer.Body>
|
|
1110
|
-
<Drawer.Footer>
|
|
1111
|
-
<Drawer.Close asChild><Button variant="outline">Close</Button></Drawer.Close>
|
|
1112
|
-
</Drawer.Footer>
|
|
1113
|
-
</Drawer.Content>
|
|
1114
|
-
</Drawer.Portal>
|
|
1115
|
-
</Drawer>
|
|
1116
|
-
```
|
|
1117
|
-
|
|
1118
|
-
| Prop (Content) | Type | Default | Description |
|
|
1119
|
-
|---|---|---|---|
|
|
1120
|
-
| side | `'left' \| 'right' \| 'top' \| 'bottom'` | `'right'` | Slide direction |
|
|
1121
|
-
| size | `'sm' \| 'md' \| 'lg' \| 'xl' \| 'full'` | `'md'` | Width/height |
|
|
1122
|
-
| showCloseButton | `boolean` | `true` | Show X button |
|
|
1123
|
-
|
|
1124
|
-
**Sub-components:** Drawer.Trigger, Drawer.Portal, Drawer.Overlay, Drawer.Content, Drawer.Header, Drawer.Title, Drawer.Description, Drawer.Body, Drawer.Footer, Drawer.Close
|
|
1125
|
-
|
|
1126
|
-
---
|
|
1127
|
-
|
|
1128
|
-
### Tooltip
|
|
1129
|
-
|
|
1130
|
-
```tsx
|
|
1131
|
-
import { Tooltip } from '@7onic-ui/react'
|
|
1132
|
-
|
|
1133
|
-
<Tooltip.Provider>
|
|
1134
|
-
<Tooltip>
|
|
1135
|
-
<Tooltip.Trigger asChild>
|
|
1136
|
-
<Button>Hover me</Button>
|
|
1137
|
-
</Tooltip.Trigger>
|
|
1138
|
-
<Tooltip.Portal>
|
|
1139
|
-
<Tooltip.Content side="top" showArrow>
|
|
1140
|
-
Tooltip text
|
|
1141
|
-
<Tooltip.Arrow />
|
|
1142
|
-
</Tooltip.Content>
|
|
1143
|
-
</Tooltip.Portal>
|
|
1144
|
-
</Tooltip>
|
|
1145
|
-
</Tooltip.Provider>
|
|
1146
|
-
```
|
|
1147
|
-
|
|
1148
|
-
| Prop (Root) | Type | Default | Description |
|
|
1149
|
-
|---|---|---|---|
|
|
1150
|
-
| delayDuration | `number` | `200` | Hover delay (ms) |
|
|
1151
|
-
|
|
1152
|
-
| Prop (Content) | Type | Default | Description |
|
|
1153
|
-
|---|---|---|---|
|
|
1154
|
-
| variant | `'default' \| 'inverted'` | `'default'` | Dark/light bg |
|
|
1155
|
-
| size | `'sm' \| 'default'` | `'default'` | Padding scale |
|
|
1156
|
-
| side | `'top' \| 'right' \| 'bottom' \| 'left'` | `'top'` | Placement |
|
|
1157
|
-
| showArrow | `boolean` | `false` | Show arrow |
|
|
1158
|
-
| sideOffset | `number` | `4` | Gap from trigger |
|
|
1159
|
-
|
|
1160
|
-
**⚠️ Tooltip.Provider is required** — wrap your app or section with it.
|
|
1161
|
-
**Sub-components:** Tooltip.Provider, Tooltip.Trigger, Tooltip.Content, Tooltip.Arrow, Tooltip.Portal
|
|
1162
|
-
|
|
1163
|
-
---
|
|
1164
|
-
|
|
1165
|
-
### Popover
|
|
1166
|
-
|
|
1167
|
-
```tsx
|
|
1168
|
-
import { Popover, Button } from '@7onic-ui/react'
|
|
1169
|
-
|
|
1170
|
-
<Popover>
|
|
1171
|
-
<Popover.Trigger asChild>
|
|
1172
|
-
<Button variant="outline">Open</Button>
|
|
1173
|
-
</Popover.Trigger>
|
|
1174
|
-
<Popover.Portal>
|
|
1175
|
-
<Popover.Content side="bottom" showArrow showClose>
|
|
1176
|
-
<Popover.Arrow />
|
|
1177
|
-
<p>Popover content</p>
|
|
1178
|
-
</Popover.Content>
|
|
1179
|
-
</Popover.Portal>
|
|
1180
|
-
</Popover>
|
|
1181
|
-
```
|
|
1182
|
-
|
|
1183
|
-
| Prop (Content) | Type | Default | Description |
|
|
1184
|
-
|---|---|---|---|
|
|
1185
|
-
| variant | `'default' \| 'elevated'` | `'default'` | Shadow style |
|
|
1186
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Padding scale |
|
|
1187
|
-
| side | `'top' \| 'right' \| 'bottom' \| 'left'` | `'bottom'` | Placement |
|
|
1188
|
-
| showArrow | `boolean` | `false` | Show arrow |
|
|
1189
|
-
| showClose | `boolean` | `false` | Show X button |
|
|
1190
|
-
|
|
1191
|
-
**Sub-components:** Popover.Trigger, Popover.Content, Popover.Arrow, Popover.Close, Popover.Anchor, Popover.Portal
|
|
1192
|
-
|
|
1193
|
-
---
|
|
1194
|
-
|
|
1195
|
-
## Feedback
|
|
1196
|
-
|
|
1197
|
-
### Alert
|
|
1198
|
-
|
|
1199
|
-
```tsx
|
|
1200
|
-
import { Alert } from '@7onic-ui/react'
|
|
1201
|
-
|
|
1202
|
-
<Alert color="success" closable onClose={() => {}}>
|
|
1203
|
-
<Alert.Title>Success</Alert.Title>
|
|
1204
|
-
<Alert.Description>Operation completed.</Alert.Description>
|
|
1205
|
-
</Alert>
|
|
1206
|
-
|
|
1207
|
-
<Alert variant="filled" color="error" icon={<ErrorIcon />}>
|
|
1208
|
-
<Alert.Title>Error</Alert.Title>
|
|
1209
|
-
</Alert>
|
|
1210
|
-
```
|
|
1211
|
-
|
|
1212
|
-
| Prop (Root) | Type | Default | Description |
|
|
1213
|
-
|---|---|---|---|
|
|
1214
|
-
| variant | `'default' \| 'outline' \| 'filled'` | `'default'` | Visual style |
|
|
1215
|
-
| color | `'info' \| 'success' \| 'warning' \| 'error'` | `'info'` | Color scheme |
|
|
1216
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Padding scale |
|
|
1217
|
-
| radius | Same as Card | `'lg'` | Border radius |
|
|
1218
|
-
| closable | `boolean` | `false` | Show close button |
|
|
1219
|
-
| onClose | `() => void` | — | Close handler |
|
|
1220
|
-
| icon | `ReactNode` | auto | Custom icon (auto-selects by color) |
|
|
1221
|
-
| hideIcon | `boolean` | `false` | Hide icon |
|
|
1222
|
-
|
|
1223
|
-
**Sub-components:** Alert.Title, Alert.Description
|
|
1224
|
-
|
|
1225
|
-
---
|
|
1226
|
-
|
|
1227
|
-
### Toast (Imperative API)
|
|
1228
|
-
|
|
1229
|
-
```tsx
|
|
1230
|
-
import { Toaster, toast } from '@7onic-ui/react'
|
|
1231
|
-
|
|
1232
|
-
// 1. Add Toaster provider to your app layout (once)
|
|
1233
|
-
<Toaster position="bottom-right" />
|
|
1234
|
-
|
|
1235
|
-
// 2. Call toast() anywhere
|
|
1236
|
-
toast('Default notification')
|
|
1237
|
-
toast.success('Saved successfully')
|
|
1238
|
-
toast.error('Something went wrong')
|
|
1239
|
-
toast.warning('Please check your input')
|
|
1240
|
-
toast.info('New update available')
|
|
1241
|
-
toast.loading('Processing...')
|
|
1242
|
-
|
|
1243
|
-
// With options
|
|
1244
|
-
toast.success('Saved', {
|
|
1245
|
-
description: 'Your changes have been saved.',
|
|
1246
|
-
duration: 5000,
|
|
1247
|
-
action: { label: 'Undo', onClick: () => {} },
|
|
1248
|
-
})
|
|
1249
|
-
|
|
1250
|
-
// Promise
|
|
1251
|
-
toast.promise(fetchData(), {
|
|
1252
|
-
loading: 'Loading...',
|
|
1253
|
-
success: 'Data loaded',
|
|
1254
|
-
error: 'Failed to load',
|
|
1255
|
-
})
|
|
1256
|
-
|
|
1257
|
-
// Dismiss
|
|
1258
|
-
const id = toast('Message')
|
|
1259
|
-
toast.dismiss(id) // Dismiss specific
|
|
1260
|
-
toast.dismiss() // Dismiss all
|
|
1261
|
-
```
|
|
1262
|
-
|
|
1263
|
-
| Prop (Toaster) | Type | Default | Description |
|
|
1264
|
-
|---|---|---|---|
|
|
1265
|
-
| position | `'top-left' \| 'top-center' \| 'top-right' \| 'bottom-left' \| 'bottom-center' \| 'bottom-right'` | `'bottom-right'` | Toast position |
|
|
1266
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Toast size |
|
|
1267
|
-
| duration | `number` | `4000` | Auto-dismiss ms (0 = persistent) |
|
|
1268
|
-
| closeButton | `boolean` | `false` | Show close button |
|
|
1269
|
-
| richColors | `boolean` | `false` | Filled color backgrounds |
|
|
1270
|
-
| expand | `boolean` | `false` | Show all toasts expanded |
|
|
1271
|
-
| visibleToasts | `number` | `3` | Max visible at once |
|
|
1272
|
-
|
|
1273
|
-
**⚠️ No Portal needed.** Just place `<Toaster />` in your root layout. Call `toast()` from anywhere.
|
|
1274
|
-
|
|
1275
|
-
---
|
|
1276
|
-
|
|
1277
|
-
### Progress
|
|
1278
|
-
|
|
1279
|
-
```tsx
|
|
1280
|
-
import { Progress } from '@7onic-ui/react'
|
|
1281
|
-
|
|
1282
|
-
<Progress value={65} showValue />
|
|
1283
|
-
<Progress type="circular" value={75} color="primary" />
|
|
1284
|
-
<Progress variant="striped" animated value={50} />
|
|
1285
|
-
```
|
|
1286
|
-
|
|
1287
|
-
| Prop | Type | Default | Description |
|
|
1288
|
-
|---|---|---|---|
|
|
1289
|
-
| type | `'linear' \| 'circular'` | `'linear'` | Shape |
|
|
1290
|
-
| value | `number` | `0` | Current value |
|
|
1291
|
-
| max | `number` | `100` | Maximum value |
|
|
1292
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Bar/circle size |
|
|
1293
|
-
| variant | `'default' \| 'striped'` | `'default'` | Bar fill style |
|
|
1294
|
-
| color | `'default' \| 'primary'` | `'default'` | Fill color |
|
|
1295
|
-
| showValue | `boolean` | `false` | Show percentage text |
|
|
1296
|
-
| formatLabel | `(value: number, max: number) => string` | — | Custom label |
|
|
1297
|
-
| animated | `boolean` | `false` | Animate stripes |
|
|
1298
|
-
|
|
1299
|
-
---
|
|
1300
|
-
|
|
1301
|
-
### Spinner
|
|
1302
|
-
|
|
1303
|
-
```tsx
|
|
1304
|
-
import { Spinner } from '@7onic-ui/react'
|
|
1305
|
-
|
|
1306
|
-
<Spinner />
|
|
1307
|
-
<Spinner variant="dots" size="lg" color="primary" />
|
|
1308
|
-
<Spinner variant="bars" speed="slow" />
|
|
1309
|
-
<Spinner variant="orbit" orbitStyle="morph" />
|
|
1310
|
-
```
|
|
1311
|
-
|
|
1312
|
-
| Prop | Type | Default | Description |
|
|
1313
|
-
|---|---|---|---|
|
|
1314
|
-
| variant | `'ring' \| 'dots' \| 'bars' \| 'orbit'` | `'ring'` | Animation style |
|
|
1315
|
-
| orbitStyle | `'ring' \| 'dots' \| 'cube' \| 'flip' \| 'morph'` | `'ring'` | Orbit sub-variant |
|
|
1316
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Spinner size |
|
|
1317
|
-
| color | `'default' \| 'primary' \| 'current'` | `'default'` | Color |
|
|
1318
|
-
| speed | `'slow' \| 'default' \| 'fast'` | `'default'` | Animation speed |
|
|
1319
|
-
| label | `string` | `'Loading'` | aria-label text |
|
|
1320
|
-
|
|
1321
|
-
---
|
|
1322
|
-
|
|
1323
|
-
### Skeleton
|
|
1324
|
-
|
|
1325
|
-
```tsx
|
|
1326
|
-
import { Skeleton } from '@7onic-ui/react'
|
|
1327
|
-
|
|
1328
|
-
<Skeleton variant="text" count={3} />
|
|
1329
|
-
<Skeleton variant="circular" width={48} height={48} />
|
|
1330
|
-
<Skeleton variant="rectangular" width="100%" height={200} />
|
|
1331
|
-
|
|
1332
|
-
{/* Conditional rendering */}
|
|
1333
|
-
<Skeleton loading={isLoading}>
|
|
1334
|
-
<ActualContent />
|
|
1335
|
-
</Skeleton>
|
|
1336
|
-
```
|
|
1337
|
-
|
|
1338
|
-
| Prop | Type | Default | Description |
|
|
1339
|
-
|---|---|---|---|
|
|
1340
|
-
| variant | `'text' \| 'circular' \| 'rectangular'` | `'text'` | Shape |
|
|
1341
|
-
| animation | `'pulse' \| 'wave' \| false` | `'pulse'` | Animation style |
|
|
1342
|
-
| width | `number \| string` | — | Width (px or CSS) |
|
|
1343
|
-
| height | `number \| string` | — | Height (px or CSS) |
|
|
1344
|
-
| radius | `number \| string` | — | Border radius |
|
|
1345
|
-
| count | `number` | `1` | Multi-line count |
|
|
1346
|
-
| loading | `boolean` | `true` | Show skeleton vs children |
|
|
1347
|
-
| children | `ReactNode` | — | Content (shown when loading=false) |
|
|
1348
|
-
|
|
1349
|
-
---
|
|
1350
|
-
|
|
1351
|
-
## Navigation
|
|
1352
|
-
|
|
1353
|
-
### Breadcrumb
|
|
1354
|
-
|
|
1355
|
-
```tsx
|
|
1356
|
-
import { Breadcrumb } from '@7onic-ui/react'
|
|
1357
|
-
|
|
1358
|
-
<Breadcrumb>
|
|
1359
|
-
<Breadcrumb.List>
|
|
1360
|
-
<Breadcrumb.Item>
|
|
1361
|
-
<Breadcrumb.Link href="/">Home</Breadcrumb.Link>
|
|
1362
|
-
</Breadcrumb.Item>
|
|
1363
|
-
<Breadcrumb.Separator />
|
|
1364
|
-
<Breadcrumb.Item>
|
|
1365
|
-
<Breadcrumb.Link href="/docs">Docs</Breadcrumb.Link>
|
|
1366
|
-
</Breadcrumb.Item>
|
|
1367
|
-
<Breadcrumb.Separator />
|
|
1368
|
-
<Breadcrumb.Item>
|
|
1369
|
-
<Breadcrumb.Page>Current</Breadcrumb.Page>
|
|
1370
|
-
</Breadcrumb.Item>
|
|
1371
|
-
</Breadcrumb.List>
|
|
1372
|
-
</Breadcrumb>
|
|
1373
|
-
```
|
|
1374
|
-
|
|
1375
|
-
| Prop (Root) | Type | Default | Description |
|
|
1376
|
-
|---|---|---|---|
|
|
1377
|
-
| separator | `ReactNode` | `'/'` | Custom separator |
|
|
1378
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Text size |
|
|
1379
|
-
| maxItems | `number` | — | Collapse threshold |
|
|
1380
|
-
| itemsBeforeCollapse | `number` | `1` | Items before ellipsis |
|
|
1381
|
-
| itemsAfterCollapse | `number` | `1` | Items after ellipsis |
|
|
1382
|
-
|
|
1383
|
-
**Sub-components:** Breadcrumb.List, Breadcrumb.Item, Breadcrumb.Link (with `asChild`), Breadcrumb.Page, Breadcrumb.Separator, Breadcrumb.Ellipsis
|
|
1384
|
-
|
|
1385
|
-
---
|
|
1386
|
-
|
|
1387
|
-
### Pagination
|
|
1388
|
-
|
|
1389
|
-
```tsx
|
|
1390
|
-
import { Pagination } from '@7onic-ui/react'
|
|
1391
|
-
|
|
1392
|
-
{/* Quick mode */}
|
|
1393
|
-
<Pagination total={10} defaultValue={1} />
|
|
1394
|
-
|
|
1395
|
-
{/* Compound mode */}
|
|
1396
|
-
<Pagination total={20} value={page} onChange={setPage}>
|
|
1397
|
-
<Pagination.Content>
|
|
1398
|
-
<Pagination.Previous />
|
|
1399
|
-
<Pagination.Items />
|
|
1400
|
-
<Pagination.Next />
|
|
1401
|
-
</Pagination.Content>
|
|
1402
|
-
</Pagination>
|
|
1403
|
-
```
|
|
1404
|
-
|
|
1405
|
-
| Prop (Root) | Type | Default | Description |
|
|
1406
|
-
|---|---|---|---|
|
|
1407
|
-
| total | `number` | required | Total pages |
|
|
1408
|
-
| value | `number` | — | Controlled page |
|
|
1409
|
-
| defaultValue | `number` | `1` | Uncontrolled default |
|
|
1410
|
-
| onChange | `(page: number) => void` | — | Change handler |
|
|
1411
|
-
| siblings | `number` | `1` | Pages beside current |
|
|
1412
|
-
| boundaries | `number` | `1` | Pages at start/end |
|
|
1413
|
-
| variant | `'default' \| 'outline' \| 'ghost'` | `'default'` | Visual style |
|
|
1414
|
-
| color | `'default' \| 'primary'` | `'default'` | Active page color |
|
|
1415
|
-
| size | `'xs' \| 'sm' \| 'default' \| 'lg' \| 'xl'` | `'default'` | Button size |
|
|
1416
|
-
| radius | `'none' \| 'sm' \| 'md' \| 'default' \| 'lg' \| 'full'` | `'default'` | Border radius |
|
|
1417
|
-
| loop | `boolean` | `false` | Wrap around |
|
|
1418
|
-
| disabled | `boolean` | `false` | Disabled state |
|
|
1419
|
-
|
|
1420
|
-
**Sub-components:** Pagination.Content, Pagination.Item, Pagination.Link, Pagination.Previous, Pagination.Next, Pagination.First, Pagination.Last, Pagination.Ellipsis, Pagination.Items
|
|
1421
|
-
|
|
1422
|
-
---
|
|
1423
|
-
|
|
1424
|
-
### NavigationMenu
|
|
1425
|
-
|
|
1426
|
-
```tsx
|
|
1427
|
-
import { NavigationMenu } from '@7onic-ui/react'
|
|
1428
|
-
|
|
1429
|
-
{/* Horizontal (header) */}
|
|
1430
|
-
<NavigationMenu orientation="horizontal">
|
|
1431
|
-
<NavigationMenu.List>
|
|
1432
|
-
<NavigationMenu.Item>
|
|
1433
|
-
<NavigationMenu.Link href="/" active>Home</NavigationMenu.Link>
|
|
1434
|
-
</NavigationMenu.Item>
|
|
1435
|
-
<NavigationMenu.Item>
|
|
1436
|
-
<NavigationMenu.Trigger>Products</NavigationMenu.Trigger>
|
|
1437
|
-
<NavigationMenu.Content>
|
|
1438
|
-
<NavigationMenu.Link href="/product-a">Product A</NavigationMenu.Link>
|
|
1439
|
-
<NavigationMenu.Link href="/product-b">Product B</NavigationMenu.Link>
|
|
1440
|
-
</NavigationMenu.Content>
|
|
1441
|
-
</NavigationMenu.Item>
|
|
1442
|
-
</NavigationMenu.List>
|
|
1443
|
-
<NavigationMenu.Viewport />
|
|
1444
|
-
</NavigationMenu>
|
|
1445
|
-
|
|
1446
|
-
{/* Vertical (sidebar) */}
|
|
1447
|
-
<NavigationMenu orientation="vertical" size="default">
|
|
1448
|
-
<NavigationMenu.List>
|
|
1449
|
-
<NavigationMenu.Group label="Main">
|
|
1450
|
-
<NavigationMenu.Item>
|
|
1451
|
-
<NavigationMenu.Link href="/" icon={<HomeIcon />} active>Dashboard</NavigationMenu.Link>
|
|
1452
|
-
</NavigationMenu.Item>
|
|
1453
|
-
</NavigationMenu.Group>
|
|
1454
|
-
</NavigationMenu.List>
|
|
1455
|
-
</NavigationMenu>
|
|
1456
|
-
```
|
|
1457
|
-
|
|
1458
|
-
| Prop (Root) | Type | Default | Description |
|
|
1459
|
-
|---|---|---|---|
|
|
1460
|
-
| orientation | `'horizontal' \| 'vertical'` | `'horizontal'` | Layout mode |
|
|
1461
|
-
| size | `'sm' \| 'md' \| 'default' \| 'lg'` | `'default'` | Item size |
|
|
1462
|
-
| collapsed | `boolean` | `false` | Icon-only mode (vertical) |
|
|
1463
|
-
| radius | Same as Button | `'default'` | Border radius |
|
|
1464
|
-
| fontWeight | `'normal' \| 'semibold'` | `'normal'` | Font weight |
|
|
1465
|
-
|
|
1466
|
-
| Prop (Link) | Type | Default | Description |
|
|
1467
|
-
|---|---|---|---|
|
|
1468
|
-
| active | `boolean` | `false` | Current page indicator |
|
|
1469
|
-
| icon | `ReactNode` | — | Leading icon |
|
|
1470
|
-
| asChild | `boolean` | `false` | Slot pattern |
|
|
1471
|
-
|
|
1472
|
-
**Sub-components:** NavigationMenu.List, NavigationMenu.Item, NavigationMenu.Trigger, NavigationMenu.Content, NavigationMenu.Link, NavigationMenu.Group (vertical only, with `label`), NavigationMenu.Indicator (horizontal only), NavigationMenu.Viewport
|
|
1473
|
-
|
|
1474
|
-
---
|
|
1475
|
-
|
|
1476
|
-
## Charts
|
|
1477
|
-
|
|
1478
|
-
### Chart (Container + Sub-components)
|
|
1479
|
-
|
|
1480
|
-
All chart types use the Chart namespace:
|
|
1481
|
-
|
|
1482
|
-
```tsx
|
|
1483
|
-
import { Chart } from '@7onic-ui/react/chart'
|
|
1484
|
-
|
|
1485
|
-
const chartConfig = {
|
|
1486
|
-
revenue: { label: 'Revenue', color: 'var(--color-chart-1)' },
|
|
1487
|
-
profit: { label: 'Profit', color: 'var(--color-chart-2)' },
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
{/* Line Chart */}
|
|
1491
|
-
<Chart config={chartConfig} className="h-[300px]">
|
|
1492
|
-
<Chart.XAxis dataKey="month" />
|
|
1493
|
-
<Chart.YAxis />
|
|
1494
|
-
<Chart.Tooltip content={<Chart.TooltipContent />} />
|
|
1495
|
-
<Chart.Legend content={<Chart.LegendContent />} />
|
|
1496
|
-
<Chart.Line dataKey="revenue" type="monotone" />
|
|
1497
|
-
<Chart.Line dataKey="profit" type="monotone" variant="dashed" />
|
|
1498
|
-
</Chart>
|
|
1499
|
-
|
|
1500
|
-
{/* Bar Chart */}
|
|
1501
|
-
<Chart config={chartConfig} className="h-[300px]" hoverFade>
|
|
1502
|
-
<Chart.XAxis dataKey="month" />
|
|
1503
|
-
<Chart.YAxis />
|
|
1504
|
-
<Chart.Tooltip content={<Chart.TooltipContent />} />
|
|
1505
|
-
<Chart.Bar dataKey="revenue" radius="md" />
|
|
1506
|
-
<Chart.Bar dataKey="profit" radius="md" />
|
|
1507
|
-
</Chart>
|
|
1508
|
-
|
|
1509
|
-
{/* Area Chart */}
|
|
1510
|
-
<Chart config={chartConfig} className="h-[300px]">
|
|
1511
|
-
<Chart.XAxis dataKey="month" />
|
|
1512
|
-
<Chart.YAxis />
|
|
1513
|
-
<Chart.Tooltip content={<Chart.TooltipContent />} />
|
|
1514
|
-
<Chart.Area dataKey="revenue" type="monotone" variant="gradient" />
|
|
1515
|
-
</Chart>
|
|
1516
|
-
|
|
1517
|
-
{/* Pie Chart */}
|
|
1518
|
-
<Chart config={chartConfig} className="h-[300px]">
|
|
1519
|
-
<Chart.Tooltip content={<Chart.TooltipContent />} />
|
|
1520
|
-
<Chart.Pie data={data} dataKey="value" nameKey="name" variant="donut" label="outside" />
|
|
1521
|
-
</Chart>
|
|
1522
|
-
```
|
|
1523
|
-
|
|
1524
|
-
**⚠️ chartConfig is REQUIRED.** It maps data keys to labels and colors.
|
|
1525
|
-
|
|
1526
|
-
| Prop (Container) | Type | Default | Description |
|
|
1527
|
-
|---|---|---|---|
|
|
1528
|
-
| config | `ChartConfig` | required | Data key → label/color mapping |
|
|
1529
|
-
| hoverFade | `boolean` | `false` | Fade non-hovered elements |
|
|
1530
|
-
|
|
1531
|
-
| Prop (Bar) | Type | Default | Description |
|
|
1532
|
-
|---|---|---|---|
|
|
1533
|
-
| radius | `'none' \| 'sm' \| 'base' \| 'md' \| 'lg'` | `'none'` | Bar corner radius |
|
|
1534
|
-
| layout | `'vertical' \| 'horizontal'` | `'vertical'` | Bar direction |
|
|
1535
|
-
| variant | `'solid' \| 'outline'` | `'solid'` | Fill style |
|
|
1536
|
-
| stackPosition | `'top' \| 'bottom'` | `'top'` | Stack position |
|
|
1537
|
-
|
|
1538
|
-
| Prop (Line) | Type | Default | Description |
|
|
1539
|
-
|---|---|---|---|
|
|
1540
|
-
| type | `'linear' \| 'monotone' \| 'step' \| 'natural'` | `'monotone'` | Curve type |
|
|
1541
|
-
| variant | `'solid' \| 'dashed'` | `'solid'` | Line style |
|
|
1542
|
-
| dot | `boolean` | `true` | Show data points |
|
|
1543
|
-
| activeDot | `boolean` | `true` | Show active point |
|
|
1544
|
-
|
|
1545
|
-
| Prop (Area) | Type | Default | Description |
|
|
1546
|
-
|---|---|---|---|
|
|
1547
|
-
| type | `'linear' \| 'monotone' \| 'step' \| 'natural'` | `'monotone'` | Curve type |
|
|
1548
|
-
| variant | `'solid' \| 'gradient'` | `'solid'` | Fill style |
|
|
1549
|
-
| fillOpacity | `number` | `0.4` | Fill opacity (0-1) |
|
|
1550
|
-
|
|
1551
|
-
| Prop (Pie) | Type | Default | Description |
|
|
1552
|
-
|---|---|---|---|
|
|
1553
|
-
| variant | `'pie' \| 'donut'` | `'pie'` | Pie or donut |
|
|
1554
|
-
| label | `'none' \| 'outside' \| 'inside'` | `'none'` | Label display |
|
|
1555
|
-
| labelContent | `'value' \| 'percent'` | `'value'` | Label format |
|
|
1556
|
-
| activeShape | `boolean` | `true` | Expand on hover |
|
|
1557
|
-
|
|
1558
|
-
**Chart Colors (CSS variables):**
|
|
1559
|
-
`--color-chart-1` (blue), `--color-chart-2` (pink), `--color-chart-3` (lavender), `--color-chart-4` (sky), `--color-chart-5` (rose)
|
|
1560
|
-
Each has light/dark theme variants.
|
|
1561
|
-
|
|
1562
|
-
**ChartConfig format:**
|
|
1563
|
-
```tsx
|
|
1564
|
-
type ChartConfig = {
|
|
1565
|
-
[dataKey: string]: {
|
|
1566
|
-
label?: ReactNode
|
|
1567
|
-
icon?: ComponentType
|
|
1568
|
-
color?: string // CSS color or variable
|
|
1569
|
-
// OR theme-specific:
|
|
1570
|
-
theme?: { light: string, dark: string }
|
|
1571
|
-
}
|
|
1572
|
-
}
|
|
1573
|
-
```
|
|
1574
|
-
|
|
1575
|
-
---
|
|
1576
|
-
|
|
1577
|
-
### MetricCard
|
|
1578
|
-
|
|
1579
|
-
```tsx
|
|
1580
|
-
import { MetricCard } from '@7onic-ui/react'
|
|
1581
|
-
|
|
1582
|
-
<MetricCard>
|
|
1583
|
-
<MetricCard.Header>
|
|
1584
|
-
<MetricCard.Title>Revenue</MetricCard.Title>
|
|
1585
|
-
<MetricCard.Symbol><DollarIcon /></MetricCard.Symbol>
|
|
1586
|
-
</MetricCard.Header>
|
|
1587
|
-
<MetricCard.Value animated>$12,450</MetricCard.Value>
|
|
1588
|
-
<MetricCard.Trend direction="up">+12.5%</MetricCard.Trend>
|
|
1589
|
-
<MetricCard.Description>vs. last month</MetricCard.Description>
|
|
1590
|
-
</MetricCard>
|
|
1591
|
-
```
|
|
1592
|
-
|
|
1593
|
-
| Prop (Root) | Type | Default | Description |
|
|
1594
|
-
|---|---|---|---|
|
|
1595
|
-
| variant | `'default' \| 'elevated' \| 'ghost'` | `'default'` | Visual style |
|
|
1596
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Padding scale |
|
|
1597
|
-
| radius | Same as Card + `'none'` | `'xl'` | Border radius |
|
|
1598
|
-
|
|
1599
|
-
| Prop (Value) | Type | Default | Description |
|
|
1600
|
-
|---|---|---|---|
|
|
1601
|
-
| animated | `boolean` | `false` | Number count-up animation |
|
|
1602
|
-
|
|
1603
|
-
| Prop (Trend) | Type | Default | Description |
|
|
1604
|
-
|---|---|---|---|
|
|
1605
|
-
| direction | `'up' \| 'down' \| 'neutral'` | — | Trend arrow + color |
|
|
1606
|
-
|
|
1607
|
-
**Sub-components:** MetricCard.Header, MetricCard.Title, MetricCard.Value, MetricCard.Trend, MetricCard.Description, MetricCard.Symbol
|
|
1608
|
-
|
|
1609
|
-
---
|
|
1610
|
-
|
|
1611
|
-
# ═══ SECTION 4: COMPONENT USAGE GUIDE ═══
|
|
1612
|
-
|
|
1613
|
-
## Component Selection
|
|
1614
|
-
|
|
1615
|
-
Before creating custom UI, check if 7onic already has it:
|
|
1616
|
-
|
|
1617
|
-
| Need | Use This Component |
|
|
1618
|
-
|---|---|
|
|
1619
|
-
| Action trigger | Button, IconButton |
|
|
1620
|
-
| Text input | Input (single line), Textarea (multi line) |
|
|
1621
|
-
| Selection (one) | RadioGroup, Select, Segmented |
|
|
1622
|
-
| Selection (many) | Checkbox, ToggleGroup |
|
|
1623
|
-
| Boolean toggle | Switch, Toggle, Checkbox |
|
|
1624
|
-
| Container | Card |
|
|
1625
|
-
| Data table | Table |
|
|
1626
|
-
| Tabs | Tabs |
|
|
1627
|
-
| Collapsible | Accordion |
|
|
1628
|
-
| Dialog | Modal |
|
|
1629
|
-
| Side panel | Drawer |
|
|
1630
|
-
| Hint text | Tooltip |
|
|
1631
|
-
| Rich hint | Popover |
|
|
1632
|
-
| Notification | Toast (imperative), Alert (inline) |
|
|
1633
|
-
| Loading | Spinner (indeterminate), Progress (determinate), Skeleton (placeholder) |
|
|
1634
|
-
| Navigation | Breadcrumb, Pagination, NavigationMenu |
|
|
1635
|
-
| Data visualization | Chart (Line/Area/Bar/Pie), MetricCard |
|
|
1636
|
-
| Metric display | MetricCard |
|
|
1637
|
-
| Tag / chip | Badge (with `removable`) |
|
|
1638
|
-
| Avatar | Avatar |
|
|
1639
|
-
| Separator | Divider |
|
|
1640
|
-
|
|
1641
|
-
**If the component exists, use it.** Don't build custom versions with HTML + classes.
|
|
1642
|
-
|
|
1643
|
-
---
|
|
1644
|
-
|
|
1645
|
-
## Import Pattern
|
|
1646
|
-
|
|
1647
|
-
```tsx
|
|
1648
|
-
// ✅ Single import path
|
|
1649
|
-
import { Button, Card, Input, toast } from '@7onic-ui/react'
|
|
1650
|
-
|
|
1651
|
-
// ✅ Chart components use a separate entry point (recharts is optional)
|
|
1652
|
-
import { Chart } from '@7onic-ui/react/chart'
|
|
1653
|
-
|
|
1654
|
-
// ❌ Never import from internal paths
|
|
1655
|
-
import { Button } from '@7onic-ui/react/components/button' // WRONG
|
|
1656
|
-
|
|
1657
|
-
// ❌ Never import Radix directly
|
|
1658
|
-
import * as Dialog from '@radix-ui/react-dialog' // WRONG → use Modal
|
|
1659
|
-
```
|
|
1660
|
-
|
|
1661
|
-
---
|
|
1662
|
-
|
|
1663
|
-
## Compound Component Structure
|
|
1664
|
-
|
|
1665
|
-
Compound components have **required sub-components**. Missing them causes errors or broken UI.
|
|
1666
|
-
|
|
1667
|
-
**Modal — required structure:**
|
|
1668
|
-
```tsx
|
|
1669
|
-
<Modal>
|
|
1670
|
-
<Modal.Trigger>...</Modal.Trigger>
|
|
1671
|
-
<Modal.Portal> {/* ← Required for correct z-index */}
|
|
1672
|
-
<Modal.Overlay /> {/* ← Required for backdrop */}
|
|
1673
|
-
<Modal.Content>
|
|
1674
|
-
<Modal.Header>
|
|
1675
|
-
<Modal.Title>...</Modal.Title>
|
|
1676
|
-
</Modal.Header>
|
|
1677
|
-
<Modal.Body>...</Modal.Body>
|
|
1678
|
-
</Modal.Content>
|
|
1679
|
-
</Modal.Portal>
|
|
1680
|
-
</Modal>
|
|
1681
|
-
```
|
|
1682
|
-
|
|
1683
|
-
**Drawer — same pattern as Modal** (Portal + Overlay + Content required)
|
|
1684
|
-
|
|
1685
|
-
**Tooltip — Provider required:**
|
|
1686
|
-
```tsx
|
|
1687
|
-
<Tooltip.Provider> {/* ← Required, wrap app once */}
|
|
1688
|
-
<Tooltip>
|
|
1689
|
-
<Tooltip.Trigger>...</Tooltip.Trigger>
|
|
1690
|
-
<Tooltip.Portal>
|
|
1691
|
-
<Tooltip.Content>...</Tooltip.Content>
|
|
1692
|
-
</Tooltip.Portal>
|
|
1693
|
-
</Tooltip>
|
|
1694
|
-
</Tooltip.Provider>
|
|
1695
|
-
```
|
|
1696
|
-
|
|
1697
|
-
**Toast — imperative API, no compound structure:**
|
|
1698
|
-
```tsx
|
|
1699
|
-
// Place Toaster once in layout
|
|
1700
|
-
<Toaster />
|
|
1701
|
-
// Call toast() anywhere
|
|
1702
|
-
toast.success('Done')
|
|
1703
|
-
```
|
|
1704
|
-
|
|
1705
|
-
---
|
|
1706
|
-
|
|
1707
|
-
## asChild Pattern (Slot)
|
|
1708
|
-
|
|
1709
|
-
`asChild` replaces the component's DOM element with its child, keeping styles and behavior:
|
|
1710
|
-
|
|
1711
|
-
```tsx
|
|
1712
|
-
// ❌ Double <a> — broken HTML
|
|
1713
|
-
<Link href="/about">
|
|
1714
|
-
<Button>About</Button>
|
|
1715
|
-
</Link>
|
|
1716
|
-
|
|
1717
|
-
// ✅ Button renders as <a> with Button styles
|
|
1718
|
-
<Button asChild>
|
|
1719
|
-
<Link href="/about">About</Link>
|
|
1720
|
-
</Button>
|
|
1721
|
-
|
|
1722
|
-
// ✅ DropdownMenu item as link
|
|
1723
|
-
<DropdownMenu.Item asChild>
|
|
1724
|
-
<Link href="/settings">Settings</Link>
|
|
1725
|
-
</DropdownMenu.Item>
|
|
1726
|
-
|
|
1727
|
-
// ✅ Breadcrumb as Next.js Link
|
|
1728
|
-
<Breadcrumb.Link asChild>
|
|
1729
|
-
<Link href="/">Home</Link>
|
|
1730
|
-
</Breadcrumb.Link>
|
|
1731
|
-
```
|
|
1732
|
-
|
|
1733
|
-
**Use `asChild` when combining 7onic components with routing `<Link>`.**
|
|
1734
|
-
Components that support `asChild`: Button, IconButton, Badge, Card, Modal.Trigger, Modal.Close, Drawer.Trigger, Drawer.Close, DropdownMenu.Item, Breadcrumb.Link, NavigationMenu.Link, Tooltip.Trigger, Popover.Trigger
|
|
1735
|
-
|
|
1736
|
-
---
|
|
1737
|
-
|
|
1738
|
-
## Props Usage
|
|
1739
|
-
|
|
1740
|
-
**Always use allowed values.** Don't pass arbitrary strings to variant/size/color props.
|
|
1741
|
-
|
|
1742
|
-
```tsx
|
|
1743
|
-
// ✅ Correct
|
|
1744
|
-
<Button variant="solid" size="default" color="primary" />
|
|
1745
|
-
|
|
1746
|
-
// ❌ Wrong — invalid values
|
|
1747
|
-
<Button variant="primary" /> // 'primary' is a color, not a variant
|
|
1748
|
-
<Button size="medium" /> // Use 'md' or 'default', not 'medium'
|
|
1749
|
-
<Button color="blue" /> // Use 'primary', not raw color names
|
|
1750
|
-
```
|
|
1751
|
-
|
|
1752
|
-
**`className` on components = layout ONLY** (margin, width, flex positioning). All visual styling (color, size, radius, variant) must use Props.
|
|
1753
|
-
|
|
1754
|
-
**Style via Props, not className:**
|
|
1755
|
-
```tsx
|
|
1756
|
-
// ✅ Use Props
|
|
1757
|
-
<Button color="primary" size="lg" />
|
|
1758
|
-
<Badge color="error" variant="subtle" />
|
|
1759
|
-
|
|
1760
|
-
// ❌ Don't override with className
|
|
1761
|
-
<Button className="bg-blue-500 text-white" />
|
|
1762
|
-
<Badge className="bg-red-100" />
|
|
1763
|
-
```
|
|
1764
|
-
|
|
1765
|
-
---
|
|
1766
|
-
|
|
1767
|
-
## Form Patterns
|
|
1768
|
-
|
|
1769
|
-
**Use Field wrapper** for labeled form elements with validation:
|
|
1770
|
-
|
|
1771
|
-
```tsx
|
|
1772
|
-
import { Field, Input, Textarea, Checkbox } from '@7onic-ui/react'
|
|
1773
|
-
|
|
1774
|
-
{/* Text input with label + error */}
|
|
1775
|
-
<Field error={errors.email}>
|
|
1776
|
-
<Field.Label required>Email</Field.Label>
|
|
1777
|
-
<Input placeholder="you@example.com" />
|
|
1778
|
-
<Field.Error />
|
|
1779
|
-
</Field>
|
|
1780
|
-
|
|
1781
|
-
{/* Textarea with character count */}
|
|
1782
|
-
<Field>
|
|
1783
|
-
<Field.Label>Bio</Field.Label>
|
|
1784
|
-
<Textarea maxLength={200} />
|
|
1785
|
-
<Field.CharCount />
|
|
1786
|
-
</Field>
|
|
1787
|
-
```
|
|
1788
|
-
|
|
1789
|
-
**Field context auto-connects** to Input, Textarea, Select, Checkbox, RadioGroup:
|
|
1790
|
-
- Passes `error` state
|
|
1791
|
-
- Passes `disabled` state
|
|
1792
|
-
- Auto-generates matching `id` / `htmlFor` / `aria-describedby`
|
|
1793
|
-
|
|
1794
|
-
---
|
|
1795
|
-
|
|
1796
|
-
## Chart Patterns
|
|
1797
|
-
|
|
1798
|
-
**⚠️ recharts is required.** Auto-install when using any Chart component:
|
|
1799
|
-
```bash
|
|
1800
|
-
npm install recharts
|
|
1801
|
-
```
|
|
1802
|
-
|
|
1803
|
-
**Always provide chartConfig:**
|
|
1804
|
-
```tsx
|
|
1805
|
-
const chartConfig = {
|
|
1806
|
-
revenue: { label: 'Revenue', color: 'var(--color-chart-1)' },
|
|
1807
|
-
expenses: { label: 'Expenses', color: 'var(--color-chart-2)' },
|
|
1808
|
-
}
|
|
1809
|
-
```
|
|
1810
|
-
|
|
1811
|
-
**Available chart colors (CSS variables, auto-adapt to light/dark):**
|
|
1812
|
-
- `var(--color-chart-1)` — blue
|
|
1813
|
-
- `var(--color-chart-2)` — pink
|
|
1814
|
-
- `var(--color-chart-3)` — lavender
|
|
1815
|
-
- `var(--color-chart-4)` — sky
|
|
1816
|
-
- `var(--color-chart-5)` — rose
|
|
1817
|
-
|
|
1818
|
-
**Container height is required (layout arbitrary value — allowed):**
|
|
1819
|
-
```tsx
|
|
1820
|
-
<Chart config={chartConfig} className="h-[300px]">
|
|
1821
|
-
```
|
|
1822
|
-
|
|
1823
|
-
---
|
|
1824
|
-
|
|
1825
|
-
## Overlay Patterns
|
|
1826
|
-
|
|
1827
|
-
**All overlays use Portal for correct stacking:**
|
|
1828
|
-
```tsx
|
|
1829
|
-
<Modal.Portal>
|
|
1830
|
-
<Modal.Overlay />
|
|
1831
|
-
<Modal.Content>...</Modal.Content>
|
|
1832
|
-
</Modal.Portal>
|
|
1833
|
-
```
|
|
1834
|
-
|
|
1835
|
-
**Z-index hierarchy (automatic via tokens) — never set custom z-index:**
|
|
1836
|
-
1. `z-dropdown` (1000) — Dropdown, Select
|
|
1837
|
-
2. `z-overlay` (1100) — Modal/Drawer overlay
|
|
1838
|
-
3. `z-modal` (2000) — Modal/Drawer content
|
|
1839
|
-
4. `z-popover` (2100) — Popover
|
|
1840
|
-
5. `z-tooltip` (2200) — Tooltip
|
|
1841
|
-
6. `z-toast` (3000) — Toast
|
|
1842
|
-
|
|
1843
|
-
---
|
|
1844
|
-
|
|
1845
|
-
## Accessibility
|
|
1846
|
-
|
|
1847
|
-
**Built-in (via Radix UI):** keyboard navigation, focus trap, ARIA attributes, screen reader.
|
|
1848
|
-
|
|
1849
|
-
**Do NOT override:**
|
|
1850
|
-
```tsx
|
|
1851
|
-
// ❌ Never remove focus ring
|
|
1852
|
-
<Button className="outline-none focus:outline-none" />
|
|
1853
|
-
|
|
1854
|
-
// ✅ Focus ring is managed by the design system
|
|
1855
|
-
<Button />
|
|
1856
|
-
```
|
|
1857
|
-
|
|
1858
|
-
**Always provide labels:**
|
|
1859
|
-
```tsx
|
|
1860
|
-
<IconButton aria-label="Close"><XIcon /></IconButton>
|
|
1861
|
-
|
|
1862
|
-
<Field>
|
|
1863
|
-
<Field.Label>Email</Field.Label>
|
|
1864
|
-
<Input />
|
|
1865
|
-
</Field>
|
|
1866
|
-
```
|
|
1867
|
-
|
|
1868
|
-
---
|
|
1869
|
-
|
|
1870
|
-
## Responsive Layout
|
|
1871
|
-
|
|
1872
|
-
**Mobile-first with token breakpoints:**
|
|
1873
|
-
```tsx
|
|
1874
|
-
<div className="flex flex-col md:flex-row gap-4 md:gap-6">
|
|
1875
|
-
<Card className="w-full md:w-1/2">...</Card>
|
|
1876
|
-
<Card className="w-full md:w-1/2">...</Card>
|
|
1877
|
-
</div>
|
|
1878
|
-
```
|
|
1879
|
-
|
|
1880
|
-
**Use component Props for sizing, not className overrides:**
|
|
1881
|
-
```tsx
|
|
1882
|
-
// ✅ Correct
|
|
1883
|
-
<Button size="default" />
|
|
1884
|
-
|
|
1885
|
-
// ❌ Wrong
|
|
1886
|
-
<Button size="sm" className="md:h-10 md:px-4" />
|
|
1887
|
-
```
|
|
1888
|
-
|
|
1889
|
-
---
|
|
1890
|
-
|
|
1891
|
-
## Performance
|
|
1892
|
-
|
|
1893
|
-
**Tree-shaking works automatically:**
|
|
1894
|
-
```tsx
|
|
1895
|
-
import { Button, Card, Input } from '@7onic-ui/react'
|
|
1896
|
-
```
|
|
1897
|
-
|
|
1898
|
-
**Don't wrap components unnecessarily:**
|
|
1899
|
-
```tsx
|
|
1900
|
-
// ❌ Unnecessary
|
|
1901
|
-
function MyButton(props) { return <Button {...props} /> }
|
|
1902
|
-
|
|
1903
|
-
// ✅ Use directly
|
|
1904
|
-
<Button variant="solid" color="primary">Submit</Button>
|
|
1905
|
-
```
|
|
1906
|
-
|
|
1907
|
-
**Next.js App Router:** 7onic components have `'use client'` internally — they render in Server Components.
|
|
1908
|
-
But if YOUR code uses React hooks (`useState`, `useEffect`) or event handlers (`onClick`, `onChange`), add `'use client'` at the top of your file. When in doubt, add `'use client'` — it's always safe.
|
|
1909
|
-
|
|
1910
|
-
---
|
|
1911
|
-
|
|
1912
|
-
# ═══ SECTION 5: COMPLETE COMPONENT SUMMARY ═══
|
|
1913
|
-
|
|
1914
|
-
## Quick Reference Table
|
|
1915
|
-
|
|
1916
|
-
| Component | Type | Variants | Sizes | Colors | Key Feature |
|
|
1917
|
-
|---|---|---|---|---|---|
|
|
1918
|
-
| Button | Standalone | solid/outline/ghost/link | xs/sm/md/default/lg | default/primary/secondary/destructive | loading, icons, press effect |
|
|
1919
|
-
| IconButton | Standalone | solid/outline/ghost/subtle | xs/sm/md/default/lg | default/primary/secondary/destructive | Square, icon-only |
|
|
1920
|
-
| ButtonGroup | Container | outline/ghost | (inherits) | (inherits) | Context provider, attached |
|
|
1921
|
-
| Input | Standalone | default/filled | xs/sm/default/lg/xl | — | leftIcon/rightIcon, error |
|
|
1922
|
-
| Textarea | Standalone | default/filled | compact/default | — | resize options |
|
|
1923
|
-
| Select | Compound | — | xs/sm/default/lg/xl | — | Trigger + Content + Item |
|
|
1924
|
-
| DropdownMenu | Compound | — | sm/md/lg | — | CheckboxItem, RadioItem, Sub |
|
|
1925
|
-
| Checkbox | Standalone | — | sm/default/lg | default/primary | indeterminate, label |
|
|
1926
|
-
| RadioGroup | Compound | — | sm/default/lg | default/primary | Item with label |
|
|
1927
|
-
| Switch | Standalone | — | sm/default/lg | 5 colors | label positions, icons |
|
|
1928
|
-
| Toggle | Standalone | default/outline/ghost/outline-ghost | xs/sm/md/default/lg | — | pressed state |
|
|
1929
|
-
| ToggleGroup | Compound | default/outline | xs/sm/md/default/lg | — | single/multiple |
|
|
1930
|
-
| Segmented | Compound | default/outline/underline/ghost | sm/md/default/lg | — | Tab-like selection |
|
|
1931
|
-
| Slider | Standalone | — | sm/default/lg | default/primary | tooltip, range |
|
|
1932
|
-
| Field | Compound | — | — | — | Label, Error, CharCount |
|
|
1933
|
-
| Avatar | Compound | — | xs/sm/default/lg/xl/2xl | — | colorized fallback, Group |
|
|
1934
|
-
| Badge | Standalone | solid/subtle/outline | sm/default/lg | default/primary/success/warning/error/info | dot, removable |
|
|
1935
|
-
| Card | Compound | default/outline/ghost | sm/default/lg | — | Image overlay, interactive |
|
|
1936
|
-
| Table | Compound | default/bordered/striped | sm/default/lg | — | stickyHeader, sortable |
|
|
1937
|
-
| Tabs | Compound | line/enclosed/pill | sm/md/default/lg | default/primary | fitted |
|
|
1938
|
-
| Accordion | Compound | default/bordered/splitted | sm/default/lg | — | single/multiple |
|
|
1939
|
-
| Divider | Standalone | solid/dashed/dotted | — | default/muted/strong | label |
|
|
1940
|
-
| Modal | Compound | — | xs/sm/md/lg/xl/full | — | scrollBehavior |
|
|
1941
|
-
| Drawer | Compound | — | sm/md/lg/xl/full | — | 4 sides |
|
|
1942
|
-
| Tooltip | Compound | default/inverted | sm/default | — | Provider required |
|
|
1943
|
-
| Popover | Compound | default/elevated | sm/default/lg | — | arrow, close button |
|
|
1944
|
-
| Alert | Compound | default/outline/filled | sm/default/lg | info/success/warning/error | closable |
|
|
1945
|
-
| Toast | Imperative | — | sm/default/lg | 6 types | promise, action |
|
|
1946
|
-
| Progress | Standalone | default/striped | sm/default/lg | default/primary | linear/circular |
|
|
1947
|
-
| Spinner | Standalone | ring/dots/bars/orbit | sm/default/lg | default/primary/current | 5 orbit styles |
|
|
1948
|
-
| Skeleton | Standalone | text/circular/rectangular | — | — | pulse/wave, count |
|
|
1949
|
-
| Breadcrumb | Compound | — | sm/default/lg | — | maxItems collapse |
|
|
1950
|
-
| Pagination | Compound | default/outline/ghost | xs/sm/default/lg/xl | default/primary | compound or auto |
|
|
1951
|
-
| NavigationMenu | Compound | — | sm/md/default/lg | — | horizontal/vertical, collapsed |
|
|
1952
|
-
| Chart | Compound | — | — | chart colors | Bar/Line/Area/Pie |
|
|
1953
|
-
| MetricCard | Compound | default/elevated/ghost | sm/default/lg | — | animated value, trend |
|
|
1954
|
-
| TypingIndicator | Standalone | dots/cursor | sm/default/lg | default/primary/muted | speed (dots only), animate-typing-cursor, showLabel |
|
|
1955
|
-
| QuickReply | Compound | outline/filled/ghost | sm/default/lg | default/primary | layout (scroll/wrap), radius (md/lg/full), gap, icon, asChild |
|
|
1956
|
-
| ChatInput | Compound | outline/filled | sm/default/lg | default/primary | layout (default/inline), radius (sm/md/lg/xl/2xl/full), buttonRadius, auto-resize, showCount, loading, onStop |
|
|
1957
|
-
| ChatMessage | Compound | bubble/flat | sm/default/lg | default/muted/primary/dark | role (assistant/user), tail, avatarSize, radius (md/lg/xl/2xl), typing, actions, Avatar/Content/Footer sub-components |
|
|
1958
|
-
---
|
|
1959
|
-
|
|
1960
|
-
### TypingIndicator
|
|
1961
|
-
|
|
1962
|
-
```tsx
|
|
1963
|
-
import { TypingIndicator } from '@7onic-ui/react'
|
|
1964
|
-
|
|
1965
|
-
{/* Default — dots, muted, default size */}
|
|
1966
|
-
<TypingIndicator />
|
|
1967
|
-
|
|
1968
|
-
{/* Cursor variant */}
|
|
1969
|
-
<TypingIndicator variant="cursor" />
|
|
1970
|
-
|
|
1971
|
-
{/* Chat bubble */}
|
|
1972
|
-
<TypingIndicator variant="dots" color="muted" />
|
|
1973
|
-
|
|
1974
|
-
{/* AI response — fast with label */}
|
|
1975
|
-
<TypingIndicator
|
|
1976
|
-
variant="dots"
|
|
1977
|
-
color="primary"
|
|
1978
|
-
speed="fast"
|
|
1979
|
-
showLabel
|
|
1980
|
-
label="AI is typing..."
|
|
1981
|
-
/>
|
|
1982
|
-
|
|
1983
|
-
{/* Large cursor, primary color */}
|
|
1984
|
-
<TypingIndicator variant="cursor" size="lg" color="primary" />
|
|
1985
|
-
```
|
|
1986
|
-
|
|
1987
|
-
| Prop | Type | Default | Description |
|
|
1988
|
-
|---|---|---|---|
|
|
1989
|
-
| variant | `'dots' \| 'cursor'` | `'dots'` | Animation style |
|
|
1990
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Size |
|
|
1991
|
-
| color | `'default' \| 'primary' \| 'muted'` | `'muted'` | Color |
|
|
1992
|
-
| speed | `'slow' \| 'default' \| 'fast'` | `'default'` | Speed (dots only) |
|
|
1993
|
-
| label | `string` | `'Typing'` | aria-label and showLabel text |
|
|
1994
|
-
| showLabel | `boolean` | `false` | Show text label alongside indicator |
|
|
1995
|
-
|
|
1996
|
-
---
|
|
1997
|
-
|
|
1998
|
-
### QuickReply
|
|
1999
|
-
|
|
2000
|
-
```tsx
|
|
2001
|
-
import { QuickReply } from '@7onic-ui/react'
|
|
2002
|
-
|
|
2003
|
-
{/* Basic suggested replies */}
|
|
2004
|
-
<QuickReply aria-label="Suggested replies">
|
|
2005
|
-
<QuickReply.Item>About payment</QuickReply.Item>
|
|
2006
|
-
<QuickReply.Item>Shipping info</QuickReply.Item>
|
|
2007
|
-
<QuickReply.Item>Return policy</QuickReply.Item>
|
|
2008
|
-
</QuickReply>
|
|
2009
|
-
|
|
2010
|
-
{/* Primary color, filled variant */}
|
|
2011
|
-
<QuickReply color="primary" variant="filled" aria-label="Quick replies">
|
|
2012
|
-
<QuickReply.Item>Payment</QuickReply.Item>
|
|
2013
|
-
<QuickReply.Item>Shipping</QuickReply.Item>
|
|
2014
|
-
</QuickReply>
|
|
2015
|
-
|
|
2016
|
-
{/* Wrap layout for FAQ */}
|
|
2017
|
-
<QuickReply layout="wrap" aria-label="FAQ topics">
|
|
2018
|
-
<QuickReply.Item>Payments</QuickReply.Item>
|
|
2019
|
-
<QuickReply.Item>Shipping</QuickReply.Item>
|
|
2020
|
-
<QuickReply.Item>Returns</QuickReply.Item>
|
|
2021
|
-
<QuickReply.Item>Account</QuickReply.Item>
|
|
2022
|
-
</QuickReply>
|
|
2023
|
-
|
|
2024
|
-
{/* With icon */}
|
|
2025
|
-
<QuickReply aria-label="Actions">
|
|
2026
|
-
<QuickReply.Item icon={<MessageCircle />}>Contact us</QuickReply.Item>
|
|
2027
|
-
<QuickReply.Item icon={<Package />}>Track order</QuickReply.Item>
|
|
2028
|
-
</QuickReply>
|
|
2029
|
-
```
|
|
2030
|
-
|
|
2031
|
-
| Prop (QuickReply) | Type | Default | Description |
|
|
2032
|
-
|---|---|---|---|
|
|
2033
|
-
| layout | `'scroll' \| 'wrap'` | `'scroll'` | Chip layout mode |
|
|
2034
|
-
| variant | `'outline' \| 'filled' \| 'ghost'` | `'outline'` | Visual style |
|
|
2035
|
-
| color | `'default' \| 'primary'` | `'default'` | Color theme |
|
|
2036
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Chip size |
|
|
2037
|
-
| radius | `'md' \| 'lg' \| 'full'` | `'full'` | Border radius |
|
|
2038
|
-
| gap | `'sm' \| 'default' \| 'lg'` | `'default'` | Gap between chips |
|
|
2039
|
-
|
|
2040
|
-
| Prop (QuickReply.Item) | Type | Default | Description |
|
|
2041
|
-
|---|---|---|---|
|
|
2042
|
-
| icon | `ReactNode` | — | Leading icon |
|
|
2043
|
-
| asChild | `boolean` | `false` | Compose with custom element (Radix Slot) |
|
|
2044
|
-
| disabled | `boolean` | `false` | Disable the chip |
|
|
2045
|
-
| onClick | `() => void` | — | Click callback |
|
|
2046
|
-
|
|
2047
|
-
---
|
|
2048
|
-
|
|
2049
|
-
### ChatInput
|
|
2050
|
-
|
|
2051
|
-
```tsx
|
|
2052
|
-
import { ChatInput } from '@7onic-ui/react'
|
|
2053
|
-
|
|
2054
|
-
{/* Basic uncontrolled */}
|
|
2055
|
-
<ChatInput onSubmit={(value) => console.log(value)}>
|
|
2056
|
-
<ChatInput.Field placeholder="Ask me anything..." />
|
|
2057
|
-
<ChatInput.Submit />
|
|
2058
|
-
</ChatInput>
|
|
2059
|
-
|
|
2060
|
-
{/* Controlled mode */}
|
|
2061
|
-
const [value, setValue] = useState('')
|
|
2062
|
-
<ChatInput onSubmit={(v) => { handleSend(v); setValue('') }}>
|
|
2063
|
-
<ChatInput.Field
|
|
2064
|
-
value={value}
|
|
2065
|
-
onChange={(e) => setValue(e.target.value)}
|
|
2066
|
-
placeholder="Ask me anything..."
|
|
2067
|
-
/>
|
|
2068
|
-
<ChatInput.Submit />
|
|
2069
|
-
</ChatInput>
|
|
2070
|
-
|
|
2071
|
-
{/* With loading state + stop */}
|
|
2072
|
-
<ChatInput onSubmit={handleSubmit}>
|
|
2073
|
-
<ChatInput.Field placeholder="Ask me anything..." />
|
|
2074
|
-
<ChatInput.Submit
|
|
2075
|
-
loading={isLoading}
|
|
2076
|
-
onStop={() => abortController.abort()}
|
|
2077
|
-
/>
|
|
2078
|
-
</ChatInput>
|
|
2079
|
-
|
|
2080
|
-
{/* Character count */}
|
|
2081
|
-
<ChatInput onSubmit={(value) => console.log(value)}>
|
|
2082
|
-
<ChatInput.Field placeholder="Ask me anything..." showCount maxLength={500} />
|
|
2083
|
-
<ChatInput.Submit />
|
|
2084
|
-
</ChatInput>
|
|
2085
|
-
|
|
2086
|
-
{/* Filled variant, large, custom radius */}
|
|
2087
|
-
<ChatInput variant="filled" size="lg" radius="2xl" onSubmit={(v) => console.log(v)}>
|
|
2088
|
-
<ChatInput.Field placeholder="Ask me anything..." maxRows={6} />
|
|
2089
|
-
<ChatInput.Submit />
|
|
2090
|
-
</ChatInput>
|
|
2091
|
-
|
|
2092
|
-
{/* Inline layout (single-line field + button side by side) */}
|
|
2093
|
-
<ChatInput layout="inline" radius="full" onSubmit={(value) => console.log(value)}>
|
|
2094
|
-
<ChatInput.Field placeholder="Message..." />
|
|
2095
|
-
<ChatInput.Submit />
|
|
2096
|
-
</ChatInput>
|
|
2097
|
-
|
|
2098
|
-
{/* Inline with custom button radius */}
|
|
2099
|
-
<ChatInput layout="inline" radius="xl" onSubmit={handleSubmit}>
|
|
2100
|
-
<ChatInput.Field placeholder="Message..." />
|
|
2101
|
-
<ChatInput.Submit buttonRadius="full" loading={isLoading} onStop={handleStop} />
|
|
2102
|
-
</ChatInput>
|
|
2103
|
-
```
|
|
2104
|
-
|
|
2105
|
-
| Prop (ChatInput) | Type | Default | Description |
|
|
2106
|
-
|---|---|---|---|
|
|
2107
|
-
| variant | `'outline' \| 'filled'` | `'outline'` | Visual style |
|
|
2108
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Size scale |
|
|
2109
|
-
| radius | `'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl' \| 'full'` | `'xl'` | Corner radius (`'full'` available in inline layout) |
|
|
2110
|
-
| color | `'default' \| 'primary'` | `'default'` | Submit button color |
|
|
2111
|
-
| layout | `'default' \| 'inline'` | `'default'` | `'inline'` renders field and button side by side |
|
|
2112
|
-
| disabled | `boolean` | `false` | Disable input and submit |
|
|
2113
|
-
| onSubmit | `(value: string) => void` | — | Submit callback |
|
|
2114
|
-
|
|
2115
|
-
| Prop (ChatInput.Field) | Type | Default | Description |
|
|
2116
|
-
|---|---|---|---|
|
|
2117
|
-
| maxRows | `number` | `8` | Max rows before scrolling |
|
|
2118
|
-
| showCount | `boolean` | `false` | Show character counter (default layout only) |
|
|
2119
|
-
| maxLength | `number` | — | Max characters |
|
|
2120
|
-
| placeholder | `string` | — | Placeholder text |
|
|
2121
|
-
|
|
2122
|
-
| Prop (ChatInput.Submit) | Type | Default | Description |
|
|
2123
|
-
|---|---|---|---|
|
|
2124
|
-
| loading | `boolean` | `false` | Switch to stop icon — button stays enabled |
|
|
2125
|
-
| onStop | `() => void` | — | Called on click when loading |
|
|
2126
|
-
| buttonRadius | `'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl' \| 'full'` | — | Override button radius (default: auto from container radius) |
|
|
2127
|
-
| children | `ReactNode` | — | Custom icon (default: send arrow) |
|
|
2128
|
-
|
|
2129
|
-
### ChatMessage
|
|
2130
|
-
|
|
2131
|
-
```tsx
|
|
2132
|
-
import { ChatMessage } from '@7onic-ui/react'
|
|
2133
|
-
|
|
2134
|
-
{/* Assistant message */}
|
|
2135
|
-
<ChatMessage role="assistant">
|
|
2136
|
-
<ChatMessage.Avatar />
|
|
2137
|
-
<div className="flex flex-col gap-1">
|
|
2138
|
-
<ChatMessage.Content>How can I help you today?</ChatMessage.Content>
|
|
2139
|
-
<ChatMessage.Footer timestamp="12:34" />
|
|
2140
|
-
</div>
|
|
2141
|
-
</ChatMessage>
|
|
2142
|
-
|
|
2143
|
-
{/* User message with status */}
|
|
2144
|
-
<ChatMessage role="user">
|
|
2145
|
-
<div className="flex flex-col gap-1 items-end">
|
|
2146
|
-
<ChatMessage.Content>Thank you for your help!</ChatMessage.Content>
|
|
2147
|
-
<ChatMessage.Footer timestamp="12:34" status="read" />
|
|
2148
|
-
</div>
|
|
2149
|
-
</ChatMessage>
|
|
2150
|
-
|
|
2151
|
-
{/* Typing animation */}
|
|
2152
|
-
<ChatMessage role="assistant" typing>
|
|
2153
|
-
<ChatMessage.Avatar />
|
|
2154
|
-
<ChatMessage.Content />
|
|
2155
|
-
</ChatMessage>
|
|
2156
|
-
|
|
2157
|
-
{/* Custom avatar + hover actions */}
|
|
2158
|
-
<ChatMessage
|
|
2159
|
-
role="assistant"
|
|
2160
|
-
actions={<button aria-label="Copy">...</button>}
|
|
2161
|
-
>
|
|
2162
|
-
<ChatMessage.Avatar initials="AI" />
|
|
2163
|
-
<div className="flex flex-col gap-1">
|
|
2164
|
-
<ChatMessage.Content>Response text here.</ChatMessage.Content>
|
|
2165
|
-
<ChatMessage.Footer timestamp="12:34" />
|
|
2166
|
-
</div>
|
|
2167
|
-
</ChatMessage>
|
|
2168
|
-
|
|
2169
|
-
{/* User bubble with muted color (common pattern) */}
|
|
2170
|
-
<ChatMessage role="user" color="muted">
|
|
2171
|
-
<div className="flex flex-col gap-1 items-end">
|
|
2172
|
-
<ChatMessage.Content>Message text</ChatMessage.Content>
|
|
2173
|
-
<ChatMessage.Footer timestamp="12:34" status="read" />
|
|
2174
|
-
</div>
|
|
2175
|
-
</ChatMessage>
|
|
2176
|
-
|
|
2177
|
-
{/* History (flat) layout — full-width, no footer */}
|
|
2178
|
-
<div className="flex flex-col gap-3">
|
|
2179
|
-
<ChatMessage role="assistant" variant="flat">
|
|
2180
|
-
<ChatMessage.Avatar />
|
|
2181
|
-
<ChatMessage.Content className="w-full">Here is the answer.</ChatMessage.Content>
|
|
2182
|
-
</ChatMessage>
|
|
2183
|
-
<ChatMessage role="user" variant="flat" color="muted">
|
|
2184
|
-
<ChatMessage.Content className="w-full">Thanks!</ChatMessage.Content>
|
|
2185
|
-
</ChatMessage>
|
|
2186
|
-
</div>
|
|
2187
|
-
```
|
|
2188
|
-
|
|
2189
|
-
| Prop (ChatMessage) | Type | Default | Description |
|
|
2190
|
-
|---|---|---|---|
|
|
2191
|
-
| role | `'assistant' \| 'user'` | `'assistant'` | Aligns left (assistant) or right (user) |
|
|
2192
|
-
| variant | `'bubble' \| 'flat'` | `'bubble'` | Bubble style with background/border, or flat with no fill |
|
|
2193
|
-
| color | `'default' \| 'muted' \| 'primary' \| 'dark'` | `'default'` | Bubble background color |
|
|
2194
|
-
| size | `'sm' \| 'default' \| 'lg'` | `'default'` | Size scale affecting padding and font |
|
|
2195
|
-
| radius | `'md' \| 'lg' \| 'xl' \| '2xl'` | `'2xl'` | Bubble corner radius |
|
|
2196
|
-
| tail | `boolean` | `true` | Asymmetric tail corner (sharp on avatar side) — bubble only |
|
|
2197
|
-
| avatarSize | `'sm' \| 'md' \| 'lg'` | — | Avatar size — also adjusts gap between avatar and bubble |
|
|
2198
|
-
| typing | `boolean` | `false` | Show animated typing dots inside Content |
|
|
2199
|
-
| actions | `ReactNode` | — | Hover-reveal action buttons (copy, react, etc.) |
|
|
2200
|
-
|
|
2201
|
-
| Prop (ChatMessage.Avatar) | Type | Default | Description |
|
|
2202
|
-
|---|---|---|---|
|
|
2203
|
-
| size | `'sm' \| 'md' \| 'lg'` | `'md'` | Avatar size: 24/28/32px |
|
|
2204
|
-
| src | `string` | — | Avatar image URL |
|
|
2205
|
-
| alt | `string` | `'Avatar'` | Alt text |
|
|
2206
|
-
| initials | `string` | — | 1–2 character initials (fallback) |
|
|
2207
|
-
| icon | `ReactNode` | — | Custom icon (fallback) |
|
|
2208
|
-
|
|
2209
|
-
| Prop (ChatMessage.Footer) | Type | Default | Description |
|
|
2210
|
-
|---|---|---|---|
|
|
2211
|
-
| timestamp | `string` | — | Pre-formatted time string |
|
|
2212
|
-
| status | `'sending' \| 'sent' \| 'read' \| 'error' \| ReactNode` | — | Delivery status (built-in presets or custom node) |
|
|
2213
|
-
| size | `'sm' \| 'default' \| 'lg'` | — | Size override (defaults to context value from root) |
|
|
465
|
+
- **When in doubt, check the documentation** — if token usage is unclear, refer to the official docs:
|
|
466
|
+
- Token pages: `https://7onic.design/design-tokens/{name}` (e.g., `/design-tokens/colors`, `/design-tokens/spacing`)
|
|
467
|
+
- Do not guess token values or usage — verify from the documentation first
|
|
2214
468
|
|
|
2215
469
|
---
|
|
2216
470
|
|
|
@@ -2220,4 +474,4 @@ import { ChatMessage } from '@7onic-ui/react'
|
|
|
2220
474
|
- npm (tokens): https://npmjs.com/package/@7onic-ui/tokens
|
|
2221
475
|
- npm (react): https://npmjs.com/package/@7onic-ui/react
|
|
2222
476
|
- GitHub: https://github.com/itonys/7onic
|
|
2223
|
-
-
|
|
477
|
+
- Full AI guide (tokens + components): https://7onic.design/llms-full.txt
|