@chromvoid/uikit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -0
- package/README.md +96 -0
- package/dist/components/cv-accordion-item.d.ts +69 -0
- package/dist/components/cv-accordion-item.js +176 -0
- package/dist/components/cv-accordion.d.ts +79 -0
- package/dist/components/cv-accordion.js +310 -0
- package/dist/components/cv-alert-dialog.d.ts +86 -0
- package/dist/components/cv-alert-dialog.js +393 -0
- package/dist/components/cv-alert.d.ts +48 -0
- package/dist/components/cv-alert.js +156 -0
- package/dist/components/cv-badge.d.ts +56 -0
- package/dist/components/cv-badge.js +280 -0
- package/dist/components/cv-breadcrumb-item.d.ts +35 -0
- package/dist/components/cv-breadcrumb-item.js +64 -0
- package/dist/components/cv-breadcrumb.d.ts +39 -0
- package/dist/components/cv-breadcrumb.js +160 -0
- package/dist/components/cv-button.d.ts +83 -0
- package/dist/components/cv-button.js +541 -0
- package/dist/components/cv-callout.d.ts +32 -0
- package/dist/components/cv-callout.js +221 -0
- package/dist/components/cv-card.d.ts +48 -0
- package/dist/components/cv-card.js +269 -0
- package/dist/components/cv-carousel-slide.d.ts +25 -0
- package/dist/components/cv-carousel-slide.js +51 -0
- package/dist/components/cv-carousel.d.ts +96 -0
- package/dist/components/cv-carousel.js +457 -0
- package/dist/components/cv-checkbox.d.ts +84 -0
- package/dist/components/cv-checkbox.js +274 -0
- package/dist/components/cv-combobox-group.d.ts +15 -0
- package/dist/components/cv-combobox-group.js +34 -0
- package/dist/components/cv-combobox-option.d.ts +30 -0
- package/dist/components/cv-combobox-option.js +66 -0
- package/dist/components/cv-combobox.d.ts +135 -0
- package/dist/components/cv-combobox.js +834 -0
- package/dist/components/cv-command-item.d.ts +30 -0
- package/dist/components/cv-command-item.js +68 -0
- package/dist/components/cv-command-palette.d.ts +105 -0
- package/dist/components/cv-command-palette.js +578 -0
- package/dist/components/cv-context-menu.d.ts +98 -0
- package/dist/components/cv-context-menu.js +515 -0
- package/dist/components/cv-copy-button.d.ts +61 -0
- package/dist/components/cv-copy-button.js +318 -0
- package/dist/components/cv-date-picker.d.ts +161 -0
- package/dist/components/cv-date-picker.js +803 -0
- package/dist/components/cv-dialog.d.ts +89 -0
- package/dist/components/cv-dialog.js +459 -0
- package/dist/components/cv-disclosure.d.ts +57 -0
- package/dist/components/cv-disclosure.js +241 -0
- package/dist/components/cv-drawer.d.ts +102 -0
- package/dist/components/cv-drawer.js +595 -0
- package/dist/components/cv-feed-article.d.ts +26 -0
- package/dist/components/cv-feed-article.js +52 -0
- package/dist/components/cv-feed.d.ts +62 -0
- package/dist/components/cv-feed.js +310 -0
- package/dist/components/cv-grid-cell.d.ts +30 -0
- package/dist/components/cv-grid-cell.js +57 -0
- package/dist/components/cv-grid-column.d.ts +30 -0
- package/dist/components/cv-grid-column.js +43 -0
- package/dist/components/cv-grid-row.d.ts +30 -0
- package/dist/components/cv-grid-row.js +42 -0
- package/dist/components/cv-grid.d.ts +119 -0
- package/dist/components/cv-grid.js +567 -0
- package/dist/components/cv-icon.d.ts +57 -0
- package/dist/components/cv-icon.js +352 -0
- package/dist/components/cv-input.d.ts +127 -0
- package/dist/components/cv-input.js +482 -0
- package/dist/components/cv-landmark.d.ts +32 -0
- package/dist/components/cv-landmark.js +62 -0
- package/dist/components/cv-link.d.ts +22 -0
- package/dist/components/cv-link.js +99 -0
- package/dist/components/cv-listbox-group.d.ts +15 -0
- package/dist/components/cv-listbox-group.js +42 -0
- package/dist/components/cv-listbox.d.ts +81 -0
- package/dist/components/cv-listbox.js +388 -0
- package/dist/components/cv-menu-button.d.ts +118 -0
- package/dist/components/cv-menu-button.js +822 -0
- package/dist/components/cv-menu-group.d.ts +20 -0
- package/dist/components/cv-menu-group.js +48 -0
- package/dist/components/cv-menu-item.d.ts +52 -0
- package/dist/components/cv-menu-item.js +105 -0
- package/dist/components/cv-menu.d.ts +62 -0
- package/dist/components/cv-menu.js +414 -0
- package/dist/components/cv-meter.d.ts +66 -0
- package/dist/components/cv-meter.js +154 -0
- package/dist/components/cv-number.d.ts +139 -0
- package/dist/components/cv-number.js +553 -0
- package/dist/components/cv-option.d.ts +30 -0
- package/dist/components/cv-option.js +84 -0
- package/dist/components/cv-popover.d.ts +87 -0
- package/dist/components/cv-popover.js +373 -0
- package/dist/components/cv-progress-ring.d.ts +45 -0
- package/dist/components/cv-progress-ring.js +169 -0
- package/dist/components/cv-progress.d.ts +45 -0
- package/dist/components/cv-progress.js +148 -0
- package/dist/components/cv-radio-group.d.ts +79 -0
- package/dist/components/cv-radio-group.js +398 -0
- package/dist/components/cv-radio.d.ts +36 -0
- package/dist/components/cv-radio.js +123 -0
- package/dist/components/cv-select-group.d.ts +15 -0
- package/dist/components/cv-select-group.js +44 -0
- package/dist/components/cv-select-option.d.ts +30 -0
- package/dist/components/cv-select-option.js +66 -0
- package/dist/components/cv-select.d.ts +128 -0
- package/dist/components/cv-select.js +666 -0
- package/dist/components/cv-sidebar-item.d.ts +26 -0
- package/dist/components/cv-sidebar-item.js +142 -0
- package/dist/components/cv-sidebar.d.ts +171 -0
- package/dist/components/cv-sidebar.js +767 -0
- package/dist/components/cv-slider-multi-thumb.d.ts +73 -0
- package/dist/components/cv-slider-multi-thumb.js +374 -0
- package/dist/components/cv-slider.d.ts +84 -0
- package/dist/components/cv-slider.js +328 -0
- package/dist/components/cv-spinbutton.d.ts +121 -0
- package/dist/components/cv-spinbutton.js +486 -0
- package/dist/components/cv-spinner.d.ts +18 -0
- package/dist/components/cv-spinner.js +95 -0
- package/dist/components/cv-switch.d.ts +81 -0
- package/dist/components/cv-switch.js +285 -0
- package/dist/components/cv-tab-panel.d.ts +20 -0
- package/dist/components/cv-tab-panel.js +37 -0
- package/dist/components/cv-tab.d.ts +40 -0
- package/dist/components/cv-tab.js +132 -0
- package/dist/components/cv-table-cell.d.ts +31 -0
- package/dist/components/cv-table-cell.js +49 -0
- package/dist/components/cv-table-column.d.ts +37 -0
- package/dist/components/cv-table-column.js +63 -0
- package/dist/components/cv-table-row.d.ts +30 -0
- package/dist/components/cv-table-row.js +45 -0
- package/dist/components/cv-table.d.ts +147 -0
- package/dist/components/cv-table.js +607 -0
- package/dist/components/cv-tabs.d.ts +70 -0
- package/dist/components/cv-tabs.js +524 -0
- package/dist/components/cv-textarea.d.ts +108 -0
- package/dist/components/cv-textarea.js +328 -0
- package/dist/components/cv-toast-region.d.ts +39 -0
- package/dist/components/cv-toast-region.js +162 -0
- package/dist/components/cv-toast.d.ts +67 -0
- package/dist/components/cv-toast.js +315 -0
- package/dist/components/cv-toolbar-item.d.ts +25 -0
- package/dist/components/cv-toolbar-item.js +72 -0
- package/dist/components/cv-toolbar-separator.d.ts +25 -0
- package/dist/components/cv-toolbar-separator.js +45 -0
- package/dist/components/cv-toolbar.d.ts +63 -0
- package/dist/components/cv-toolbar.js +295 -0
- package/dist/components/cv-tooltip.d.ts +83 -0
- package/dist/components/cv-tooltip.js +455 -0
- package/dist/components/cv-treegrid-cell.d.ts +30 -0
- package/dist/components/cv-treegrid-cell.js +57 -0
- package/dist/components/cv-treegrid-column.d.ts +37 -0
- package/dist/components/cv-treegrid-column.js +53 -0
- package/dist/components/cv-treegrid-row.d.ts +55 -0
- package/dist/components/cv-treegrid-row.js +90 -0
- package/dist/components/cv-treegrid.d.ts +96 -0
- package/dist/components/cv-treegrid.js +632 -0
- package/dist/components/cv-treeitem.d.ts +58 -0
- package/dist/components/cv-treeitem.js +144 -0
- package/dist/components/cv-treeview.d.ts +70 -0
- package/dist/components/cv-treeview.js +396 -0
- package/dist/components/cv-window-splitter.d.ts +79 -0
- package/dist/components/cv-window-splitter.js +316 -0
- package/dist/components/index.d.ts +94 -0
- package/dist/components/index.js +79 -0
- package/dist/dialog/create-dialog-controller.d.ts +31 -0
- package/dist/dialog/create-dialog-controller.js +320 -0
- package/dist/dialog/index.d.ts +2 -0
- package/dist/dialog/index.js +1 -0
- package/dist/form-associated/FormAssociatedReatomElement.d.ts +25 -0
- package/dist/form-associated/FormAssociatedReatomElement.js +70 -0
- package/dist/form-associated/withFormAssociated.d.ts +5 -0
- package/dist/form-associated/withFormAssociated.js +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -0
- package/dist/reatom-lit/ReatomLitElement.d.ts +27 -0
- package/dist/reatom-lit/ReatomLitElement.js +118 -0
- package/dist/reatom-lit/html.d.ts +4 -0
- package/dist/reatom-lit/html.js +10 -0
- package/dist/reatom-lit/index.d.ts +4 -0
- package/dist/reatom-lit/index.js +4 -0
- package/dist/reatom-lit/watch.d.ts +15 -0
- package/dist/reatom-lit/watch.js +40 -0
- package/dist/reatom-lit/withReatomElement.d.ts +4 -0
- package/dist/reatom-lit/withReatomElement.js +57 -0
- package/dist/register.d.ts +1 -0
- package/dist/register.js +84 -0
- package/dist/styles/component-styles.d.ts +4 -0
- package/dist/styles/component-styles.js +78 -0
- package/dist/theme/cv-theme-provider.d.ts +32 -0
- package/dist/theme/cv-theme-provider.js +110 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/index.js +2 -0
- package/dist/theme/theme-engine.d.ts +4 -0
- package/dist/theme/theme-engine.js +67 -0
- package/dist/theme/tokens.css +265 -0
- package/dist/theme/types.d.ts +7 -0
- package/dist/theme/types.js +1 -0
- package/dist/toast/create-toast-controller.d.ts +12 -0
- package/dist/toast/create-toast-controller.js +12 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +1 -0
- package/package.json +146 -0
- package/specs/_template.md +110 -0
- package/specs/components/accordion.md +207 -0
- package/specs/components/alert.md +83 -0
- package/specs/components/badge.md +183 -0
- package/specs/components/breadcrumb.md +152 -0
- package/specs/components/button.md +227 -0
- package/specs/components/callout.md +153 -0
- package/specs/components/card.md +192 -0
- package/specs/components/carousel.md +232 -0
- package/specs/components/checkbox.md +141 -0
- package/specs/components/combobox.md +427 -0
- package/specs/components/context-menu.md +375 -0
- package/specs/components/copy-button.md +236 -0
- package/specs/components/date-picker.md +290 -0
- package/specs/components/dialog.md +184 -0
- package/specs/components/disclosure.md +151 -0
- package/specs/components/drawer.md +216 -0
- package/specs/components/feed.md +266 -0
- package/specs/components/grid.md +423 -0
- package/specs/components/input.md +237 -0
- package/specs/components/landmark.md +92 -0
- package/specs/components/link.md +117 -0
- package/specs/components/listbox.md +327 -0
- package/specs/components/menu.md +508 -0
- package/specs/components/meter.md +148 -0
- package/specs/components/number.md +268 -0
- package/specs/components/option.md +167 -0
- package/specs/components/popover.md +207 -0
- package/specs/components/progress-ring.md +134 -0
- package/specs/components/progress.md +110 -0
- package/specs/components/radio.md +208 -0
- package/specs/components/select.md +305 -0
- package/specs/components/sidebar.md +204 -0
- package/specs/components/spinbutton.md +157 -0
- package/specs/components/spinner.md +83 -0
- package/specs/components/switch.md +145 -0
- package/specs/components/table.md +372 -0
- package/specs/components/tabs.md +242 -0
- package/specs/components/textarea.md +166 -0
- package/specs/components/theme.md +364 -0
- package/specs/components/toast.md +198 -0
- package/specs/components/toolbar.md +258 -0
- package/specs/components/tooltip.md +152 -0
- package/specs/components/treegrid.md +363 -0
- package/specs/components/treeview.md +263 -0
- package/specs/components/window-splitter.md +225 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# cv-accordion
|
|
2
|
+
|
|
3
|
+
Vertically stacked set of interactive sections that expand or collapse to reveal content.
|
|
4
|
+
|
|
5
|
+
**Headless:** [`createAccordion`](https://github.com/chromvoid/headless-ui/blob/main/specs/components/accordion.md)
|
|
6
|
+
|
|
7
|
+
## Anatomy
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<cv-accordion> (host)
|
|
11
|
+
└── <section part="base" aria-label="…">
|
|
12
|
+
└── <slot> ← cv-accordion-item elements
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Attributes
|
|
16
|
+
|
|
17
|
+
| Attribute | Type | Default | Description |
|
|
18
|
+
| --------------------- | ------- | ------- | -------------------------------------------------------------------------------------------- |
|
|
19
|
+
| `value` | String | `""` | Expanded section value (single mode). Reflects the first expanded item's `value`. |
|
|
20
|
+
| `allow-multiple` | Boolean | `false` | Allow multiple sections expanded simultaneously |
|
|
21
|
+
| `allow-zero-expanded` | Boolean | `true` | Allow all sections to be collapsed. When `false`, at least one section must remain expanded. |
|
|
22
|
+
| `heading-level` | Number | `3` | Heading level (1–6) for all item headers |
|
|
23
|
+
| `aria-label` | String | `""` | Accessible label for the accordion group |
|
|
24
|
+
|
|
25
|
+
**JS-only property:**
|
|
26
|
+
|
|
27
|
+
| Property | Type | Default | Description |
|
|
28
|
+
| ---------------- | ---------- | ------- | ---------------------------------------------------------------------- |
|
|
29
|
+
| `expandedValues` | `string[]` | `[]` | Array of expanded section values (meaningful in `allow-multiple` mode) |
|
|
30
|
+
|
|
31
|
+
## Slots
|
|
32
|
+
|
|
33
|
+
| Slot | Description |
|
|
34
|
+
| ----------- | ---------------------------- |
|
|
35
|
+
| `(default)` | `cv-accordion-item` elements |
|
|
36
|
+
|
|
37
|
+
## CSS Parts
|
|
38
|
+
|
|
39
|
+
| Part | Element | Description |
|
|
40
|
+
| ------ | ----------- | ------------------------------ |
|
|
41
|
+
| `base` | `<section>` | Root wrapper with `aria-label` |
|
|
42
|
+
|
|
43
|
+
## CSS Custom Properties
|
|
44
|
+
|
|
45
|
+
| Property | Default | Description |
|
|
46
|
+
| -------------------- | ------------------------ | ------------------------------- |
|
|
47
|
+
| `--cv-accordion-gap` | `var(--cv-space-2, 8px)` | Spacing between accordion items |
|
|
48
|
+
|
|
49
|
+
## Visual States
|
|
50
|
+
|
|
51
|
+
| Host selector | Description |
|
|
52
|
+
| ------------------------- | --------------------------------- |
|
|
53
|
+
| `:host([allow-multiple])` | Multiple sections can be expanded |
|
|
54
|
+
|
|
55
|
+
## Events
|
|
56
|
+
|
|
57
|
+
| Event | Detail | Description |
|
|
58
|
+
| ----------- | --------------------------- | ---------------------------------------------------------- |
|
|
59
|
+
| `cv-input` | `{value, values, activeId}` | Fires on any interaction (expand/collapse or focus change) |
|
|
60
|
+
| `cv-change` | `{value, values, activeId}` | Fires only when expanded sections change |
|
|
61
|
+
|
|
62
|
+
**Event detail shape:**
|
|
63
|
+
|
|
64
|
+
| Field | Type | Description |
|
|
65
|
+
| ---------- | ---------------- | -------------------------------------------- |
|
|
66
|
+
| `value` | `string \| null` | First expanded item value, or `null` if none |
|
|
67
|
+
| `values` | `string[]` | All expanded item values |
|
|
68
|
+
| `activeId` | `string \| null` | Currently focused item value |
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
```html
|
|
73
|
+
<!-- Single mode (default) -->
|
|
74
|
+
<cv-accordion>
|
|
75
|
+
<cv-accordion-item value="about">
|
|
76
|
+
<span slot="trigger">About</span>
|
|
77
|
+
<p>About section content.</p>
|
|
78
|
+
</cv-accordion-item>
|
|
79
|
+
<cv-accordion-item value="faq">
|
|
80
|
+
<span slot="trigger">FAQ</span>
|
|
81
|
+
<p>Frequently asked questions.</p>
|
|
82
|
+
</cv-accordion-item>
|
|
83
|
+
</cv-accordion>
|
|
84
|
+
|
|
85
|
+
<!-- Multiple mode -->
|
|
86
|
+
<cv-accordion allow-multiple>
|
|
87
|
+
<cv-accordion-item value="a" expanded>
|
|
88
|
+
<span slot="trigger">Section A</span>
|
|
89
|
+
<p>Content A</p>
|
|
90
|
+
</cv-accordion-item>
|
|
91
|
+
<cv-accordion-item value="b">
|
|
92
|
+
<span slot="trigger">Section B</span>
|
|
93
|
+
<p>Content B</p>
|
|
94
|
+
</cv-accordion-item>
|
|
95
|
+
</cv-accordion>
|
|
96
|
+
|
|
97
|
+
<!-- Exact-exclusive (one must stay open) -->
|
|
98
|
+
<cv-accordion value="intro" :allow-zero-expanded="false">
|
|
99
|
+
<cv-accordion-item value="intro">
|
|
100
|
+
<span slot="trigger">Introduction</span>
|
|
101
|
+
<p>Intro content.</p>
|
|
102
|
+
</cv-accordion-item>
|
|
103
|
+
<cv-accordion-item value="details">
|
|
104
|
+
<span slot="trigger">Details</span>
|
|
105
|
+
<p>Details content.</p>
|
|
106
|
+
</cv-accordion-item>
|
|
107
|
+
</cv-accordion>
|
|
108
|
+
|
|
109
|
+
<!-- Custom heading level -->
|
|
110
|
+
<cv-accordion heading-level="4">
|
|
111
|
+
<cv-accordion-item value="s1">
|
|
112
|
+
<span slot="trigger">Under an h3</span>
|
|
113
|
+
<p>Content here.</p>
|
|
114
|
+
</cv-accordion-item>
|
|
115
|
+
</cv-accordion>
|
|
116
|
+
|
|
117
|
+
<!-- Custom icons -->
|
|
118
|
+
<cv-accordion>
|
|
119
|
+
<cv-accordion-item value="custom">
|
|
120
|
+
<span slot="trigger">Custom icons</span>
|
|
121
|
+
<cv-icon name="plus" slot="expand-icon"></cv-icon>
|
|
122
|
+
<cv-icon name="minus" slot="collapse-icon"></cv-icon>
|
|
123
|
+
<p>Content with plus/minus icons.</p>
|
|
124
|
+
</cv-accordion-item>
|
|
125
|
+
</cv-accordion>
|
|
126
|
+
|
|
127
|
+
<!-- Disabled item -->
|
|
128
|
+
<cv-accordion>
|
|
129
|
+
<cv-accordion-item value="enabled">
|
|
130
|
+
<span slot="trigger">Enabled</span>
|
|
131
|
+
<p>This section works.</p>
|
|
132
|
+
</cv-accordion-item>
|
|
133
|
+
<cv-accordion-item value="locked" disabled>
|
|
134
|
+
<span slot="trigger">Locked</span>
|
|
135
|
+
<p>This section cannot be toggled.</p>
|
|
136
|
+
</cv-accordion-item>
|
|
137
|
+
</cv-accordion>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Child Elements
|
|
141
|
+
|
|
142
|
+
### cv-accordion-item
|
|
143
|
+
|
|
144
|
+
#### Anatomy
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
<cv-accordion-item> (host)
|
|
148
|
+
└── <div part="base">
|
|
149
|
+
├── <h3 part="header" id="…"> ← heading level from parent
|
|
150
|
+
│ └── <button part="trigger" aria-expanded="…" aria-controls="…">
|
|
151
|
+
│ ├── <slot name="trigger"> ← header label
|
|
152
|
+
│ └── <span part="indicator" aria-hidden="true">
|
|
153
|
+
│ ├── <slot name="expand-icon">▶</slot> ← shown when collapsed
|
|
154
|
+
│ └── <slot name="collapse-icon">▶</slot> ← shown when expanded (rotated)
|
|
155
|
+
└── <div part="panel" role="region" aria-labelledby="…">
|
|
156
|
+
└── <slot> ← panel content
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### Attributes
|
|
160
|
+
|
|
161
|
+
| Attribute | Type | Default | Description |
|
|
162
|
+
| ---------- | ------- | ------- | ----------------------------------------------------------------------------- |
|
|
163
|
+
| `value` | String | `""` | Unique identifier for this section. Auto-generated as `section-{n}` if empty. |
|
|
164
|
+
| `disabled` | Boolean | `false` | Prevents toggling this section |
|
|
165
|
+
| `expanded` | Boolean | `false` | Whether panel content is visible (reflected, managed by parent) |
|
|
166
|
+
| `active` | Boolean | `false` | Whether this item's trigger has roving focus (reflected, managed by parent) |
|
|
167
|
+
|
|
168
|
+
#### Slots
|
|
169
|
+
|
|
170
|
+
| Slot | Description |
|
|
171
|
+
| --------------- | ----------------------------------------------------------------- |
|
|
172
|
+
| `(default)` | Panel content |
|
|
173
|
+
| `trigger` | Header label text |
|
|
174
|
+
| `expand-icon` | Icon shown when the panel is collapsed. Default: `▶` |
|
|
175
|
+
| `collapse-icon` | Icon shown when the panel is expanded. Default: `▶` (rotated 90°) |
|
|
176
|
+
|
|
177
|
+
#### CSS Parts
|
|
178
|
+
|
|
179
|
+
| Part | Element | Description |
|
|
180
|
+
| ----------- | ---------- | -------------------------------------------------------------- |
|
|
181
|
+
| `base` | `<div>` | Root wrapper |
|
|
182
|
+
| `header` | `<h3>` | Heading element (level controlled by parent's `heading-level`) |
|
|
183
|
+
| `trigger` | `<button>` | Interactive toggle button |
|
|
184
|
+
| `indicator` | `<span>` | Wrapper around expand/collapse icon slots |
|
|
185
|
+
| `panel` | `<div>` | Expandable content region |
|
|
186
|
+
|
|
187
|
+
#### CSS Custom Properties
|
|
188
|
+
|
|
189
|
+
| Property | Default | Description |
|
|
190
|
+
| -------------------------------------------- | -------------------------------- | ------------------------------------------ |
|
|
191
|
+
| `--cv-accordion-item-trigger-min-height` | `36px` | Minimum height of the trigger button |
|
|
192
|
+
| `--cv-accordion-item-trigger-padding-inline` | `var(--cv-space-3, 12px)` | Horizontal padding of trigger |
|
|
193
|
+
| `--cv-accordion-item-trigger-border-radius` | `var(--cv-radius-sm, 6px)` | Border radius of trigger |
|
|
194
|
+
| `--cv-accordion-item-trigger-gap` | `var(--cv-space-2, 8px)` | Gap between trigger label and icon |
|
|
195
|
+
| `--cv-accordion-item-panel-padding` | `var(--cv-space-3, 12px)` | Padding inside the panel |
|
|
196
|
+
| `--cv-accordion-item-panel-border-radius` | `var(--cv-radius-sm, 6px)` | Border radius of panel |
|
|
197
|
+
| `--cv-accordion-item-gap` | `var(--cv-space-1, 4px)` | Gap between trigger and panel |
|
|
198
|
+
| `--cv-accordion-item-indicator-size` | `16px` | Size of the indicator icon area |
|
|
199
|
+
| `--cv-accordion-item-duration` | `var(--cv-duration-fast, 120ms)` | Transition duration for indicator rotation |
|
|
200
|
+
|
|
201
|
+
#### Visual States
|
|
202
|
+
|
|
203
|
+
| Host selector | Description |
|
|
204
|
+
| ------------------- | ------------------------------------------------------------------------------------------------ |
|
|
205
|
+
| `:host([expanded])` | Panel visible; collapse-icon shown, expand-icon hidden; indicator rotated 90° (for default icon) |
|
|
206
|
+
| `:host([active])` | Trigger has roving focus; border highlighted with `--cv-color-primary` |
|
|
207
|
+
| `:host([disabled])` | Trigger opacity reduced (`0.55`), `cursor: not-allowed`, interaction blocked |
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# cv-alert
|
|
2
|
+
|
|
3
|
+
Passive live-region message that announces important updates without taking focus.
|
|
4
|
+
|
|
5
|
+
**Headless:** [`createAlert`](https://github.com/chromvoid/headless-ui/blob/main/specs/components/alert.md)
|
|
6
|
+
|
|
7
|
+
## Anatomy
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<cv-alert> (host)
|
|
11
|
+
└── <div part="base" role="alert">
|
|
12
|
+
├── <div part="message"> ← current message text
|
|
13
|
+
└── <slot> ← optional additional static content
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Attributes
|
|
17
|
+
|
|
18
|
+
| Attribute | Type | Default | Description |
|
|
19
|
+
| ------------- | --------------- | ------------- | ---------------------------------------------------------- |
|
|
20
|
+
| `duration-ms` | Number | `0` | Auto-hide timeout in milliseconds (`0` disables auto-hide) |
|
|
21
|
+
| `aria-live` | String | `"assertive"` | Live-region priority: `assertive` \| `polite` |
|
|
22
|
+
| `aria-atomic` | Boolean | `true` | Announces the whole region when content changes |
|
|
23
|
+
| `visible` | Boolean (state) | `false` | Reflected visibility state managed by component state |
|
|
24
|
+
|
|
25
|
+
## Slots
|
|
26
|
+
|
|
27
|
+
| Slot | Description |
|
|
28
|
+
| ----------- | ------------------------------------------------------ |
|
|
29
|
+
| `(default)` | Optional static, non-interactive supplementary content |
|
|
30
|
+
|
|
31
|
+
## CSS Parts
|
|
32
|
+
|
|
33
|
+
| Part | Element | Description |
|
|
34
|
+
| --------- | ------- | ----------------------------------------------------- |
|
|
35
|
+
| `base` | `<div>` | Live-region wrapper carrying role and ARIA attributes |
|
|
36
|
+
| `message` | `<div>` | Current message text |
|
|
37
|
+
|
|
38
|
+
## CSS Custom Properties
|
|
39
|
+
|
|
40
|
+
| Property | Default | Description |
|
|
41
|
+
| -------------------------------- | ------------------------------------------- | --------------------------------------- |
|
|
42
|
+
| `--cv-alert-gap` | `var(--cv-space-2, 8px)` | Gap between message and slotted content |
|
|
43
|
+
| `--cv-alert-padding-inline` | `var(--cv-space-3, 12px)` | Horizontal padding for alert container |
|
|
44
|
+
| `--cv-alert-padding-block` | `var(--cv-space-2, 8px)` | Vertical padding for alert container |
|
|
45
|
+
| `--cv-alert-radius` | `var(--cv-radius-sm, 6px)` | Border radius |
|
|
46
|
+
| `--cv-alert-border-color` | `var(--cv-color-border, #2a3245)` | Border color |
|
|
47
|
+
| `--cv-alert-background` | `var(--cv-color-surface-elevated, #1d2432)` | Background color |
|
|
48
|
+
| `--cv-alert-color` | `var(--cv-color-text, #e8ecf6)` | Text color |
|
|
49
|
+
| `--cv-alert-transition-duration` | `var(--cv-duration-fast, 120ms)` | Transition duration for show/hide |
|
|
50
|
+
| `--cv-alert-transition-easing` | `var(--cv-easing-standard, ease)` | Transition timing function |
|
|
51
|
+
| `--cv-alert-hidden-translate-y` | `-2px` | Vertical offset when hidden |
|
|
52
|
+
|
|
53
|
+
## Visual States
|
|
54
|
+
|
|
55
|
+
| Host selector | Description |
|
|
56
|
+
| ------------------------ | ------------------------------------------------------- |
|
|
57
|
+
| `:host([visible])` | Visible state; base is fully opaque and interactive |
|
|
58
|
+
| `:host(:not([visible]))` | Hidden state; base fades and translates slightly upward |
|
|
59
|
+
|
|
60
|
+
## Events
|
|
61
|
+
|
|
62
|
+
| Event | Detail | Description |
|
|
63
|
+
| ----------- | ------------------------------------- | ------------------------------ |
|
|
64
|
+
| `cv-input` | `{visible: boolean, message: string}` | Fires when alert state updates |
|
|
65
|
+
| `cv-change` | `{visible: boolean, message: string}` | Fires when visibility toggles |
|
|
66
|
+
|
|
67
|
+
## Accessibility
|
|
68
|
+
|
|
69
|
+
- Root element always uses `role="alert"`.
|
|
70
|
+
- `aria-live` and `aria-atomic` are sourced from headless `getAlertProps()`.
|
|
71
|
+
- Component is passive and does not move focus or manage keyboard interaction.
|
|
72
|
+
- For interactive/decision-required flows, use `cv-alert-dialog`.
|
|
73
|
+
|
|
74
|
+
## Usage
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<cv-alert id="saved-alert"></cv-alert>
|
|
78
|
+
|
|
79
|
+
<script type="module">
|
|
80
|
+
const alert = document.getElementById('saved-alert')
|
|
81
|
+
alert.show('Configuration saved successfully')
|
|
82
|
+
</script>
|
|
83
|
+
```
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# cv-badge
|
|
2
|
+
|
|
3
|
+
Non-interactive status indicator that displays short labels, counts, or colored dots.
|
|
4
|
+
|
|
5
|
+
**Headless:** [`createBadge`](https://github.com/chromvoid/headless-ui/blob/main/specs/components/badge.md)
|
|
6
|
+
|
|
7
|
+
## Anatomy
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<cv-badge> (host)
|
|
11
|
+
└── <div part="base">
|
|
12
|
+
├── <span part="prefix">
|
|
13
|
+
│ └── <slot name="prefix">
|
|
14
|
+
├── <span part="label"> ← hidden when [dot]
|
|
15
|
+
│ └── <slot>
|
|
16
|
+
└── <span part="suffix">
|
|
17
|
+
└── <slot name="suffix">
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Attributes
|
|
21
|
+
|
|
22
|
+
| Attribute | Type | Default | Description |
|
|
23
|
+
| ------------ | ------- | ----------- | -------------------------------------------------------------------------------------- |
|
|
24
|
+
| `variant` | String | `"neutral"` | Visual variant: `"primary"` \| `"success"` \| `"neutral"` \| `"warning"` \| `"danger"` |
|
|
25
|
+
| `size` | String | `"medium"` | Size: `"small"` \| `"medium"` \| `"large"` |
|
|
26
|
+
| `dot` | Boolean | `false` | Dot mode: hides textual content, shows a colored circle indicator |
|
|
27
|
+
| `pulse` | Boolean | `false` | Enables a pulsing animation to draw attention |
|
|
28
|
+
| `pill` | Boolean | `false` | Fully rounded edges (`border-radius: 999px`) |
|
|
29
|
+
| `dynamic` | Boolean | `false` | Enables live-region semantics for runtime content changes |
|
|
30
|
+
| `decorative` | Boolean | `false` | Hides the badge from assistive technology |
|
|
31
|
+
|
|
32
|
+
## Variants
|
|
33
|
+
|
|
34
|
+
| Variant | Description |
|
|
35
|
+
| --------- | --------------------------------------------------------------- |
|
|
36
|
+
| `neutral` | Default muted style with surface background and border |
|
|
37
|
+
| `primary` | Primary-tinted background and border using `--cv-color-primary` |
|
|
38
|
+
| `success` | Success-tinted background and border using `--cv-color-success` |
|
|
39
|
+
| `warning` | Warning-tinted background and border using `--cv-color-warning` |
|
|
40
|
+
| `danger` | Danger-tinted background and border using `--cv-color-danger` |
|
|
41
|
+
|
|
42
|
+
The `dot`, `pulse`, and `pill` boolean modifiers can be combined with any variant.
|
|
43
|
+
|
|
44
|
+
## Sizes
|
|
45
|
+
|
|
46
|
+
| Size | `--cv-badge-height` | `--cv-badge-padding-inline` | `--cv-badge-font-size` | `--cv-badge-dot-size` |
|
|
47
|
+
| -------- | ------------------- | --------------------------- | ---------------------- | --------------------- |
|
|
48
|
+
| `small` | `20px` | `var(--cv-space-1, 4px)` | `11px` | `6px` |
|
|
49
|
+
| `medium` | `24px` | `var(--cv-space-2, 8px)` | `12px` | `8px` |
|
|
50
|
+
| `large` | `28px` | `var(--cv-space-3, 12px)` | `14px` | `10px` |
|
|
51
|
+
|
|
52
|
+
## Slots
|
|
53
|
+
|
|
54
|
+
| Slot | Description |
|
|
55
|
+
| ----------- | -------------------------------- |
|
|
56
|
+
| `(default)` | Badge label (hidden in dot mode) |
|
|
57
|
+
| `prefix` | Icon or element before label |
|
|
58
|
+
| `suffix` | Icon or element after label |
|
|
59
|
+
|
|
60
|
+
## CSS Parts
|
|
61
|
+
|
|
62
|
+
| Part | Element | Description |
|
|
63
|
+
| -------- | -------- | ------------------------------------------------------------------------- |
|
|
64
|
+
| `base` | `<div>` | Root wrapper element; receives headless `getBadgeProps()` ARIA attributes |
|
|
65
|
+
| `label` | `<span>` | Wrapper around the default slot (hidden when `dot` is `true`) |
|
|
66
|
+
| `prefix` | `<span>` | Wrapper around the `prefix` slot |
|
|
67
|
+
| `suffix` | `<span>` | Wrapper around the `suffix` slot |
|
|
68
|
+
|
|
69
|
+
## CSS Custom Properties
|
|
70
|
+
|
|
71
|
+
| Property | Default | Description |
|
|
72
|
+
| --------------------------- | -------------------------- | ----------------------------------------- |
|
|
73
|
+
| `--cv-badge-height` | `24px` | Block size of the badge |
|
|
74
|
+
| `--cv-badge-padding-inline` | `var(--cv-space-2, 8px)` | Horizontal padding |
|
|
75
|
+
| `--cv-badge-border-radius` | `var(--cv-radius-sm, 6px)` | Border radius for badge shape |
|
|
76
|
+
| `--cv-badge-gap` | `var(--cv-space-1, 4px)` | Spacing between badge content parts |
|
|
77
|
+
| `--cv-badge-font-size` | `12px` | Font size of badge content |
|
|
78
|
+
| `--cv-badge-dot-size` | `8px` | Diameter of the dot indicator in dot mode |
|
|
79
|
+
|
|
80
|
+
Additionally, component styles depend on theme tokens through fallback values:
|
|
81
|
+
|
|
82
|
+
| Theme Property | Default | Description |
|
|
83
|
+
| ---------------------- | --------- | ----------------------------------- |
|
|
84
|
+
| `--cv-color-border` | `#2a3245` | Base border color |
|
|
85
|
+
| `--cv-color-surface` | `#141923` | Surface background color |
|
|
86
|
+
| `--cv-color-text` | `#e8ecf6` | Default text color |
|
|
87
|
+
| `--cv-color-primary` | `#65d7ff` | Primary accent color |
|
|
88
|
+
| `--cv-color-success` | `#5beba0` | Success accent color |
|
|
89
|
+
| `--cv-color-warning` | `#ffc857` | Warning accent color |
|
|
90
|
+
| `--cv-color-danger` | `#ff7d86` | Danger accent color |
|
|
91
|
+
| `--cv-duration-fast` | `120ms` | Transition duration |
|
|
92
|
+
| `--cv-easing-standard` | `ease` | Transition timing function |
|
|
93
|
+
| `--cv-radius-sm` | `6px` | Base radius used for badge fallback |
|
|
94
|
+
| `--cv-space-1` | `4px` | Small spacing scale fallback |
|
|
95
|
+
| `--cv-space-2` | `8px` | Medium spacing scale fallback |
|
|
96
|
+
| `--cv-space-3` | `12px` | Medium-large spacing scale fallback |
|
|
97
|
+
|
|
98
|
+
## Visual States
|
|
99
|
+
|
|
100
|
+
| Host selector | Description |
|
|
101
|
+
| ---------------------------- | -------------------------------------------------------------------------------------- |
|
|
102
|
+
| `:host([variant="neutral"])` | Default muted background with border |
|
|
103
|
+
| `:host([variant="primary"])` | Primary-tinted background and border |
|
|
104
|
+
| `:host([variant="success"])` | Success-tinted background and border |
|
|
105
|
+
| `:host([variant="warning"])` | Warning-tinted background and border |
|
|
106
|
+
| `:host([variant="danger"])` | Danger-tinted background and border |
|
|
107
|
+
| `:host([dot])` | Dot mode: hides label/prefix/suffix, renders a colored circle of `--cv-badge-dot-size` |
|
|
108
|
+
| `:host([pulse])` | Applies a repeating scale/opacity animation to draw attention |
|
|
109
|
+
| `:host([pill])` | Fully rounded edges (`border-radius: 999px`) |
|
|
110
|
+
| `:host([size="small"])` | Small size overrides |
|
|
111
|
+
| `:host([size="large"])` | Large size overrides |
|
|
112
|
+
| `:host([dot][pulse])` | Dot with pulse animation combined |
|
|
113
|
+
| `:host([decorative])` | Decorative mode; no visual change, ARIA-hidden via headless |
|
|
114
|
+
|
|
115
|
+
## Reactive State Mapping
|
|
116
|
+
|
|
117
|
+
`cv-badge` is a visual adapter over headless `createBadge`.
|
|
118
|
+
|
|
119
|
+
| UIKit Property | Direction | Headless Binding |
|
|
120
|
+
| -------------- | -------------- | ----------------------------------------------- |
|
|
121
|
+
| `variant` | attr -> action | `actions.setVariant(value)` |
|
|
122
|
+
| `size` | attr -> action | `actions.setSize(value)` |
|
|
123
|
+
| `dot` | attr -> action | `actions.setDot(value)` |
|
|
124
|
+
| `pulse` | attr -> action | `actions.setPulse(value)` |
|
|
125
|
+
| `pill` | attr -> action | `actions.setPill(value)` |
|
|
126
|
+
| `dynamic` | attr -> action | `actions.setDynamic(value)` |
|
|
127
|
+
| `decorative` | attr -> action | `actions.setDecorative(value)` |
|
|
128
|
+
| `aria-label` | attr -> option | passed as `ariaLabel` in `createBadge(options)` |
|
|
129
|
+
|
|
130
|
+
| Headless State | Direction | DOM Reflection |
|
|
131
|
+
| ----------------- | ------------- | ------------------------------------------------------------------------ |
|
|
132
|
+
| `state.variant()` | state -> attr | `[variant]` host attribute |
|
|
133
|
+
| `state.size()` | state -> attr | `[size]` host attribute |
|
|
134
|
+
| `state.dot()` | state -> attr | `[dot]` host attribute |
|
|
135
|
+
| `state.pulse()` | state -> attr | `[pulse]` host attribute |
|
|
136
|
+
| `state.pill()` | state -> attr | `[pill]` host attribute |
|
|
137
|
+
| `state.isEmpty()` | state -> DOM | Hides `[part="label"]`, `[part="prefix"]`, `[part="suffix"]` when `true` |
|
|
138
|
+
|
|
139
|
+
- `contracts.getBadgeProps()` is spread onto the inner `[part="base"]` element to apply `role`, `aria-live`, `aria-atomic`, `aria-hidden`, and `aria-label` as applicable.
|
|
140
|
+
- UIKit does not own ARIA logic; headless state is the source of truth for all accessibility attributes.
|
|
141
|
+
- Badge is non-interactive: no `tabindex`, no keyboard handlers, no focus management.
|
|
142
|
+
|
|
143
|
+
## Events
|
|
144
|
+
|
|
145
|
+
Badge is non-interactive. No `input`, `change`, or custom events are emitted.
|
|
146
|
+
|
|
147
|
+
## Usage
|
|
148
|
+
|
|
149
|
+
```html
|
|
150
|
+
<cv-badge>Default</cv-badge>
|
|
151
|
+
|
|
152
|
+
<cv-badge variant="primary">New</cv-badge>
|
|
153
|
+
|
|
154
|
+
<cv-badge variant="success">Active</cv-badge>
|
|
155
|
+
|
|
156
|
+
<cv-badge variant="warning">Pending</cv-badge>
|
|
157
|
+
|
|
158
|
+
<cv-badge variant="danger">Error</cv-badge>
|
|
159
|
+
|
|
160
|
+
<cv-badge variant="danger" dot></cv-badge>
|
|
161
|
+
|
|
162
|
+
<cv-badge variant="primary" dot pulse aria-label="New notifications"></cv-badge>
|
|
163
|
+
|
|
164
|
+
<cv-badge variant="primary" pill>Badge</cv-badge>
|
|
165
|
+
|
|
166
|
+
<cv-badge variant="success" size="small">3</cv-badge>
|
|
167
|
+
|
|
168
|
+
<cv-badge variant="danger" size="large">99+</cv-badge>
|
|
169
|
+
|
|
170
|
+
<cv-badge dynamic variant="primary">5</cv-badge>
|
|
171
|
+
|
|
172
|
+
<cv-badge decorative variant="neutral">Info</cv-badge>
|
|
173
|
+
|
|
174
|
+
<cv-badge variant="primary">
|
|
175
|
+
<icon-circle slot="prefix"></icon-circle>
|
|
176
|
+
Online
|
|
177
|
+
</cv-badge>
|
|
178
|
+
|
|
179
|
+
<cv-badge variant="danger">
|
|
180
|
+
Alerts
|
|
181
|
+
<icon-bell slot="suffix"></icon-bell>
|
|
182
|
+
</cv-badge>
|
|
183
|
+
```
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# cv-breadcrumb
|
|
2
|
+
|
|
3
|
+
Navigation landmark that displays a trail of links showing the user's current location within a hierarchical structure.
|
|
4
|
+
|
|
5
|
+
**Headless:** [`createBreadcrumb`](https://github.com/chromvoid/headless-ui/blob/main/specs/components/breadcrumb.md)
|
|
6
|
+
|
|
7
|
+
## Anatomy
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<cv-breadcrumb> (host)
|
|
11
|
+
└── <nav part="base" role="navigation" aria-label="Breadcrumb">
|
|
12
|
+
└── <ol part="list">
|
|
13
|
+
└── <slot> ← cv-breadcrumb-item elements
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Attributes
|
|
17
|
+
|
|
18
|
+
| Attribute | Type | Default | Description |
|
|
19
|
+
| ----------------- | ------ | -------------- | ---------------------------------------------------------------------------------------------------------- |
|
|
20
|
+
| `value` | String | `""` | Value of the current (active) breadcrumb item. Reflects and controls which item has `aria-current="page"`. |
|
|
21
|
+
| `aria-label` | String | `"Breadcrumb"` | Accessible label for the navigation landmark |
|
|
22
|
+
| `aria-labelledby` | String | `""` | ID of an element that labels the navigation landmark. When set, `aria-label` is omitted. |
|
|
23
|
+
|
|
24
|
+
## Slots
|
|
25
|
+
|
|
26
|
+
| Slot | Description |
|
|
27
|
+
| ----------- | ----------------------------- |
|
|
28
|
+
| `(default)` | `cv-breadcrumb-item` elements |
|
|
29
|
+
|
|
30
|
+
## CSS Parts
|
|
31
|
+
|
|
32
|
+
| Part | Element | Description |
|
|
33
|
+
| ------ | ------- | ------------------------------------------- |
|
|
34
|
+
| `base` | `<nav>` | Navigation landmark wrapper |
|
|
35
|
+
| `list` | `<ol>` | Ordered list container for breadcrumb items |
|
|
36
|
+
|
|
37
|
+
## CSS Custom Properties
|
|
38
|
+
|
|
39
|
+
| Property | Default | Description |
|
|
40
|
+
| --------------------- | ------------------------ | ---------------------------- |
|
|
41
|
+
| `--cv-breadcrumb-gap` | `var(--cv-space-2, 8px)` | Gap between breadcrumb items |
|
|
42
|
+
|
|
43
|
+
## Events
|
|
44
|
+
|
|
45
|
+
No component-specific events. Navigation uses standard link click behavior.
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<cv-breadcrumb>
|
|
51
|
+
<cv-breadcrumb-item value="home" href="/">Home</cv-breadcrumb-item>
|
|
52
|
+
<cv-breadcrumb-item value="docs" href="/docs">Docs</cv-breadcrumb-item>
|
|
53
|
+
<cv-breadcrumb-item value="api" href="/docs/api">API</cv-breadcrumb-item>
|
|
54
|
+
</cv-breadcrumb>
|
|
55
|
+
|
|
56
|
+
<!-- Controlled current item -->
|
|
57
|
+
<cv-breadcrumb value="docs">
|
|
58
|
+
<cv-breadcrumb-item value="home" href="/">Home</cv-breadcrumb-item>
|
|
59
|
+
<cv-breadcrumb-item value="docs" href="/docs">Docs</cv-breadcrumb-item>
|
|
60
|
+
<cv-breadcrumb-item value="api" href="/docs/api">API</cv-breadcrumb-item>
|
|
61
|
+
</cv-breadcrumb>
|
|
62
|
+
|
|
63
|
+
<!-- Custom aria-label -->
|
|
64
|
+
<cv-breadcrumb aria-label="You are here">
|
|
65
|
+
<cv-breadcrumb-item value="home" href="/">Home</cv-breadcrumb-item>
|
|
66
|
+
<cv-breadcrumb-item value="page" href="/page">Current Page</cv-breadcrumb-item>
|
|
67
|
+
</cv-breadcrumb>
|
|
68
|
+
|
|
69
|
+
<!-- With prefix icons -->
|
|
70
|
+
<cv-breadcrumb>
|
|
71
|
+
<cv-breadcrumb-item value="home" href="/">
|
|
72
|
+
<cv-icon name="home" slot="prefix"></cv-icon>
|
|
73
|
+
Home
|
|
74
|
+
</cv-breadcrumb-item>
|
|
75
|
+
<cv-breadcrumb-item value="settings" href="/settings">Settings</cv-breadcrumb-item>
|
|
76
|
+
</cv-breadcrumb>
|
|
77
|
+
|
|
78
|
+
<!-- Custom separator -->
|
|
79
|
+
<cv-breadcrumb>
|
|
80
|
+
<cv-breadcrumb-item value="home" href="/">
|
|
81
|
+
Home
|
|
82
|
+
<span slot="separator">→</span>
|
|
83
|
+
</cv-breadcrumb-item>
|
|
84
|
+
<cv-breadcrumb-item value="page" href="/page">Page</cv-breadcrumb-item>
|
|
85
|
+
</cv-breadcrumb>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Child Elements
|
|
89
|
+
|
|
90
|
+
### cv-breadcrumb-item
|
|
91
|
+
|
|
92
|
+
#### Anatomy
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
<cv-breadcrumb-item> (host)
|
|
96
|
+
├── <span part="prefix">
|
|
97
|
+
│ └── <slot name="prefix">
|
|
98
|
+
├── <a part="link" role="link" href="…" aria-current="page"?>
|
|
99
|
+
│ └── <slot> ← label text
|
|
100
|
+
├── <span part="suffix">
|
|
101
|
+
│ └── <slot name="suffix">
|
|
102
|
+
└── <span part="separator" aria-hidden="true">
|
|
103
|
+
└── <slot name="separator">/</slot>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### Attributes
|
|
107
|
+
|
|
108
|
+
| Attribute | Type | Default | Description |
|
|
109
|
+
| ---------------- | ------- | ------- | ------------------------------------------------------------------------------------------------------------- |
|
|
110
|
+
| `value` | String | `""` | Unique identifier for this item. Auto-generated as `item-{n}` if empty. |
|
|
111
|
+
| `href` | String | `""` | URL destination. Defaults to `#` if empty. |
|
|
112
|
+
| `current` | Boolean | `false` | Whether this item represents the current page. Managed by parent, reflects `aria-current="page"` on the link. |
|
|
113
|
+
| `show-separator` | Boolean | `true` | Whether the separator is visible. Managed by parent — hidden on the last item. |
|
|
114
|
+
|
|
115
|
+
**Internal property (not reflected):**
|
|
116
|
+
|
|
117
|
+
| Property | Type | Default | Description |
|
|
118
|
+
| -------- | ------ | ------- | ----------------------------------------------------------------- |
|
|
119
|
+
| `linkId` | String | `""` | DOM id for the link element, set by parent from headless contract |
|
|
120
|
+
|
|
121
|
+
#### Slots
|
|
122
|
+
|
|
123
|
+
| Slot | Description |
|
|
124
|
+
| ----------- | ------------------------------------- |
|
|
125
|
+
| `(default)` | Label text |
|
|
126
|
+
| `prefix` | Icon or element before the label |
|
|
127
|
+
| `suffix` | Icon or element after the label |
|
|
128
|
+
| `separator` | Separator between items. Default: `/` |
|
|
129
|
+
|
|
130
|
+
#### CSS Parts
|
|
131
|
+
|
|
132
|
+
| Part | Element | Description |
|
|
133
|
+
| ----------- | -------- | ---------------------------------------------- |
|
|
134
|
+
| `link` | `<a>` | The anchor element |
|
|
135
|
+
| `prefix` | `<span>` | Prefix container |
|
|
136
|
+
| `suffix` | `<span>` | Suffix container |
|
|
137
|
+
| `separator` | `<span>` | Separator container (has `aria-hidden="true"`) |
|
|
138
|
+
|
|
139
|
+
#### CSS Custom Properties
|
|
140
|
+
|
|
141
|
+
| Property | Default | Description |
|
|
142
|
+
| ------------------------------------------ | ------------------------ | ----------------------------------------------- |
|
|
143
|
+
| `--cv-breadcrumb-item-gap` | `var(--cv-space-2, 8px)` | Gap between prefix, link, suffix, and separator |
|
|
144
|
+
| `--cv-breadcrumb-item-separator-opacity` | `0.6` | Opacity of the separator |
|
|
145
|
+
| `--cv-breadcrumb-item-current-font-weight` | `600` | Font weight of the current item's link |
|
|
146
|
+
|
|
147
|
+
#### Visual States
|
|
148
|
+
|
|
149
|
+
| Host selector | Description |
|
|
150
|
+
| ------------------------------- | ----------------------------------------------------------------- |
|
|
151
|
+
| `:host([current])` | Current page — link has `font-weight: 600`, `aria-current="page"` |
|
|
152
|
+
| `:host(:not([show-separator]))` | Separator hidden (last item) |
|