@viliha/vui-ui 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT.md +29 -194
- package/README.md +57 -54
- package/package.json +1 -1
package/AGENT.md
CHANGED
|
@@ -14,11 +14,7 @@
|
|
|
14
14
|
> [CONTRIBUTING.md](https://github.com/myviliha/vui-starter/blob/main/CONTRIBUTING.md)
|
|
15
15
|
> and [AGENTS.md](https://github.com/myviliha/vui-starter/blob/main/AGENTS.md).
|
|
16
16
|
|
|
17
|
-
You are
|
|
18
|
-
|
|
19
|
-
Your responsibility is to build applications that are consistent, maintainable, accessible, and production-ready by fully embracing the VUI Design System.
|
|
20
|
-
|
|
21
|
-
Do not reinvent the framework. Build with it.
|
|
17
|
+
You are a frontend architect building enterprise applications on **VUI Starter**. Your job is to ship apps that are consistent, maintainable, accessible, and production-ready by leaning fully on the VUI Design System. Don't reinvent the framework — build with it.
|
|
22
18
|
|
|
23
19
|
> **What you get from the package vs. what to copy.** `@viliha/vui-ui` ships the
|
|
24
20
|
> component primitives (`Button`, `Input`, `Select`, `Dialog`, `Menu`,
|
|
@@ -36,7 +32,7 @@ Do not reinvent the framework. Build with it.
|
|
|
36
32
|
|
|
37
33
|
# Core Principles
|
|
38
34
|
|
|
39
|
-
|
|
35
|
+
Order your decisions by these priorities:
|
|
40
36
|
|
|
41
37
|
1. Reuse over rebuilding.
|
|
42
38
|
2. Consistency over customization.
|
|
@@ -47,21 +43,13 @@ Always prioritize:
|
|
|
47
43
|
7. Predictable user experiences.
|
|
48
44
|
8. Enterprise-grade maintainability.
|
|
49
45
|
|
|
50
|
-
When
|
|
46
|
+
When several approaches would work, pick the one that aligns best with VUI.
|
|
51
47
|
|
|
52
48
|
---
|
|
53
49
|
|
|
54
50
|
# Think Before You Build
|
|
55
51
|
|
|
56
|
-
Before
|
|
57
|
-
|
|
58
|
-
1. Search for an existing VUI component.
|
|
59
|
-
2. Search for an existing page pattern.
|
|
60
|
-
3. Search for an existing layout.
|
|
61
|
-
4. Search for an existing variant.
|
|
62
|
-
5. Search for an existing utility.
|
|
63
|
-
|
|
64
|
-
Never duplicate functionality already provided by VUI.
|
|
52
|
+
Before you create anything, search for what already exists — a VUI component, a page pattern, a layout, a variant, or a utility. Never duplicate functionality VUI already provides.
|
|
65
53
|
|
|
66
54
|
---
|
|
67
55
|
|
|
@@ -95,20 +83,20 @@ dependencies** with the package manager it detects from the lockfile (npm / pnpm
|
|
|
95
83
|
alias, `import "./globals.css"`).
|
|
96
84
|
- **existing + theme-only** → nothing copied; prints the wiring steps.
|
|
97
85
|
|
|
98
|
-
Other flags: `--yes` / `--force` / `--dry-run`. If you only need components,
|
|
99
|
-
`--theme-only` (or skip `init`) and
|
|
86
|
+
Other flags: `--yes` / `--force` / `--dry-run`. If you only need the components, pass
|
|
87
|
+
`--theme-only` (or skip `init` entirely) and follow the setup below.
|
|
100
88
|
|
|
101
89
|
VUI ships as TypeScript source.
|
|
102
90
|
|
|
103
91
|
## Next.js
|
|
104
92
|
|
|
105
|
-
|
|
93
|
+
Transpile the package:
|
|
106
94
|
|
|
107
95
|
```ts
|
|
108
96
|
transpilePackages: ["@viliha/vui-ui"]
|
|
109
97
|
```
|
|
110
98
|
|
|
111
|
-
Import once:
|
|
99
|
+
Import the theme once:
|
|
112
100
|
|
|
113
101
|
```css
|
|
114
102
|
@import "tailwindcss";
|
|
@@ -117,47 +105,21 @@ Import once:
|
|
|
117
105
|
|
|
118
106
|
## Vite
|
|
119
107
|
|
|
120
|
-
Import the theme once.
|
|
121
|
-
|
|
122
|
-
No additional transpilation is required.
|
|
108
|
+
Import the theme once. No extra transpilation needed.
|
|
123
109
|
|
|
124
110
|
---
|
|
125
111
|
|
|
126
112
|
# Design Tokens
|
|
127
113
|
|
|
128
|
-
VUI is
|
|
129
|
-
|
|
130
|
-
Never hardcode:
|
|
131
|
-
|
|
132
|
-
- colors
|
|
133
|
-
- spacing
|
|
134
|
-
- radius
|
|
135
|
-
- typography
|
|
136
|
-
- shadows
|
|
137
|
-
- borders
|
|
114
|
+
VUI is entirely token-driven. Never hardcode colors, spacing, radius, typography, shadows, or borders — reach for the semantic design token instead. For example: `--button-primary`, `--button-primary-hover`, `--background`, `--foreground`, `--border`, `--ring`, `--chart-1`, `--sidebar-primary`.
|
|
138
115
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
Examples:
|
|
142
|
-
|
|
143
|
-
- --button-primary
|
|
144
|
-
- --button-primary-hover
|
|
145
|
-
- --background
|
|
146
|
-
- --foreground
|
|
147
|
-
- --border
|
|
148
|
-
- --ring
|
|
149
|
-
- --chart-1
|
|
150
|
-
- --sidebar-primary
|
|
151
|
-
|
|
152
|
-
Never use arbitrary values unless absolutely necessary.
|
|
116
|
+
Avoid arbitrary values unless there's truly no token for the job.
|
|
153
117
|
|
|
154
118
|
---
|
|
155
119
|
|
|
156
120
|
# Application Structure
|
|
157
121
|
|
|
158
|
-
Organize
|
|
159
|
-
|
|
160
|
-
Example:
|
|
122
|
+
Organize the app around a feature-first architecture:
|
|
161
123
|
|
|
162
124
|
```
|
|
163
125
|
app/
|
|
@@ -175,13 +137,13 @@ services/
|
|
|
175
137
|
types/
|
|
176
138
|
```
|
|
177
139
|
|
|
178
|
-
Keep business logic
|
|
140
|
+
Keep business logic out of UI components.
|
|
179
141
|
|
|
180
142
|
---
|
|
181
143
|
|
|
182
144
|
# Page Layout
|
|
183
145
|
|
|
184
|
-
Every
|
|
146
|
+
Every page follows the standard VUI layout:
|
|
185
147
|
|
|
186
148
|
```
|
|
187
149
|
SetPageTitle
|
|
@@ -195,31 +157,19 @@ Action Header
|
|
|
195
157
|
Scrollable Content
|
|
196
158
|
```
|
|
197
159
|
|
|
198
|
-
Only the content area
|
|
199
|
-
|
|
200
|
-
The page structure should remain consistent throughout the application.
|
|
160
|
+
Only the content area scrolls, and this structure stays consistent across the whole app.
|
|
201
161
|
|
|
202
162
|
---
|
|
203
163
|
|
|
204
164
|
# Sections
|
|
205
165
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
Avoid deeply nested layouts.
|
|
209
|
-
|
|
210
|
-
Use spacing to create hierarchy before introducing additional borders.
|
|
166
|
+
Group content into bordered cards, and avoid deeply nested layouts. Reach for spacing to establish hierarchy before you add more borders.
|
|
211
167
|
|
|
212
168
|
---
|
|
213
169
|
|
|
214
170
|
# Navigation
|
|
215
171
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
- Breadcrumbs
|
|
219
|
-
- Sidebar
|
|
220
|
-
- Top Navigation
|
|
221
|
-
|
|
222
|
-
Do not build custom navigation systems unless the project explicitly requires it.
|
|
172
|
+
Navigate with the three provided pieces — breadcrumbs, sidebar, and top navigation. Don't build a custom navigation system unless the project explicitly demands one.
|
|
223
173
|
|
|
224
174
|
## Breadcrumbs
|
|
225
175
|
|
|
@@ -306,48 +256,13 @@ persistence, and nav-config wiring stay identical.
|
|
|
306
256
|
|
|
307
257
|
# Forms
|
|
308
258
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
Prefer:
|
|
312
|
-
|
|
313
|
-
- shadcn Form
|
|
314
|
-
- React Hook Form
|
|
315
|
-
- Zod
|
|
316
|
-
|
|
317
|
-
Every form should support:
|
|
318
|
-
|
|
319
|
-
- validation
|
|
320
|
-
- loading
|
|
321
|
-
- success
|
|
322
|
-
- error
|
|
323
|
-
- disabled
|
|
324
|
-
- keyboard navigation
|
|
325
|
-
|
|
326
|
-
Never rely on placeholders as labels.
|
|
259
|
+
Build forms with VUI and shadcn/ui together, reaching for shadcn Form, React Hook Form, and Zod. Every form handles the full lifecycle — validation, loading, success, error, disabled, and keyboard navigation. Never use a placeholder in place of a label.
|
|
327
260
|
|
|
328
261
|
---
|
|
329
262
|
|
|
330
263
|
# Tables
|
|
331
264
|
|
|
332
|
-
Never build HTML
|
|
333
|
-
|
|
334
|
-
Always use RecordView.
|
|
335
|
-
|
|
336
|
-
Use:
|
|
337
|
-
|
|
338
|
-
- editable
|
|
339
|
-
- required
|
|
340
|
-
- copyable
|
|
341
|
-
- options
|
|
342
|
-
- render
|
|
343
|
-
|
|
344
|
-
Allow RecordView to manage:
|
|
345
|
-
|
|
346
|
-
- sorting
|
|
347
|
-
- filtering
|
|
348
|
-
- pagination
|
|
349
|
-
- bulk actions
|
|
350
|
-
- import/export
|
|
265
|
+
Never hand-build an HTML table — always use `RecordView`. Configure columns through its field props (`editable`, `required`, `copyable`, `options`, `render`), and let `RecordView` own the rest: sorting, filtering, pagination, bulk actions, and import/export.
|
|
351
266
|
|
|
352
267
|
## Add / edit form
|
|
353
268
|
|
|
@@ -367,17 +282,7 @@ shared `@viliha/vui-ui/breadcrumbs` component.
|
|
|
367
282
|
|
|
368
283
|
# Charts
|
|
369
284
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
ChartContainer
|
|
373
|
-
|
|
374
|
-
+
|
|
375
|
-
|
|
376
|
-
Recharts
|
|
377
|
-
|
|
378
|
-
Never hardcode chart colors.
|
|
379
|
-
|
|
380
|
-
Always map colors through chart tokens.
|
|
285
|
+
Build every chart with `ChartContainer` plus Recharts. Never hardcode chart colors — map them through the chart tokens.
|
|
381
286
|
|
|
382
287
|
---
|
|
383
288
|
|
|
@@ -391,101 +296,45 @@ app (they are built from published primitives: `Button`, `Input`, tokens).
|
|
|
391
296
|
|
|
392
297
|
Do not `import … from "@viliha/vui-ui/auth"` — no such entry point exists.
|
|
393
298
|
|
|
394
|
-
Wrap forms
|
|
299
|
+
Wrap the forms in semantic HTML.
|
|
395
300
|
|
|
396
301
|
---
|
|
397
302
|
|
|
398
303
|
# shadcn/ui Integration
|
|
399
304
|
|
|
400
|
-
VUI
|
|
401
|
-
|
|
402
|
-
Use shadcn for:
|
|
403
|
-
|
|
404
|
-
- forms
|
|
405
|
-
- dialogs
|
|
406
|
-
- sheets
|
|
407
|
-
- tabs
|
|
408
|
-
- popovers
|
|
409
|
-
- accordions
|
|
410
|
-
|
|
411
|
-
Use VUI for:
|
|
305
|
+
VUI and shadcn/ui complement each other, so split the work along their strengths. Reach for shadcn for forms, dialogs, sheets, tabs, popovers, and accordions; reach for VUI for layouts, `RecordView`, enterprise components, charts, and navigation patterns.
|
|
412
306
|
|
|
413
|
-
|
|
414
|
-
- RecordView
|
|
415
|
-
- enterprise components
|
|
416
|
-
- charts
|
|
417
|
-
- navigation patterns
|
|
418
|
-
|
|
419
|
-
VUI owns the design tokens.
|
|
420
|
-
|
|
421
|
-
Remove duplicated token definitions generated by shadcn.
|
|
307
|
+
VUI owns the design tokens — delete any duplicate token definitions shadcn generates.
|
|
422
308
|
|
|
423
309
|
---
|
|
424
310
|
|
|
425
311
|
# Accessibility
|
|
426
312
|
|
|
427
|
-
Every page
|
|
428
|
-
|
|
429
|
-
- keyboard navigation
|
|
430
|
-
- visible focus
|
|
431
|
-
- ARIA attributes
|
|
432
|
-
- screen readers
|
|
433
|
-
- WCAG AA contrast
|
|
434
|
-
|
|
435
|
-
Accessibility is never optional.
|
|
313
|
+
Every page supports keyboard navigation, visible focus, ARIA attributes, screen readers, and WCAG AA contrast. Accessibility is never optional.
|
|
436
314
|
|
|
437
315
|
---
|
|
438
316
|
|
|
439
317
|
# Responsive Design
|
|
440
318
|
|
|
441
|
-
Design mobile first.
|
|
442
|
-
|
|
443
|
-
Support:
|
|
444
|
-
|
|
445
|
-
- Mobile
|
|
446
|
-
- Tablet
|
|
447
|
-
- Desktop
|
|
448
|
-
- Large Desktop
|
|
449
|
-
|
|
450
|
-
Avoid horizontal scrolling whenever possible.
|
|
319
|
+
Design mobile first, then scale up cleanly through tablet, desktop, and large desktop. Avoid horizontal scrolling wherever you can.
|
|
451
320
|
|
|
452
321
|
---
|
|
453
322
|
|
|
454
323
|
# Performance
|
|
455
324
|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
- Server Components
|
|
459
|
-
- Streaming
|
|
460
|
-
- Lazy loading
|
|
461
|
-
- Dynamic imports
|
|
462
|
-
|
|
463
|
-
Avoid unnecessary client components.
|
|
464
|
-
|
|
465
|
-
Memoize only when needed.
|
|
325
|
+
Default to Server Components, streaming, lazy loading, and dynamic imports. Avoid unnecessary client components, and memoize only when you've measured a need.
|
|
466
326
|
|
|
467
327
|
---
|
|
468
328
|
|
|
469
329
|
# UX Standards
|
|
470
330
|
|
|
471
|
-
Every feature
|
|
472
|
-
|
|
473
|
-
Support:
|
|
474
|
-
|
|
475
|
-
- Loading
|
|
476
|
-
- Success
|
|
477
|
-
- Empty
|
|
478
|
-
- Error
|
|
479
|
-
|
|
480
|
-
Long-running actions should provide visible progress.
|
|
481
|
-
|
|
482
|
-
Never leave users wondering what happened.
|
|
331
|
+
Every feature communicates its current state — loading, success, empty, and error. Give long-running actions visible progress, and never leave users wondering what happened.
|
|
483
332
|
|
|
484
333
|
---
|
|
485
334
|
|
|
486
335
|
# Naming
|
|
487
336
|
|
|
488
|
-
|
|
337
|
+
Name things descriptively.
|
|
489
338
|
|
|
490
339
|
Good
|
|
491
340
|
|
|
@@ -517,21 +366,7 @@ Panel
|
|
|
517
366
|
|
|
518
367
|
# AI Development Rules
|
|
519
368
|
|
|
520
|
-
Before
|
|
521
|
-
|
|
522
|
-
1. Reuse existing components.
|
|
523
|
-
2. Reuse existing layouts.
|
|
524
|
-
3. Reuse existing utilities.
|
|
525
|
-
4. Reuse existing variants.
|
|
526
|
-
5. Extend existing components before creating new ones.
|
|
527
|
-
|
|
528
|
-
Never duplicate code.
|
|
529
|
-
|
|
530
|
-
Never duplicate styling.
|
|
531
|
-
|
|
532
|
-
Keep APIs simple.
|
|
533
|
-
|
|
534
|
-
Keep components focused.
|
|
369
|
+
Before you write code, reuse what's already there — components, layouts, utilities, and variants — and extend an existing component before creating a new one. Never duplicate code or styling. Keep APIs simple and components focused.
|
|
535
370
|
|
|
536
371
|
---
|
|
537
372
|
|
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# @viliha/vui-ui
|
|
2
2
|
|
|
3
|
-
A
|
|
4
|
-
CSS v4, shadcn-style patterns, and Radix Icons.
|
|
5
|
-
|
|
3
|
+
A **token-driven React component library** for admin and CRM interfaces, built on
|
|
4
|
+
Tailwind CSS v4, shadcn-style patterns, and Radix Icons. It ships as **TypeScript
|
|
5
|
+
source** rather than a prebuilt bundle, so your app's bundler compiles only the
|
|
6
|
+
components you actually import.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
open-source admin design system.
|
|
8
|
+
It's part of [**Vui Starter**](https://github.com/myviliha/vui-starter), a free
|
|
9
|
+
and open-source admin design system.
|
|
9
10
|
|
|
10
11
|
- 🌐 **Live docs & demo:** [vui.viliha.com](https://vui.viliha.com)
|
|
11
12
|
- 📦 **Repository:** [github.com/myviliha/vui-starter](https://github.com/myviliha/vui-starter)
|
|
@@ -21,15 +22,15 @@ npm install -D tailwindcss @tailwindcss/postcss
|
|
|
21
22
|
|
|
22
23
|
## Setup
|
|
23
24
|
|
|
24
|
-
**1. Import the theme** in your global stylesheet
|
|
25
|
-
mapping, base reset, and component scanning
|
|
25
|
+
**1. Import the theme** in your global stylesheet. This one import brings in the
|
|
26
|
+
design tokens, the `@theme` mapping, the base reset, and component scanning:
|
|
26
27
|
|
|
27
28
|
```css
|
|
28
29
|
@import "tailwindcss";
|
|
29
30
|
@import "@viliha/vui-ui/theme.css";
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
**2. Next.js only
|
|
33
|
+
**2. Next.js only.** Transpile the source package in `next.config.ts`:
|
|
33
34
|
|
|
34
35
|
```ts
|
|
35
36
|
const nextConfig = { transpilePackages: ["@viliha/vui-ui"] };
|
|
@@ -40,29 +41,30 @@ export default nextConfig;
|
|
|
40
41
|
|
|
41
42
|
## Scaffold the full app + demo (`init`)
|
|
42
43
|
|
|
43
|
-
The package ships the **components
|
|
44
|
+
The package itself ships the **components**. The **app shell** (layout, sidebar,
|
|
44
45
|
browser-style **open tabs**, command palette, nav config, logo) and the **demo
|
|
45
|
-
pages**
|
|
46
|
+
pages** come from a one-shot scaffolder:
|
|
46
47
|
|
|
47
48
|
```bash
|
|
48
49
|
npx @viliha/vui-ui init
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
It's **interactive**
|
|
52
|
+
It's **interactive** and walks through a short decision tree:
|
|
52
53
|
|
|
53
|
-
1. **Fresh project?** (fresh vs existing)
|
|
54
|
-
2. **Pre-built theme?** — the full shell
|
|
55
|
-
|
|
54
|
+
1. **Fresh project?** (fresh vs. existing)
|
|
55
|
+
2. **Pre-built theme?** — the full shell plus demo pages, or just the theme wiring
|
|
56
|
+
for you to build on.
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
Everything it generates is copied into *your* repo, so you own and edit it.
|
|
58
59
|
|
|
59
60
|
| | **Pre-built** (shell + demo) | **Theme-only** (you configure) |
|
|
60
61
|
| --- | --- | --- |
|
|
61
62
|
| **Fresh** | full runnable app: config + shell + demo pages | just the theme wiring (`globals.css`, `next.config`) — build your own pages |
|
|
62
63
|
| **Existing** | shell + demo added; your config is **never** overwritten (prints merge steps) | nothing copied; prints the wiring steps |
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
Before that, it asks whether this is a standalone **Next.js** app or a
|
|
66
|
+
**Turborepo**; for a monorepo it scaffolds into a target app dir, such as
|
|
67
|
+
`apps/web`.
|
|
66
68
|
|
|
67
69
|
```
|
|
68
70
|
Flags (for CI / agents, skip the prompts):
|
|
@@ -75,15 +77,15 @@ Flags (for CI / agents, skip the prompts):
|
|
|
75
77
|
--dry-run preview without writing
|
|
76
78
|
```
|
|
77
79
|
|
|
78
|
-
`init` **
|
|
79
|
-
from
|
|
80
|
-
skip, or `--no-install` to
|
|
80
|
+
`init` **installs the dependencies for you** using the package manager it detects
|
|
81
|
+
from your lockfile (npm, pnpm, yarn, or bun). It prompts before doing so; pass
|
|
82
|
+
`--yes` to skip the prompt, or `--no-install` to handle it yourself.
|
|
81
83
|
|
|
82
84
|
### Fresh + pre-built (recommended for new apps)
|
|
83
85
|
|
|
84
|
-
Start from a `create-next-app` base **without `--src-dir`**
|
|
85
|
-
root `app/`
|
|
86
|
-
you
|
|
86
|
+
Start from a `create-next-app` base **without `--src-dir`** — the scaffold expects
|
|
87
|
+
a root `app/` with `@/*` → `./*` — then run `init`. It scaffolds the app, installs
|
|
88
|
+
the dependencies, and leaves you ready to run `dev`. Any package manager works:
|
|
87
89
|
|
|
88
90
|
```bash
|
|
89
91
|
# npm
|
|
@@ -103,16 +105,16 @@ bun create next-app my-app --ts --tailwind --app --no-src-dir
|
|
|
103
105
|
cd my-app && bunx @viliha/vui-ui init && bun dev
|
|
104
106
|
```
|
|
105
107
|
|
|
106
|
-
`init` writes `next.config.ts`, `tsconfig.json`, `app/globals.css`, the shell,
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
`init` writes `next.config.ts`, `tsconfig.json`, `app/globals.css`, the shell, and
|
|
109
|
+
the demo pages, overwriting the create-next-app boilerplate, and installs the
|
|
110
|
+
dependencies. The demo then runs out of the box at `/dashboard`.
|
|
109
111
|
|
|
110
112
|
### ⚠️ Existing project — read this first
|
|
111
113
|
|
|
112
|
-
Adding VUI to an app you already have
|
|
113
|
-
overwrites your config.**
|
|
114
|
-
`app/(app)/` and `app/_components/`, or theme-only to copy nothing
|
|
115
|
-
prints the four things to wire up:
|
|
114
|
+
Adding VUI to an app you already have takes a little care. **`init --existing`
|
|
115
|
+
never overwrites your config.** Choose pre-built to add the shell and pages under
|
|
116
|
+
`app/(app)/` and `app/_components/`, or theme-only to copy nothing. Either way, it
|
|
117
|
+
prints the four things you need to wire up:
|
|
116
118
|
|
|
117
119
|
1. **`next.config`** — add `transpilePackages: ["@viliha/vui-ui"]`.
|
|
118
120
|
(Optional, for the open-tabs *keep-alive*: `output: "export"`,
|
|
@@ -127,19 +129,19 @@ prints the four things to wire up:
|
|
|
127
129
|
4. **Root `app/layout.tsx`** — `import "./globals.css"` (and mount fonts to match
|
|
128
130
|
the demo's look).
|
|
129
131
|
|
|
130
|
-
Run **`npx @viliha/vui-ui init --existing --prebuilt --dry-run`** first to
|
|
132
|
+
Run **`npx @viliha/vui-ui init --existing --prebuilt --dry-run`** first to preview
|
|
131
133
|
exactly what it will add. If you only want the components, choose **theme-only**
|
|
132
|
-
(or skip `init` and follow the [Setup](#setup) above), then import from
|
|
134
|
+
(or skip `init` entirely and follow the [Setup](#setup) above), then import from
|
|
133
135
|
`@viliha/vui-ui/*`.
|
|
134
136
|
|
|
135
|
-
> **
|
|
136
|
-
> `theme.css`. If your app already defines shadcn/ui or other CSS variables
|
|
137
|
-
> the same names, import `theme.css` **last** and remove the duplicates
|
|
138
|
-
>
|
|
137
|
+
> **A note on theming an existing app:** VUI owns its design tokens in
|
|
138
|
+
> `theme.css`. If your app already defines shadcn/ui or other CSS variables under
|
|
139
|
+
> the same names, import `theme.css` **last** and remove the duplicates so the two
|
|
140
|
+
> token sets don't collide. On a fresh project this never comes up.
|
|
139
141
|
|
|
140
142
|
## Usage
|
|
141
143
|
|
|
142
|
-
|
|
144
|
+
Every component has its own entry point, so you ship only what you use:
|
|
143
145
|
|
|
144
146
|
```tsx
|
|
145
147
|
import { Button } from "@viliha/vui-ui/button";
|
|
@@ -158,11 +160,11 @@ export function Example() {
|
|
|
158
160
|
|
|
159
161
|
### Datatables & forms
|
|
160
162
|
|
|
161
|
-
`RecordView`
|
|
162
|
-
editable cells, sorting, filtering, pagination, row
|
|
163
|
-
CSV / JSON / Excel / PDF import
|
|
164
|
-
form (slide-over or full-page). Required fields render a `*`, alignment and
|
|
165
|
-
colors come from the tokens
|
|
163
|
+
`RecordView` builds a complete admin datatable from a single `fields` array:
|
|
164
|
+
editable cells, sorting, filtering, pagination, row and bulk actions,
|
|
165
|
+
CSV / JSON / Excel / PDF import and export, and a buffered **Add / Edit / View**
|
|
166
|
+
form (slide-over or full-page). Required fields render a `*`, and alignment and
|
|
167
|
+
colors come from the tokens, so you never style a field by hand.
|
|
166
168
|
|
|
167
169
|
```tsx
|
|
168
170
|
import { RecordView, type RecordField } from "@viliha/vui-ui/record-view";
|
|
@@ -183,9 +185,9 @@ const fields: RecordField<Customer>[] = [
|
|
|
183
185
|
/>;
|
|
184
186
|
```
|
|
185
187
|
|
|
186
|
-
|
|
187
|
-
Info panel (from `formDescription`
|
|
188
|
-
[Data table docs](https://vui.viliha.com/docs/data-table).
|
|
188
|
+
That same `fields` array also drives `RecordForm`, the Add/Edit/View screen, along
|
|
189
|
+
with its Info panel (built from `formDescription` and each field's `description`).
|
|
190
|
+
See the [Data table docs](https://vui.viliha.com/docs/data-table) for the details.
|
|
189
191
|
|
|
190
192
|
## Patterns
|
|
191
193
|
|
|
@@ -205,14 +207,14 @@ The reference app composes these primitives into the conventions documented at
|
|
|
205
207
|
|
|
206
208
|
Copy them from the
|
|
207
209
|
[backoffice demo](https://github.com/myviliha/vui-starter/tree/main/apps/backoffice)
|
|
208
|
-
and adapt.
|
|
210
|
+
and adapt them to your app.
|
|
209
211
|
|
|
210
212
|
## Building with an AI agent
|
|
211
213
|
|
|
212
214
|
This package ships an **AI-agent usage guide** at
|
|
213
|
-
`node_modules/@viliha/vui-ui/AGENT.md
|
|
214
|
-
UI with VUI
|
|
215
|
-
|
|
215
|
+
`node_modules/@viliha/vui-ui/AGENT.md`. It captures the standards to follow when
|
|
216
|
+
generating UI with VUI: token discipline, reuse-first, page layout, RecordView,
|
|
217
|
+
forms, accessibility, and dark mode. The quickest way to load it is the shipped
|
|
216
218
|
`CLAUDE.template.md`:
|
|
217
219
|
|
|
218
220
|
```bash
|
|
@@ -220,8 +222,9 @@ cp node_modules/@viliha/vui-ui/CLAUDE.template.md ./CLAUDE.md # Claude Code
|
|
|
220
222
|
# or ./AGENTS.md for Cursor / Copilot
|
|
221
223
|
```
|
|
222
224
|
|
|
223
|
-
|
|
224
|
-
verbatim copy
|
|
225
|
+
That file is a one-line `@import` of `AGENT.md`, so the rules stay in a single
|
|
226
|
+
place. If you'd rather keep a verbatim copy, run
|
|
227
|
+
`cp node_modules/@viliha/vui-ui/AGENT.md AGENTS.md`.
|
|
225
228
|
|
|
226
229
|
## Components
|
|
227
230
|
|
|
@@ -234,9 +237,9 @@ wrapper) · `checkbox` · `command-palette` (⌘K launcher) · `dialog` ·
|
|
|
234
237
|
|
|
235
238
|
## Theming
|
|
236
239
|
|
|
237
|
-
Every design decision lives in `@viliha/vui-ui/theme.css` as CSS variables
|
|
238
|
-
|
|
239
|
-
to rebrand the
|
|
240
|
+
Every design decision lives in `@viliha/vui-ui/theme.css` as CSS variables —
|
|
241
|
+
colors, radius, typography, and dark mode. Override any token **after** the import
|
|
242
|
+
to rebrand the entire system:
|
|
240
243
|
|
|
241
244
|
```css
|
|
242
245
|
@import "@viliha/vui-ui/theme.css";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viliha/vui-ui",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Vui UI — a clean, token-driven React admin/CRM component library built on Tailwind CSS v4, shadcn-style patterns, and Radix Icons. Ships as TypeScript source (Just-in-Time), compiled by the consuming app.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Suman Bonakurthi",
|