@voltui/agent 0.5.0 → 0.6.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.
@@ -0,0 +1,231 @@
1
+ ---
2
+ name: volt-ui-component-selection
3
+ description: >
4
+ Choose the right Volt UI component for a responsibility: Button vs link, NativeSelect vs Select
5
+ vs Combobox, Checkbox vs Switch vs Toggle, Tabs vs route navigation, Dialog vs Drawer vs
6
+ Popover, Alert vs Toast, Spinner vs Skeleton, Sidebar vs NavigationMenu. Use when two or more
7
+ components could fit.
8
+ ---
9
+
10
+ # Choosing a Volt component
11
+
12
+ This is a responsibility map, not an API reference. For exact selectors and inputs ask the MCP
13
+ server (`find_components`, then `get_component`).
14
+
15
+ ## The distinctions that matter
16
+
17
+ **Actions**
18
+
19
+ - **Button vs link.** An action that changes state is a `<button voltButton>`. Navigation is
20
+ `<a voltButton routerLink>` — styled like a button, still a link. Never a button in a link.
21
+
22
+ **Forms and selection**
23
+
24
+ - **NativeSelect vs Select vs Combobox.** Fixed short list and a native control is fine →
25
+ `NativeSelect` (an attribute on a real `<select>`). Custom-rendered options, groups, multiple →
26
+ `Select`. The user searches by typing, or the list is long or remote → `Combobox`; remote data
27
+ uses `filterMode="manual"` and the app owns the request.
28
+ - **Checkbox vs Switch vs Toggle.** A value submitted with a form, or "I agree" → `Checkbox`. An
29
+ immediate on/off setting that takes effect now → `Switch`. A pressed state of a tool (bold) →
30
+ `Toggle`; one of several tools → `ToggleGroup`.
31
+ - **Radio vs Select.** Few options that should all be visible → `Radio`; many → `Select`.
32
+ - **Slider vs RangeSlider.** One number vs a low–high pair.
33
+
34
+ **Navigation**
35
+
36
+ - **Tabs vs route navigation.** Tabs switch panels of one view and own the selection. When the URL
37
+ owns the selection (deep links, middle-click), use real anchors, not `Tabs`.
38
+ - **Sidebar vs NavigationMenu.** `Sidebar` is application chrome (a persistent region).
39
+ `NavigationMenu` is a top-level menu with flyout content.
40
+ - **Pagination vs infinite scroll.** `Pagination` for page-addressable lists.
41
+
42
+ **Feedback**
43
+
44
+ - **Alert vs Toast.** `Alert` is part of the page and stays until the condition clears. `Toast` is
45
+ transient confirmation of something that already happened.
46
+ - **Spinner vs Skeleton.** Unknown duration, no shape → `Spinner`. Content with a known layout →
47
+ `Skeleton`.
48
+ - **Badge vs status text.** A short label or count → `Badge`; a sentence → text.
49
+
50
+ **Overlays**
51
+
52
+ - **Dialog vs Drawer vs Popover.** Needs a decision, blocks the page → `Dialog`. Secondary panel or
53
+ navigation on a small screen → `Drawer`. Small contextual content anchored to a control →
54
+ `Popover`. A hint that names a control → `Tooltip` (never the only way to learn something).
55
+ - **Dropdown Menu vs Select.** Commands vs choosing a value.
56
+
57
+ **Display**
58
+
59
+ - **Table vs an application data table.** Volt's `Table` is styled markup. Sorting, filtering,
60
+ paging and selection logic belongs to the application (see the data-table recipe).
61
+
62
+ ## Sections and workflows
63
+
64
+ A hero, pricing table, app shell or data table is a **composition** of these atoms, not one of them.
65
+ Ask `find_compositions` for a Recipes block, layout or pattern before assembling it; there is no
66
+ `VoltDataTable` or `VoltSettingsForm`, and you should not invent one.
67
+
68
+ ## Do not use when
69
+
70
+ - **Combobox**: the app only needs a native fixed list (`NativeSelect`).
71
+ - **Dialog**: the content is not a decision — a Popover or inline content is lighter.
72
+ - **Tooltip**: the text is essential; put it on the page.
73
+ - **Toast**: the user must act on it or it carries an error they must read; use `Alert` or a Dialog.
74
+ - **Tabs**: the panels are separate pages.
75
+
76
+ ## Catalog
77
+
78
+ The list below is generated from the project's component metadata; the MCP `find_components` tool
79
+ returns the same fields live.
80
+
81
+ <!-- volt:catalog:start -->
82
+
83
+ ### Forms & Inputs
84
+
85
+ - **Button** (`button`, stable) — Triggers an action or navigates. Use the `voltButton` attribute on a native `<button>` or `<a>`, or the `<volt-button>` element.
86
+ - Not for: A link to another page that is not styled as an action: use a plain anchor.
87
+ - See also: `toggle`, `dropdown-menu`
88
+ - **Input** (`input`, stable) — A single-line text field styled for Volt, with size and validation-state variants. Works with Angular forms.
89
+ - Not for: A choice from a list: use Select, Combobox or Radio.
90
+ - See also: `textarea`, `form-field`, `search`
91
+ - **Search** (`search`, stable) — A search field wrapper with an icon slot and a clear button around a native input.
92
+ - Not for: Searching a server-backed list for a value: use Combobox with manual filtering.
93
+ - See also: `input`, `combobox`
94
+ - **Autofill** (`autofill`, stable) — A directive that reports when the browser autofills an input, so styles and state can react.
95
+ - **Textarea** (`textarea`, stable) — A multi-line text field with variant, size, state and resize options.
96
+ - **Checkbox** (`checkbox`, stable) — A checked, unchecked or indeterminate toggle that works with Angular forms.
97
+ - Not for: A setting that takes effect immediately: use Switch.
98
+ - See also: `switch`, `toggle`, `radio`
99
+ - **Radio** (`radio`, stable) — A group of mutually exclusive options.
100
+ - Not for: More than a handful of options: use Select.
101
+ - See also: `select`, `checkbox`, `toggle-group`
102
+ - **Switch** (`switch`, stable) — An on/off control for a setting that takes effect immediately.
103
+ - Not for: A choice submitted with a form or an "I agree": use Checkbox.
104
+ - See also: `checkbox`, `toggle`
105
+ - **Form Field** (`form-field`, stable) — Groups a control with its label, hint and error message and wires them together without hand-written ids.
106
+ - Not for: Anything that is not a labelled form control.
107
+ - See also: `input`, `textarea`, `select`
108
+ - **Select** (`select`, stable) — A custom listbox-based select with single and multiple selection, plus a styled native `<select>` directive.
109
+ - Not for: A short fixed list where a native control is enough: use the native select directive.
110
+ - Not for: A list the user searches by typing or that comes from a server: use Combobox.
111
+ - See also: `combobox`, `listbox`, `radio`
112
+ - **Slider** (`slider`, stable) — Selects a single number in a range.
113
+ - Not for: A low–high pair: use Range Slider.
114
+ - See also: `range-slider`, `progress`
115
+ - **Range Slider** (`range-slider`, stable) — Selects a low and a high value in a range.
116
+ - Not for: A single number: use Slider.
117
+ - See also: `slider`
118
+ - **Input OTP** (`input-otp`, stable) — A segmented one-time-password field with paste support and a completion event.
119
+ - **File Upload** (`file-upload`, stable) — A file picker directive and a drag-and-drop dropzone that report selected and rejected files.
120
+ - **Combobox** (`combobox`, stable) — A text input with a filterable popup list. Supports local filtering, manual (server-side) filtering, loading state and multiple selection.
121
+ - Not for: A fixed list the application only needs a native select for.
122
+ - Not for: Choosing a command: use Dropdown Menu.
123
+ - See also: `select`, `listbox`, `search`
124
+
125
+ ### Display
126
+
127
+ - **Badge** (`badge`, stable) — A small label for status, counts or categories.
128
+ - Not for: A full sentence of status: use text or Alert.
129
+ - See also: `alert`, `avatar`
130
+ - **Card** (`card`, stable) — A surface that groups related content with optional header, content and footer parts.
131
+ - **Avatar** (`avatar`, stable) — A user image with a fallback (usually initials).
132
+ - **Separator** (`separator`, stable) — A horizontal or vertical divider.
133
+ - **Accordion** (`accordion`, stable) — Vertically stacked sections that expand and collapse.
134
+ - Not for: Switching between mutually exclusive views: use Tabs.
135
+ - See also: `tabs`
136
+ - **Progress** (`progress`, stable) — Shows how far a task has advanced, or that one is running when the value is unknown.
137
+ - Not for: A measured quantity within a known range (disk usage): use Meter.
138
+ - See also: `meter`, `spinner`
139
+ - **Meter** (`meter`, stable) — A gauge for a value within a known range, such as disk usage.
140
+ - Not for: Progress toward completion: use Progress.
141
+ - See also: `progress`
142
+ - **Skeleton** (`skeleton`, stable) — A placeholder that mimics content while it loads.
143
+ - Not for: An unknown-duration wait with no shape: use Spinner.
144
+ - See also: `spinner`
145
+ - **Table** (`table`, stable) — Styled table parts for tabular data: header, body, footer, rows, cells and caption.
146
+ - Not for: Sorting, filtering, paging and selection logic: that belongs to the application.
147
+ - See also: `pagination`
148
+ - **Alert** (`alert`, stable) — A callout for information, success, warnings or errors that sits in the page flow.
149
+ - Not for: A transient "saved" confirmation: use Toast.
150
+ - See also: `toast`, `empty-state`, `dialog`
151
+ - **Spinner** (`spinner`, stable) — An indeterminate loading indicator in three sizes.
152
+ - Not for: Content with a known layout: use Skeleton.
153
+ - See also: `skeleton`, `progress`
154
+ - **Empty State** (`empty-state`, stable) — A placeholder for an empty collection or a search with no results, with room for an action.
155
+ - Not for: An error or warning about the page: use Alert.
156
+ - See also: `alert`, `skeleton`
157
+
158
+ ### Controls
159
+
160
+ - **Toggle** (`toggle`, stable) — A two-state button that stays pressed, such as bold in a text editor.
161
+ - Not for: An on/off setting: use Switch. A value in a form: use Checkbox.
162
+ - See also: `toggle-group`, `switch`, `checkbox`
163
+ - **Toggle Group** (`toggle-group`, stable) — A set of toggles with single or multiple selection.
164
+ - Not for: Switching between views of a page: use Tabs.
165
+ - See also: `toggle`, `radio`, `toolbar`, `tabs`
166
+ - **Pagination** (`pagination`, stable) — Page navigation with first/previous/next/last controls and numbered pages.
167
+ - Not for: Endless lists that load as you scroll.
168
+ - See also: `table`
169
+ - **Date Picker** (`date-picker`, stable) — A calendar for choosing a single date or a date range, with min/max and disabled-date rules.
170
+ - **Listbox** (`listbox`, stable) — An always-visible list of options with single or multiple selection.
171
+ - Not for: A value inside a form that collapses after choosing: use Select.
172
+ - See also: `select`, `combobox`
173
+ - **Toolbar** (`toolbar`, stable) — A container that groups related controls into one tab stop with arrow-key navigation.
174
+
175
+ ### Overlays
176
+
177
+ - **Tooltip** (`tooltip`, stable) — A short hint shown on hover or keyboard focus.
178
+ - Not for: Essential information, or anything interactive: put it on the page or use Popover.
179
+ - See also: `popover`
180
+ - **Dialog** (`dialog`, stable) — A modal window. Open it from a trigger, control it with `[(open)]`, or open it from code and await the result with `VoltDialogService`.
181
+ - Not for: Content that does not need a decision: use a Popover or inline content.
182
+ - Not for: A secondary panel or small-screen navigation: use Drawer.
183
+ - See also: `drawer`, `popover`, `alert`
184
+ - **Drawer** (`drawer`, stable) — A modal panel that slides in from an edge of the screen.
185
+ - Not for: A decision that must block the page: use Dialog.
186
+ - See also: `dialog`, `sidebar`
187
+ - **Popover** (`popover`, stable) — A floating panel anchored to a trigger, for rich, non-modal content.
188
+ - Not for: A hint that only names a control: use Tooltip.
189
+ - Not for: A command list: use Dropdown Menu.
190
+ - See also: `tooltip`, `dropdown-menu`, `dialog`
191
+ - **Dropdown Menu** (`dropdown-menu`, stable) — A menu of actions opened from a trigger, with labels, separators and submenus.
192
+ - Not for: Choosing a value for a field: use Select.
193
+ - See also: `select`, `popover`
194
+ - **Toast** (`toast`, stable) — Short, transient notifications raised from code with `VoltToastService`.
195
+ - Not for: An error the user must read or act on: use Alert or a Dialog.
196
+ - See also: `alert`
197
+
198
+ ### Navigation
199
+
200
+ - **Tabs** (`tabs`, stable) — Switches between related panels, one visible at a time.
201
+ - Not for: Navigation where the URL owns the selection (deep links, middle-click): use real anchors.
202
+ - Not for: Panels that are really separate pages.
203
+ - See also: `navigation-menu`, `toggle-group`, `accordion`
204
+ - **Navigation Menu** (`navigation-menu`, stable) — A site navigation bar whose items can open rich submenu panels.
205
+ - Not for: Persistent application chrome with sections: use Sidebar.
206
+ - See also: `sidebar`, `tabs`, `breadcrumbs`
207
+ - **Breadcrumbs** (`breadcrumbs`, stable) — Shows the path to the current page.
208
+
209
+ ### Layout
210
+
211
+ - **Resizable** (`resizable`, stable) — Panels separated by draggable, keyboard-operable handles.
212
+ - **Sidebar** (`sidebar`, stable) — A collapsible application sidebar with header, groups, items and footer.
213
+ - Not for: A top-level menu with flyout content: use Navigation Menu.
214
+ - See also: `navigation-menu`, `drawer`
215
+
216
+ ### Foundations
217
+
218
+ - **Theme** (`theme`, stable) — Colour and style presets and the functions that apply them: provideVoltTheme at bootstrap, applyVoltTheme at runtime.
219
+ - Not for: Restyling one component: use its variants or `class`.
220
+
221
+ <!-- volt:catalog:end -->
222
+
223
+ <!-- volt:digest:start -->
224
+
225
+ - Action that changes state → Button; navigation → `<a voltButton routerLink>`; never a button inside a link.
226
+ - Fixed short list → NativeSelect; custom options/groups → Select; searchable or remote → Combobox (`filterMode="manual"`, the app owns the request).
227
+ - Form value / consent → Checkbox; immediate setting → Switch; tool pressed state → Toggle/ToggleGroup.
228
+ - Decision that blocks → Dialog; secondary panel → Drawer; anchored contextual content → Popover; hint → Tooltip (never the only copy).
229
+ - Persistent page feedback → Alert; transient confirmation → Toast; unknown wait → Spinner; known layout → Skeleton.
230
+
231
+ <!-- volt:digest:end -->
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: volt-ui-distribution
3
+ description: >
4
+ Install, use and update Volt UI correctly in either distribution mode: the @voltui/components
5
+ package (Volt* classes, volt-* selectors) or copy-and-own via @voltui/cli (Ui* classes, ui-*
6
+ selectors under ./ui). Use to detect the project's mode, add components or Recipes compositions and
7
+ starters (volt composition / volt starter), compare a customised copy with a newer CLI (volt diff),
8
+ fix wrong imports or prefixes, or set up the agent.
9
+ ---
10
+
11
+ # Package vs copy-and-own
12
+
13
+ Both modes are first-class for the whole 1.x line. Never mix them by accident.
14
+
15
+ ## Detect the mode first
16
+
17
+ | Evidence | Mode |
18
+ | ------------------------------------------------------------------------------------ | ------- |
19
+ | `@voltui/components` in `package.json`; `import { VoltX } from '@voltui/components'` | package |
20
+ | a `src/app/ui/` folder (or the CLI's configured dir); `import { UiX } from './ui/x'` | copy |
21
+
22
+ If unclear, ask — do not guess. A project in package mode must not get a copied `ui/` folder, and a
23
+ copy-mode project must not import `@voltui/components`.
24
+
25
+ ## What changes between modes
26
+
27
+ | Context | Selector | Class | Import |
28
+ | ------- | ----------------------------------------- | --------- | ---------------------- |
29
+ | package | `volt-*` / `[voltXxx]` | `VoltXxx` | `'@voltui/components'` |
30
+ | copy | `ui-*` / `[uiXxx]` (the CLI renames them) | `UiXxx` | `'./ui/<component>'` |
31
+
32
+ `'volt'` is only a monorepo alias; it never exists in a consumer project. Pass the project's mode
33
+ (`"package" | "copy"`) to `get_component` / `get_usage_example` for matching selectors and imports.
34
+
35
+ ## Package mode
36
+
37
+ ```bash
38
+ npm install @voltui/components @angular/cdk
39
+ ```
40
+
41
+ Peer dependencies (`@angular/core`, `common`, `forms`, `router`, `cdk`) are declared by the package; install `@angular/cdk` yourself at the same major as `@angular/core`. Import the theme CSS and, optionally,
42
+ `provideVoltTheme` (see `volt-ui-styling`). Updating is a version bump; read the changelog's
43
+ migration notes for a major.
44
+
45
+ ```css
46
+ @import 'tailwindcss'; /* the full import: it includes preflight */
47
+ @import '@voltui/components/themes.css';
48
+ ```
49
+
50
+ Components are styled on Tailwind's preflight: `theme.css` + `utilities.css` alone leave native
51
+ controls unstyled.
52
+
53
+ ## Copy mode
54
+
55
+ ```bash
56
+ npx @voltui/cli init # scaffold src/app/ui of the nearest package.json
57
+ npx @voltui/cli list # what exists, with status
58
+ npx @voltui/cli add button card # copies source; component dependencies come along
59
+ npx @voltui/cli add dialog --path=./src/app/shared/ui --dry-run
60
+ npx @voltui/cli add card --install # also installs what the copied files import
61
+ npx @voltui/cli add button --track # also records hashes in src/app/ui/.volt-ui.json
62
+ npx @voltui/cli@<version> diff button # read-only: local copy → that CLI's source
63
+ ```
64
+
65
+ Name a destination with `--path=<dir>` (the positional `target-dir` still works but can be mistaken
66
+ for a component name; it is the only form a CLI older than 1.4.0 understands — see below). Without one, the CLI uses `src/app/ui` of the nearest
67
+ `package.json`, also from a subfolder; in a workspace root it asks which app (`--path`). Unknown
68
+ flags and extra arguments are errors — read the message, do not retry blindly.
69
+
70
+ The CLI copies source from the library, applies the `volt-` → `ui-` transform, and you own the
71
+ result: edit it freely. A later `add` reuses untouched files and refuses to overwrite edited ones
72
+ unless you pass `--force` — review `volt diff` first. Dependencies are per component: `volt add` prints
73
+ exactly which packages the copied files need (with ranges); `--install` installs those once in the
74
+ right package, keeps compatible versions and never upgrades Angular. Do not install a fixed list.
75
+ Component examples on voltui.dev and from `get_usage_example` come in both modes.
76
+
77
+ ## Compositions and starters
78
+
79
+ Before hand-building a page section, app shell, workflow or a whole admin or marketing app, call
80
+ `find_compositions` (blocks, layouts, patterns, starters). They are source you own, not exports.
81
+
82
+ 1. With the CLI version `install.cli.capability.since` names: `npx @voltui/cli composition add <id>
83
+ --mode=<package|copy> --dry-run` (or `starter add admin`), read the plan, run it without
84
+ `--dry-run`. `--path`/`--ui` pick other folders; `--track` enables `volt composition diff <id>`.
85
+ `generate_composition_command` builds the command for a given `cliVersion`.
86
+ 2. Older CLI: `install.cli.fallback` — files into `src/app/<folder>/`, then `npx @voltui/cli add`.
87
+ 3. Customised components are kept, never replaced. If the plan stops (removed export, incomplete
88
+ copy, the other engine's folder), fix that; do not `--force` (it only replaces composition files).
89
+ 4. Read what was written, connect the `fake*` function or data source it names to your service, and
90
+ add routes and theme providers yourself: the CLI never edits `app.routes.ts`, `app.config.ts` or
91
+ styles. Build and test.
92
+
93
+ ## Source vs published
94
+
95
+ voltui.dev and the MCP server describe the **source**; npm can be behind it. `get_project_info`
96
+ lists what npm serves (`versions.publishedOnNpm`) and every capability that is not published yet.
97
+ Pass the project's versions (`componentsVersion`, `cliVersion`) to it and to `get_component` /
98
+ `generate_cli_command` / `generate_composition_command` to learn what that project can use. With an older CLI, use the positional
99
+ destination instead of `--path`, and skip `--track` / `volt diff`. Never pin an unpublished version
100
+ (`npx @voltui/cli@<next>`) or tell a user to install one.
101
+
102
+ ## Updating a customised copy
103
+
104
+ `volt diff <name> [--path=<dir>] [--json]` compares the copy (and its shared helpers) with the source
105
+ inside the CLI version that runs — not npm's latest — offline, and never changes a file. Exit 0 same,
106
+ 1 different, 2 error. With a `--track` record it says per file whether the copy (`local-changed`),
107
+ the reference (`reference-changed`) or both changed; without one, `unknown-origin`. Move the hunks
108
+ you want by hand and run the tests; never `--force` over edits you want to keep, and never edit or
109
+ create `.volt-ui.json` by hand.
110
+
111
+ ## Agent setup
112
+
113
+ ```bash
114
+ npx @voltui/agent <claude|codex|gemini|opencode|cursor|windsurf|copilot|vscode>
115
+ npx @voltui/agent doctor # checks the files it wrote and the endpoint
116
+ npx @voltui/agent --uninstall <agent>
117
+ ```
118
+
119
+ It writes the MCP server entry and, where the agent supports skills, these skills; for agents that
120
+ only read a rules file it writes a short routing block.
121
+
122
+ ## Do not
123
+
124
+ - Write `volt-*` selectors in a copy-mode project or `ui-*` in package mode.
125
+ - Import from `'volt'` or from a path inside `node_modules/@voltui/components`.
126
+ - Add `ng-primitives` imports to application code.
127
+ - Replace `@import 'tailwindcss'` with only `theme.css` + `utilities.css`: that drops preflight.
128
+
129
+ <!-- volt:digest:start -->
130
+
131
+ - Detect the mode first: `@voltui/components` (package: `Volt*`, `volt-*`) or a copied `ui/` folder (copy: `Ui*`, `ui-*`). Never mix them; `'volt'` is not importable in a consumer.
132
+ - Docs and MCP describe the source; check `get_project_info` (`publishedOnNpm`, unreleased capabilities) and pass the installed versions. Never recommend an unpublished version.
133
+ - Page sections, app shells, workflows and whole apps: `find_compositions` first; install with `volt composition add <id> --dry-run` / `volt starter add <name>` when the CLI has it (else its manual fallback), keep customised components, then connect your data, routes and theme yourself.
134
+ - Copy mode: `npx @voltui/cli add <name> [--path=<dir>] [--install] [--track]` (installs only what the copy imports); package mode: `npm install @voltui/components`. Backend: ng-primitives by default; `--base=quartz` (experimental, `@voltui/components/quartz`) only where `find_compositions` `backends.supported` lists it; never mix engines.
135
+ - Before updating an edited copy: `npx @voltui/cli@<version> diff <name>` (read-only, local → that CLI's source); apply hunks by hand, never `--force` over edits.
136
+ - CSS: the full `@import 'tailwindcss'` (with preflight, which Volt is styled on), then `@import '@voltui/components/themes.css'`.
137
+ - Pass the project's mode (`package` | `copy`) to the MCP tools to get matching selectors and imports.
138
+
139
+ <!-- volt:digest:end -->
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: volt-ui-forms
3
+ description: >
4
+ Compose forms and validation with Volt UI in Angular: FormField with Label/Hint/Error, Input,
5
+ Textarea, NativeSelect, Select, Combobox, Checkbox, Radio, Switch, Reactive Forms and
6
+ ControlValueAccessor behaviour, disabled vs aria-disabled, server-backed Combobox, async save.
7
+ Use when building or fixing a form.
8
+ ---
9
+
10
+ # Volt forms
11
+
12
+ Exact selectors and inputs: MCP `get_component` / `get_usage_example`. This skill is about how the
13
+ pieces compose.
14
+
15
+ ## Form field
16
+
17
+ Wrap a control in `FormField` and give it a label, an optional hint and an error. The field wires
18
+ the label, `aria-describedby` and `aria-invalid` to the control; do not do it by hand.
19
+
20
+ - Show the error only after the user could have seen the problem: `touched && invalid`.
21
+ - An error message is visible text. Colour alone is not an error.
22
+ - Outside a field, a label needs `htmlFor` pointing at the control's `id` (Volt moves a static `id`
23
+ from the host to the native control so `<label for>` resolves).
24
+
25
+ ## Reactive and template-driven forms
26
+
27
+ Volt controls implement `ControlValueAccessor`: use `[formControl]`, `formControlName` or
28
+ `[(ngModel)]` directly. They honour the full contract — value in, value out, `touched` on blur,
29
+ `disabled` / `enabled`, `invalid` reflected as `aria-invalid`. Do not mirror the value into a signal
30
+ to "sync" it.
31
+
32
+ - A literal value (`value="a"`) is an initial value; the control stays interactive. Use
33
+ `[(value)]` or a form control when the app needs to read it.
34
+ - `ToggleGroup` and `Listbox` hold `string[]` / `T[]` even in single mode.
35
+ - Number and boolean inputs coerce (`disabled`, `multiple`): `disabled` without a value is `true`.
36
+
37
+ ## Choosing the control
38
+
39
+ Use `volt-ui-component-selection` for NativeSelect vs Select vs Combobox, Checkbox vs Switch.
40
+
41
+ ## Disabled vs aria-disabled
42
+
43
+ - `disabled`: removes the control from the tab order and from the form's value. Use when the field
44
+ is not applicable.
45
+ - `aria-disabled="true"` on a `voltButton`: dims it, keeps focus, lets you explain why with
46
+ `aria-describedby`. Volt does not block the click — guard the handler (`if (blocked()) return;`).
47
+ Use it for "Save" while a request is pending or a precondition is unmet.
48
+
49
+ ## Server-backed Combobox
50
+
51
+ Local list → default. A server decides what matches → `filterMode="manual"`:
52
+
53
+ - `(queryChange)` is what the user typed — not the value, not the label written back after a pick.
54
+ - The app owns the request: debounce, **latest response wins**, handle errors. Volt never fetches.
55
+ - Pass results as `[items]` exactly as returned; set `[loading]` while in flight; `emptyText` for an
56
+ empty answer. Never feed server results to the local filter.
57
+ - Objects as values need `[itemLabel]`, `[compareWith]` and `[trackByFn]` keyed on a stable id.
58
+
59
+ ## Async save
60
+
61
+ Keep the submit button enabled-looking but guarded (`aria-disabled` + `aria-busy`) while pending,
62
+ show failure in an `Alert`, success in a `Toast`. Do not unmount the form on failure.
63
+
64
+ ## Do not
65
+
66
+ - Build the field chrome (label + hint + error) from raw elements.
67
+ - Use `[value]` and a `[formControl]` on the same control.
68
+ - Disable the submit button forever on an invalid form with no message saying why.
69
+
70
+ ## Start from the patterns
71
+
72
+ Two Recipes patterns are complete, tested forms workflows (`find_compositions`, kind `patterns`):
73
+ `settings-form` (validation, one in-flight save, recovery, unsaved-changes baseline) and
74
+ `async-search` (server search in a combobox, latest response wins, selection by id). Install one
75
+ (`volt composition add recipes/settings-form`) and replace its `fake*` function with your service; the form state, request policy and errors stay in
76
+ your component — Volt components hold none of it.
77
+
78
+ <!-- volt:digest:start -->
79
+
80
+ - Wrap controls in FormField (label, hint, error); show errors after `touched && invalid`, as visible text.
81
+ - Volt controls are ControlValueAccessors: use `[formControl]`/`ngModel` directly; a literal `value="a"` is an initial value, not a lock.
82
+ - `disabled` leaves the tab order; `aria-disabled` on a `voltButton` keeps focus but you must guard the handler.
83
+ - Server search: Combobox `filterMode="manual"`, `(queryChange)` is what was typed, debounce and let the latest response win, pass results as returned, set `[loading]`.
84
+
85
+ - Server search or a settings form: install the `async-search` / `settings-form` pattern (`find_compositions`, `volt composition add recipes/<name>`); request policy and form state stay in your component.
86
+
87
+ <!-- volt:digest:end -->
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: volt-ui-overlays
3
+ description: >
4
+ Compose Volt UI overlays correctly: Dialog (trigger vs controlled vs service), Drawer, Popover,
5
+ Tooltip, Dropdown Menu and Toast. Covers dismissible while pending, initial focus, focus return,
6
+ nested overlays, Dialog vs Drawer, Popover vs Tooltip, Toast vs Alert. Use when opening anything
7
+ above the page.
8
+ ---
9
+
10
+ # Volt overlays
11
+
12
+ Dialog, Drawer, Popover, Tooltip and Dropdown Menu share one pattern: an attribute directive on the
13
+ trigger, and the overlay declared in an `<ng-template>` the trigger references. Exact markup:
14
+ MCP `get_usage_example`. Never import `Ngp*` — Volt exports everything a consumer needs.
15
+
16
+ ## Dialog
17
+
18
+ Three ways to open one; pick by who owns the state.
19
+
20
+ - **Trigger-driven**: `<button [voltDialog]="tpl">`. The simplest; the dialog owns open state.
21
+ - **Controlled**: `<ng-template voltDialogRoot [(open)]="editing">`. Application state decides —
22
+ CRUD forms, anything you open from code paths with no trigger element.
23
+ - **Service**: `VoltDialogService.open(tpl, { role: 'alertdialog' }).closed` — an imperative
24
+ confirm that returns a promise-like result.
25
+
26
+ Rules:
27
+
28
+ - Always give it a title (`voltDialogTitle`) and a description (`voltDialogDescription`): they name
29
+ the dialog for assistive technology.
30
+ - A destructive confirm is `role="alertdialog"`, with focus on the **safe** action
31
+ (`initialFocus="[data-cancel]"`).
32
+ - **While a request is pending, set `[dismissible]="false"`** so Escape and overlay clicks do
33
+ nothing; `close()` always works. `[dismissible]` is live; `closeOnEscape` / `closeOnClick` are only
34
+ read when it opens.
35
+ - Focus moves in on open, is trapped, and returns to the trigger on close. Do not move it yourself
36
+ except to choose the initial target.
37
+ - Nested dialogs are fine; close the inner first. Do not open a dialog from a tooltip.
38
+
39
+ ## Dialog vs Drawer vs Popover
40
+
41
+ | Use | When |
42
+ | -------- | --------------------------------------------------------------------- |
43
+ | Dialog | the user must decide before continuing |
44
+ | Drawer | a secondary panel or small-screen navigation; keeps context beside it |
45
+ | Popover | small contextual content anchored to a control; may contain controls |
46
+ | Tooltip | a short name or hint for a control; **never** the only copy of it |
47
+ | Dropdown | a list of commands; for choosing a value use Select |
48
+
49
+ A Popover can hold a form control; a Tooltip cannot hold anything interactive.
50
+
51
+ ## Toast vs Alert
52
+
53
+ - `Toast` (via the toast service): a transient confirmation of something that already happened
54
+ ("Saved"). It disappears; never rely on it for an error the user must read.
55
+ - `Alert`: part of the page, persistent until the condition clears. Errors and blocking states.
56
+
57
+ ## Triggers and focus
58
+
59
+ - The trigger must be a real `<button>` (or `<a>` for navigation). Style it with `voltButton`.
60
+ - Escape closes, outside click dismisses (unless the overlay is not dismissible), focus returns to
61
+ the trigger. If you see any of these not happening, the overlay was built wrong — check against
62
+ the usage example before patching.
63
+ - Portals escape their container: do not rely on a parent's `overflow` or `z-index`.
64
+
65
+ <!-- volt:digest:start -->
66
+
67
+ - Dialog: trigger-driven `[voltDialog]`, controlled `voltDialogRoot [(open)]`, or `VoltDialogService`; always title + description; `[dismissible]="false"` while a request is pending.
68
+ - Destructive confirm → `role="alertdialog"` with initial focus on the safe action. Focus is trapped and returns to the trigger; do not manage it by hand.
69
+ - Overlays are an attribute directive on a real `<button>` plus an `<ng-template>`. Never import `Ngp*`.
70
+ - Toast is transient confirmation; Alert is persistent page feedback.
71
+
72
+ <!-- volt:digest:end -->
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: volt-ui-styling
3
+ description: >
4
+ Customise Volt UI without rebuilding it: semantic tokens, colour and style presets, light/dark,
5
+ the class merge contract, variants and sizes, native directives, layout wrappers, accessible
6
+ status colours. Use when changing how Volt components look or fit into a layout.
7
+ ---
8
+
9
+ # Styling Volt
10
+
11
+ **Customise Volt; do not rewrite it by accident.**
12
+
13
+ ## Order of preference
14
+
15
+ 1. **Variants and sizes** (`variant`, `size`, `state`) — the component's own design range. Ask the
16
+ MCP server which exist (`get_component`).
17
+ 2. **The theme** — change tokens or presets, and every component follows.
18
+ 3. **`class` on the component** — adjusts the one instance.
19
+ 4. **A wrapper in your layout** — for placement.
20
+
21
+ Only then consider copying the component (copy mode) and editing it.
22
+
23
+ ## Tokens and presets
24
+
25
+ - Use **semantic utilities**: `bg-primary`, `text-foreground`, `border-border`, `bg-muted`,
26
+ `text-muted-foreground`, `rounded-md`. Not `bg-[var(--primary)]`, not hard-coded hex.
27
+ - Colour presets: `volt`, `ember`, `sage`, `dusk`, `glacier`. Style presets: `sharp`, `soft`,
28
+ `brutal`, `ghost`, `retro`. Dark mode is a class on `<html>`. `provideVoltTheme({ color, style,
29
+ dark })` sets them at bootstrap; `applyVoltTheme` changes them at runtime.
30
+ - Import the theme CSS once: `@import '@voltui/components/themes.css';` after Tailwind.
31
+ - A custom palette sets the palette tokens (`--primary`, `--surface`, …) and a custom style the
32
+ `--volt-*` shape tokens, not the Tailwind utilities. Theme Studio (voltui.dev/create-theme) exports
33
+ one; import it **after** `themes.css`, then `const acme = voltCustomColor('acme')` and pass `acme`
34
+ wherever a colour goes (`provideVoltTheme`, `applyVoltTheme`, `[voltTheme]`, and `customColors` of
35
+ `voltThemeInitScript`). Copy mode: `uiCustomColor` from `./ui/theme`. Never cast a raw string to
36
+ the colour type. `get_theme_info` → `customThemes` has the steps and whether npm has it yet. An
37
+ application starter keeps its theme in `<starter>.theme.ts`: pass the custom name there.
38
+ - `[voltTheme]="{ color, style, dark, density }"` themes one container and the overlays declared in it;
39
+ `density` also goes on `provideVoltTheme`. Do not hand-write `--primary` on an element. It needs
40
+ `@voltui/components` 1.4.1 or later: check `get_project_info` before using it in a project on npm.
41
+
42
+ ## The `class` contract
43
+
44
+ `class` on a Volt component is merged over the defaults with `tailwind-merge`, on the element that
45
+ paints. So `class="p-3"` **replaces** the default padding instead of fighting it, and
46
+ `class="w-24 font-mono"` on an input styles the native `<input>`. You do not need `!important`,
47
+ `[&&]` hacks or `::ng-deep`.
48
+
49
+ Wrappers around one native control move a static `class`, `id` and `aria-label` from the host to that
50
+ control — set them on the Volt tag as usual.
51
+
52
+ ## Layout belongs to you
53
+
54
+ Grid, flex, gap, width and margin that place a component in the page go on a **wrapper element** in
55
+ your layout (or on `class` for a one-off), not into a copy of the component.
56
+
57
+ ## Status colours
58
+
59
+ Use the semantic variants (`success`, `warning`, `info`, `destructive`) and pair colour with text or
60
+ an icon — colour alone does not carry meaning, and the presets are contrast-checked only for those
61
+ pairs. In a custom palette check the pairs you change.
62
+
63
+ ## Do not
64
+
65
+ - Duplicate a component's internal classes in your own markup.
66
+ - Use arbitrary values (`bg-[#3b82f6]`) where a token exists.
67
+ - Style a state with `:hover`-only changes — pressed, selected and checked states must be visibly
68
+ different too (and have enough contrast).
69
+
70
+ <!-- volt:digest:start -->
71
+
72
+ - Prefer variants/sizes, then the theme, then `class` on the component (merged with tailwind-merge, so it replaces defaults), then a layout wrapper. Do not rewrite a component.
73
+ - Use semantic utilities (`bg-primary`, `text-foreground`, `border-border`), never hard-coded colours or `bg-[var(--x)]`.
74
+ - Presets: colour `volt|ember|sage|dusk|glacier`, style `sharp|soft|brutal|ghost|retro`; dark mode is a class on `<html>`.
75
+ - Theme one container with `[voltTheme]`; density is `compact|comfortable|spacious`, independent of the style.
76
+ - A custom palette (e.g. from Theme Studio) is CSS imported after `themes.css`, declared with `voltCustomColor('name')` and passed as `color`.
77
+ - Pressed/selected/checked states must be visibly distinct and contrast-checked; colour alone is not meaning.
78
+
79
+ <!-- volt:digest:end -->