@cocoar/vue-ui 3.2.0-beta.5 → 3.2.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -3
- package/skills/cocoar-vue-ui/SKILL.md +244 -0
- package/skills/cocoar-vue-ui/references/components/avatar.md +178 -0
- package/skills/cocoar-vue-ui/references/components/badge.md +290 -0
- package/skills/cocoar-vue-ui/references/components/breadcrumb.md +238 -0
- package/skills/cocoar-vue-ui/references/components/button.md +252 -0
- package/skills/cocoar-vue-ui/references/components/calendar/agenda-view.md +353 -0
- package/skills/cocoar-vue-ui/references/components/calendar/coar-calendar.md +1645 -0
- package/skills/cocoar-vue-ui/references/components/calendar/day-view.md +361 -0
- package/skills/cocoar-vue-ui/references/components/calendar/index.md +312 -0
- package/skills/cocoar-vue-ui/references/components/calendar/month-view.md +475 -0
- package/skills/cocoar-vue-ui/references/components/calendar/performance.md +186 -0
- package/skills/cocoar-vue-ui/references/components/calendar/timeline-view.md +301 -0
- package/skills/cocoar-vue-ui/references/components/calendar/week-view.md +382 -0
- package/skills/cocoar-vue-ui/references/components/calendar/work-week-view.md +145 -0
- package/skills/cocoar-vue-ui/references/components/calendar/year-view.md +63 -0
- package/skills/cocoar-vue-ui/references/components/card.md +151 -0
- package/skills/cocoar-vue-ui/references/components/checkbox-group.md +103 -0
- package/skills/cocoar-vue-ui/references/components/checkbox.md +279 -0
- package/skills/cocoar-vue-ui/references/components/code-block.md +241 -0
- package/skills/cocoar-vue-ui/references/components/context-menu.md +355 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/checkbox.md +213 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/date-columns.md +272 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/editing.md +236 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/multi-select.md +193 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/number.md +147 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/select.md +202 -0
- package/skills/cocoar-vue-ui/references/components/data-grid/text.md +127 -0
- package/skills/cocoar-vue-ui/references/components/data-grid.md +1225 -0
- package/skills/cocoar-vue-ui/references/components/data-list.md +2121 -0
- package/skills/cocoar-vue-ui/references/components/date-or-time-picker.md +200 -0
- package/skills/cocoar-vue-ui/references/components/date-picker.md +203 -0
- package/skills/cocoar-vue-ui/references/components/date-time-picker.md +154 -0
- package/skills/cocoar-vue-ui/references/components/date-views.md +212 -0
- package/skills/cocoar-vue-ui/references/components/dialog.md +148 -0
- package/skills/cocoar-vue-ui/references/components/divider.md +157 -0
- package/skills/cocoar-vue-ui/references/components/document-viewer/annotations.md +400 -0
- package/skills/cocoar-vue-ui/references/components/document-viewer/coar-document-viewer.md +327 -0
- package/skills/cocoar-vue-ui/references/components/document-viewer/index.md +234 -0
- package/skills/cocoar-vue-ui/references/components/document-viewer/toolbar.md +221 -0
- package/skills/cocoar-vue-ui/references/components/drag-drop.md +267 -0
- package/skills/cocoar-vue-ui/references/components/dual-listbox.md +449 -0
- package/skills/cocoar-vue-ui/references/components/file-explorer/asset-store.md +327 -0
- package/skills/cocoar-vue-ui/references/components/file-explorer/in-memory-store.md +176 -0
- package/skills/cocoar-vue-ui/references/components/file-explorer/index.md +311 -0
- package/skills/cocoar-vue-ui/references/components/file-explorer/use-file-explorer.md +300 -0
- package/skills/cocoar-vue-ui/references/components/form-field.md +1025 -0
- package/skills/cocoar-vue-ui/references/components/fragment-parser.md +298 -0
- package/skills/cocoar-vue-ui/references/components/link.md +235 -0
- package/skills/cocoar-vue-ui/references/components/listbox.md +575 -0
- package/skills/cocoar-vue-ui/references/components/map/editor.md +448 -0
- package/skills/cocoar-vue-ui/references/components/map/index.md +351 -0
- package/skills/cocoar-vue-ui/references/components/markdown-diagrams.md +210 -0
- package/skills/cocoar-vue-ui/references/components/markdown-editor.md +1478 -0
- package/skills/cocoar-vue-ui/references/components/markdown-embeds.md +387 -0
- package/skills/cocoar-vue-ui/references/components/markdown-form.md +447 -0
- package/skills/cocoar-vue-ui/references/components/markdown.md +276 -0
- package/skills/cocoar-vue-ui/references/components/menu.md +380 -0
- package/skills/cocoar-vue-ui/references/components/mermaid.md +172 -0
- package/skills/cocoar-vue-ui/references/components/navbar.md +147 -0
- package/skills/cocoar-vue-ui/references/components/note.md +96 -0
- package/skills/cocoar-vue-ui/references/components/notice.md +131 -0
- package/skills/cocoar-vue-ui/references/components/number-input.md +215 -0
- package/skills/cocoar-vue-ui/references/components/otp-input.md +324 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/authoring-contract.md +271 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/coar-page-builder.md +476 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/coar-page-renderer.md +677 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/custom-elements.md +441 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/idp-integration.md +122 -0
- package/skills/cocoar-vue-ui/references/components/page-builder/index.md +573 -0
- package/skills/cocoar-vue-ui/references/components/pagination.md +150 -0
- package/skills/cocoar-vue-ui/references/components/panel-layout.md +372 -0
- package/skills/cocoar-vue-ui/references/components/password-input.md +175 -0
- package/skills/cocoar-vue-ui/references/components/popconfirm.md +186 -0
- package/skills/cocoar-vue-ui/references/components/popover.md +173 -0
- package/skills/cocoar-vue-ui/references/components/progress-bar.md +178 -0
- package/skills/cocoar-vue-ui/references/components/radio-group.md +225 -0
- package/skills/cocoar-vue-ui/references/components/script-editor.md +1271 -0
- package/skills/cocoar-vue-ui/references/components/segmented-control.md +238 -0
- package/skills/cocoar-vue-ui/references/components/select.md +463 -0
- package/skills/cocoar-vue-ui/references/components/sidebar.md +421 -0
- package/skills/cocoar-vue-ui/references/components/spinner.md +132 -0
- package/skills/cocoar-vue-ui/references/components/switch.md +195 -0
- package/skills/cocoar-vue-ui/references/components/table.md +170 -0
- package/skills/cocoar-vue-ui/references/components/tabs.md +382 -0
- package/skills/cocoar-vue-ui/references/components/tag.md +178 -0
- package/skills/cocoar-vue-ui/references/components/text-input.md +256 -0
- package/skills/cocoar-vue-ui/references/components/toast.md +160 -0
- package/skills/cocoar-vue-ui/references/components/tooltip.md +121 -0
- package/skills/cocoar-vue-ui/references/components/transitions.md +193 -0
- package/skills/cocoar-vue-ui/references/components/tree.md +2388 -0
- package/skills/cocoar-vue-ui/references/components/virtual-list.md +212 -0
- package/skills/cocoar-vue-ui/references/components/wizard.md +251 -0
- package/skills/cocoar-vue-ui/references/components/zoned-date-time-picker.md +177 -0
- package/skills/cocoar-vue-ui/references/foundations/colors.md +708 -0
- package/skills/cocoar-vue-ui/references/foundations/design-principles.md +115 -0
- package/skills/cocoar-vue-ui/references/foundations/icons.md +381 -0
- package/skills/cocoar-vue-ui/references/foundations/localization/formatting.md +530 -0
- package/skills/cocoar-vue-ui/references/foundations/localization/setup.md +86 -0
- package/skills/cocoar-vue-ui/references/foundations/localization/timezones.md +182 -0
- package/skills/cocoar-vue-ui/references/foundations/localization/translations.md +305 -0
- package/skills/cocoar-vue-ui/references/foundations/motion.md +549 -0
- package/skills/cocoar-vue-ui/references/foundations/spacing.md +330 -0
- package/skills/cocoar-vue-ui/references/foundations/theming.md +140 -0
- package/skills/cocoar-vue-ui/references/foundations/typography.md +206 -0
- package/skills/cocoar-vue-ui/references/guide/error-handling.md +162 -0
- package/skills/cocoar-vue-ui/references/guide/getting-started.md +119 -0
- package/skills/cocoar-vue-ui/references/guide/migration-page-builder-3.md +207 -0
- package/skills/cocoar-vue-ui/references/guide/migration.md +140 -0
- package/skills/cocoar-vue-ui/references/guide/theming.md +98 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
<!-- Generated from apps/docs/components/badge.md by apps/docs/scripts/sync-skill.mjs. Do not edit; edit the docs page. -->
|
|
2
|
+
|
|
3
|
+
# Badge
|
|
4
|
+
|
|
5
|
+
Badges draw attention to counts, statuses, or short labels. Attach them to icons, avatars, or buttons to surface information that needs a quick glance -- like unread messages, plan tiers, or live/offline indicators.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { CoarBadge } from '@cocoar/vue-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Variants
|
|
12
|
+
|
|
13
|
+
Six semantic variants let you match the badge to its meaning -- use `success` for positive states, `error` for alerts, and so on.
|
|
14
|
+
|
|
15
|
+
**Demo — `badge/demos/BadgeVariants.vue`**
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<template>
|
|
19
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: center;">
|
|
20
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
21
|
+
<CoarBadge :content="42" variant="primary" />
|
|
22
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">PRIMARY</span>
|
|
23
|
+
</div>
|
|
24
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
25
|
+
<CoarBadge :content="42" variant="secondary" />
|
|
26
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">SECONDARY</span>
|
|
27
|
+
</div>
|
|
28
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
29
|
+
<CoarBadge :content="42" variant="success" />
|
|
30
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">SUCCESS</span>
|
|
31
|
+
</div>
|
|
32
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
33
|
+
<CoarBadge :content="42" variant="warning" />
|
|
34
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">WARNING</span>
|
|
35
|
+
</div>
|
|
36
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
37
|
+
<CoarBadge :content="42" variant="error" />
|
|
38
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">ERROR</span>
|
|
39
|
+
</div>
|
|
40
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
41
|
+
<CoarBadge :content="42" variant="info" />
|
|
42
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">INFO</span>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import { CoarBadge } from '@cocoar/vue-ui';
|
|
49
|
+
</script>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Sizes
|
|
53
|
+
|
|
54
|
+
Five sizes from tiny `xs` (great for inline status) to bold `xl` (ideal for dashboard counters).
|
|
55
|
+
|
|
56
|
+
**Demo — `badge/demos/BadgeSizes.vue`**
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<template>
|
|
60
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;">
|
|
61
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
62
|
+
<CoarBadge :content="7" size="xs" />
|
|
63
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">XS (12px)</span>
|
|
64
|
+
</div>
|
|
65
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
66
|
+
<CoarBadge :content="7" size="s" />
|
|
67
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">S (16px)</span>
|
|
68
|
+
</div>
|
|
69
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
70
|
+
<CoarBadge :content="7" size="m" />
|
|
71
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">M (20px)</span>
|
|
72
|
+
</div>
|
|
73
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
74
|
+
<CoarBadge :content="7" size="l" />
|
|
75
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">L (24px)</span>
|
|
76
|
+
</div>
|
|
77
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
78
|
+
<CoarBadge :content="7" size="xl" />
|
|
79
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">XL (32px)</span>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script setup lang="ts">
|
|
85
|
+
import { CoarBadge } from '@cocoar/vue-ui';
|
|
86
|
+
</script>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Text Content
|
|
90
|
+
|
|
91
|
+
Badges aren't limited to numbers. Use short text labels like "New", "Beta", or "Pro" to tag features and content.
|
|
92
|
+
|
|
93
|
+
**Demo — `badge/demos/BadgeText.vue`**
|
|
94
|
+
|
|
95
|
+
```vue
|
|
96
|
+
<template>
|
|
97
|
+
<div style="display: flex; flex-wrap: wrap; gap: 12px; align-items: center;">
|
|
98
|
+
<CoarBadge content="New" variant="info" size="l" />
|
|
99
|
+
<CoarBadge content="Beta" variant="warning" size="l" />
|
|
100
|
+
<CoarBadge content="Pro" variant="success" size="l" />
|
|
101
|
+
<CoarBadge content="Hot" variant="error" size="l" />
|
|
102
|
+
<CoarBadge content="v2" variant="secondary" size="l" />
|
|
103
|
+
</div>
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<script setup lang="ts">
|
|
107
|
+
import { CoarBadge } from '@cocoar/vue-ui';
|
|
108
|
+
</script>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Max Value
|
|
112
|
+
|
|
113
|
+
Set a `max` to cap large numbers gracefully. Perfect for notification counts where "99+" is more useful than "1,247".
|
|
114
|
+
|
|
115
|
+
**Demo — `badge/demos/BadgeMax.vue`**
|
|
116
|
+
|
|
117
|
+
```vue
|
|
118
|
+
<template>
|
|
119
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: center;">
|
|
120
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
121
|
+
<CoarBadge :content="5" :max="99" />
|
|
122
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">5 (max 99)</span>
|
|
123
|
+
</div>
|
|
124
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
125
|
+
<CoarBadge :content="99" :max="99" />
|
|
126
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">99 (max 99)</span>
|
|
127
|
+
</div>
|
|
128
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
129
|
+
<CoarBadge :content="100" :max="99" />
|
|
130
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">100 → "99+"</span>
|
|
131
|
+
</div>
|
|
132
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
133
|
+
<CoarBadge :content="999" :max="99" />
|
|
134
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">999 → "99+"</span>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</template>
|
|
138
|
+
|
|
139
|
+
<script setup lang="ts">
|
|
140
|
+
import { CoarBadge } from '@cocoar/vue-ui';
|
|
141
|
+
</script>
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Dot Mode
|
|
145
|
+
|
|
146
|
+
When you only need to signal presence or status without a specific value, `dot` mode provides a minimal, color-coded indicator.
|
|
147
|
+
|
|
148
|
+
**Demo — `badge/demos/BadgeDot.vue`**
|
|
149
|
+
|
|
150
|
+
```vue
|
|
151
|
+
<template>
|
|
152
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: center;">
|
|
153
|
+
<div style="display: flex; align-items: center; gap: 6px;">
|
|
154
|
+
<CoarBadge variant="success" dot />
|
|
155
|
+
<span style="font-size: 13px; color: #64748b;">Online</span>
|
|
156
|
+
</div>
|
|
157
|
+
<div style="display: flex; align-items: center; gap: 6px;">
|
|
158
|
+
<CoarBadge variant="error" dot />
|
|
159
|
+
<span style="font-size: 13px; color: #64748b;">Offline</span>
|
|
160
|
+
</div>
|
|
161
|
+
<div style="display: flex; align-items: center; gap: 6px;">
|
|
162
|
+
<CoarBadge variant="warning" dot />
|
|
163
|
+
<span style="font-size: 13px; color: #64748b;">Away</span>
|
|
164
|
+
</div>
|
|
165
|
+
<div style="display: flex; align-items: center; gap: 6px;">
|
|
166
|
+
<CoarBadge variant="secondary" dot />
|
|
167
|
+
<span style="font-size: 13px; color: #64748b;">Unknown</span>
|
|
168
|
+
</div>
|
|
169
|
+
</div>
|
|
170
|
+
</template>
|
|
171
|
+
|
|
172
|
+
<script setup lang="ts">
|
|
173
|
+
import { CoarBadge } from '@cocoar/vue-ui';
|
|
174
|
+
</script>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Pulse Animation
|
|
178
|
+
|
|
179
|
+
Add a pulse animation to catch the user's eye for time-sensitive updates like new notifications or live events.
|
|
180
|
+
|
|
181
|
+
**Demo — `badge/demos/BadgePulse.vue`**
|
|
182
|
+
|
|
183
|
+
```vue
|
|
184
|
+
<template>
|
|
185
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: center;">
|
|
186
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
187
|
+
<CoarBadge :content="3" variant="error" pulse />
|
|
188
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">PULSING BADGE</span>
|
|
189
|
+
</div>
|
|
190
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
191
|
+
<CoarBadge variant="error" dot pulse />
|
|
192
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">PULSING DOT</span>
|
|
193
|
+
</div>
|
|
194
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
195
|
+
<CoarBadge content="Live" variant="error" pulse size="l" />
|
|
196
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">LIVE INDICATOR</span>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
</template>
|
|
200
|
+
|
|
201
|
+
<script setup lang="ts">
|
|
202
|
+
import { CoarBadge } from '@cocoar/vue-ui';
|
|
203
|
+
</script>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Bordered
|
|
207
|
+
|
|
208
|
+
The `bordered` prop adds a ring that prevents the badge from visually merging into its parent. Especially useful when badges sit on top of avatars or colored backgrounds.
|
|
209
|
+
|
|
210
|
+
**Demo — `badge/demos/BadgeBordered.vue`**
|
|
211
|
+
|
|
212
|
+
```vue
|
|
213
|
+
<template>
|
|
214
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: center;">
|
|
215
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
216
|
+
<CoarBadge :content="5" bordered />
|
|
217
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">WITH BORDER</span>
|
|
218
|
+
</div>
|
|
219
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
220
|
+
<CoarBadge :content="5" />
|
|
221
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace;">WITHOUT BORDER</span>
|
|
222
|
+
</div>
|
|
223
|
+
<div style="position: relative; display: inline-flex; align-items: flex-end; gap: 6px;">
|
|
224
|
+
<CoarAvatar name="JD" size="l" />
|
|
225
|
+
<CoarBadge :content="3" variant="error" bordered style="position: absolute; top: -4px; right: -4px;" />
|
|
226
|
+
<span style="font-size: 10px; color: #64748b; font-family: monospace; align-self: center; margin-left: 6px;">ON AVATAR</span>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
</template>
|
|
230
|
+
|
|
231
|
+
<script setup lang="ts">
|
|
232
|
+
import { CoarBadge, CoarAvatar } from '@cocoar/vue-ui';
|
|
233
|
+
</script>
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Interactive Demo
|
|
237
|
+
|
|
238
|
+
See badges in action -- increment and reset a notification counter to observe live updates and max-capping behavior.
|
|
239
|
+
|
|
240
|
+
**Demo — `badge/demos/BadgeInteractive.vue`**
|
|
241
|
+
|
|
242
|
+
```vue
|
|
243
|
+
<template>
|
|
244
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
245
|
+
<div style="position: relative; display: inline-flex; width: 40px;">
|
|
246
|
+
<span style="font-size: 24px;">🔔</span>
|
|
247
|
+
<CoarBadge :content="notifCount" :max="99" variant="error" :pulse="pulsing" style="position: absolute; top: -4px; right: -4px;" />
|
|
248
|
+
</div>
|
|
249
|
+
<div style="display: flex; flex-wrap: wrap; gap: 8px; align-items: center;">
|
|
250
|
+
<CoarButton variant="primary" size="s" @click="notifCount++">Add Notification</CoarButton>
|
|
251
|
+
<CoarButton variant="secondary" size="s" @click="notifCount = 0">Clear All</CoarButton>
|
|
252
|
+
</div>
|
|
253
|
+
<label style="display: flex; align-items: center; gap: 6px; font-size: 13px; color: #64748b; cursor: pointer;">
|
|
254
|
+
<input type="checkbox" v-model="pulsing" />
|
|
255
|
+
Pulse Animation
|
|
256
|
+
</label>
|
|
257
|
+
<p style="margin: 0; font-size: 13px; color: #64748b;">Current count: {{ notifCount }}</p>
|
|
258
|
+
</div>
|
|
259
|
+
</template>
|
|
260
|
+
|
|
261
|
+
<script setup lang="ts">
|
|
262
|
+
import { ref } from 'vue';
|
|
263
|
+
import { CoarBadge, CoarButton } from '@cocoar/vue-ui';
|
|
264
|
+
|
|
265
|
+
const notifCount = ref(5);
|
|
266
|
+
const pulsing = ref(true);
|
|
267
|
+
</script>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## API
|
|
271
|
+
|
|
272
|
+
### Props
|
|
273
|
+
|
|
274
|
+
| Prop | Type | Default | Description |
|
|
275
|
+
|------|------|---------|-------------|
|
|
276
|
+
| `content` | `string \| number` | `''` | Badge content (text or number) |
|
|
277
|
+
| `variant` | `'primary' \| 'secondary' \| 'success' \| 'warning' \| 'error' \| 'info'` | `'primary'` | Badge color variant |
|
|
278
|
+
| `size` | `'xs' \| 's' \| 'm' \| 'l' \| 'xl'` | `'m'` | Badge size |
|
|
279
|
+
| `dot` | `boolean` | `false` | Show as a small dot with no content |
|
|
280
|
+
| `max` | `number` | `null` | Cap numeric content (e.g. 100 becomes "99+") |
|
|
281
|
+
| `pulse` | `boolean` | `false` | Add pulse animation |
|
|
282
|
+
| `bordered` | `boolean` | `false` | Add white border ring |
|
|
283
|
+
|
|
284
|
+
## i18n Keys
|
|
285
|
+
|
|
286
|
+
These keys can be translated via [`@cocoar/vue-localization`](../foundations/localization/translations.md).
|
|
287
|
+
|
|
288
|
+
| Key | Default (English) | Used as |
|
|
289
|
+
|-----|-------------------|---------|
|
|
290
|
+
| `coar.ui.badge.notificationIndicator` | `'Notification indicator'` | `aria-label` for dot badges (when no `content` value is set) |
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
<!-- Generated from apps/docs/components/breadcrumb.md by apps/docs/scripts/sync-skill.mjs. Do not edit; edit the docs page. -->
|
|
2
|
+
|
|
3
|
+
# Breadcrumb
|
|
4
|
+
|
|
5
|
+
Show users exactly where they are within a page hierarchy and give them a quick path back to any parent level. Breadcrumbs are especially valuable in applications with deep navigation structures, where the sidebar alone does not make the current location obvious.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { CoarBreadcrumb, CoarBreadcrumbItem } from '@cocoar/vue-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
Pass `to` to render each crumb as a link. The library handles the `<a>` element for you — no need to wrap content in a manual anchor. Mark the last item `active` to indicate the current page; it renders as a non-interactive `<span aria-current="page">` (current page is not a link to itself, per WAI-ARIA convention).
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<CoarBreadcrumb>
|
|
17
|
+
<CoarBreadcrumbItem to="/projects" icon="folder">Projects</CoarBreadcrumbItem>
|
|
18
|
+
<CoarBreadcrumbItem to="/projects/alpha">Alpha</CoarBreadcrumbItem>
|
|
19
|
+
<CoarBreadcrumbItem to="/projects/alpha/issues">Issues</CoarBreadcrumbItem>
|
|
20
|
+
<CoarBreadcrumbItem active>#142 Fix date picker</CoarBreadcrumbItem>
|
|
21
|
+
</CoarBreadcrumb>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Demo — `breadcrumb/demos/BreadcrumbBasic.vue`**
|
|
25
|
+
|
|
26
|
+
```vue
|
|
27
|
+
<template>
|
|
28
|
+
<CoarBreadcrumb>
|
|
29
|
+
<CoarBreadcrumbItem to="/admin" icon="home">Home</CoarBreadcrumbItem>
|
|
30
|
+
<CoarBreadcrumbItem to="/admin/users" icon="users">Users</CoarBreadcrumbItem>
|
|
31
|
+
<CoarBreadcrumbItem active>John Doe</CoarBreadcrumbItem>
|
|
32
|
+
</CoarBreadcrumb>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script setup lang="ts">
|
|
36
|
+
import { CoarBreadcrumb, CoarBreadcrumbItem } from '@cocoar/vue-ui';
|
|
37
|
+
</script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Deep Hierarchy
|
|
41
|
+
|
|
42
|
+
Breadcrumbs scale naturally for deeply nested content. Even a five-level trail remains compact and readable, giving users confidence about their location.
|
|
43
|
+
|
|
44
|
+
**Demo — `breadcrumb/demos/BreadcrumbDeep.vue`**
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<template>
|
|
48
|
+
<CoarBreadcrumb>
|
|
49
|
+
<CoarBreadcrumbItem to="/shop" icon="home">Home</CoarBreadcrumbItem>
|
|
50
|
+
<CoarBreadcrumbItem to="/shop/products" icon="folder">Products</CoarBreadcrumbItem>
|
|
51
|
+
<CoarBreadcrumbItem to="/shop/products/electronics" icon="layout-grid">Electronics</CoarBreadcrumbItem>
|
|
52
|
+
<CoarBreadcrumbItem to="/shop/products/electronics/laptops" icon="file-text">Laptops</CoarBreadcrumbItem>
|
|
53
|
+
<CoarBreadcrumbItem active>MacBook Pro 16"</CoarBreadcrumbItem>
|
|
54
|
+
</CoarBreadcrumb>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
import { CoarBreadcrumb, CoarBreadcrumbItem } from '@cocoar/vue-ui';
|
|
59
|
+
</script>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## App Navigation
|
|
63
|
+
|
|
64
|
+
Here are several breadcrumb paths you might encounter in a real application -- from a simple two-level dashboard path to a four-level project issue drill-down.
|
|
65
|
+
|
|
66
|
+
**Demo — `breadcrumb/demos/BreadcrumbApp.vue`**
|
|
67
|
+
|
|
68
|
+
```vue
|
|
69
|
+
<template>
|
|
70
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
71
|
+
<!-- Simple 2-level dashboard path -->
|
|
72
|
+
<CoarBreadcrumb>
|
|
73
|
+
<CoarBreadcrumbItem to="/dashboard" icon="layout-grid">Dashboard</CoarBreadcrumbItem>
|
|
74
|
+
<CoarBreadcrumbItem active>Overview</CoarBreadcrumbItem>
|
|
75
|
+
</CoarBreadcrumb>
|
|
76
|
+
|
|
77
|
+
<!-- Settings drilldown -->
|
|
78
|
+
<CoarBreadcrumb>
|
|
79
|
+
<CoarBreadcrumbItem to="/settings" icon="settings">Settings</CoarBreadcrumbItem>
|
|
80
|
+
<CoarBreadcrumbItem to="/settings/account" icon="user">Account</CoarBreadcrumbItem>
|
|
81
|
+
<CoarBreadcrumbItem active>Security</CoarBreadcrumbItem>
|
|
82
|
+
</CoarBreadcrumb>
|
|
83
|
+
|
|
84
|
+
<!-- Project / issue drill-down -->
|
|
85
|
+
<CoarBreadcrumb>
|
|
86
|
+
<CoarBreadcrumbItem to="/projects" icon="folder">Projects</CoarBreadcrumbItem>
|
|
87
|
+
<CoarBreadcrumbItem to="/projects/alpha">Alpha</CoarBreadcrumbItem>
|
|
88
|
+
<CoarBreadcrumbItem to="/projects/alpha/issues" icon="bookmark">Issues</CoarBreadcrumbItem>
|
|
89
|
+
<CoarBreadcrumbItem active>#142 Fix date picker</CoarBreadcrumbItem>
|
|
90
|
+
</CoarBreadcrumb>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<script setup lang="ts">
|
|
95
|
+
import { CoarBreadcrumb, CoarBreadcrumbItem } from '@cocoar/vue-ui';
|
|
96
|
+
</script>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Three render modes
|
|
100
|
+
|
|
101
|
+
`CoarBreadcrumbItem` picks its render strategy automatically from the props:
|
|
102
|
+
|
|
103
|
+
| Mode | Trigger | Renders as |
|
|
104
|
+
|------|---------|------------|
|
|
105
|
+
| **Active** | `:active="true"` | `<span aria-current="page">` — non-interactive, current page |
|
|
106
|
+
| **Router-aware link** | `:to="..."` and `vue-router` installed | `<a href>` via `<RouterLink>` (SPA navigation, middle-click new-tab, etc.) |
|
|
107
|
+
| **Plain link** | `:to="..."` without router, or `:href="..."` | `<a href>` with browser-native navigation |
|
|
108
|
+
| **Bare slot (escape hatch)** | none of the above | Whatever the slot contains (custom dropdown, button, plain text…) |
|
|
109
|
+
|
|
110
|
+
**Active wins over `to`**: you can pass `to` on every crumb (including the last) without filtering — the `active` flag is the single source of truth for "this is the current page". Useful when generating the trail programmatically from `router.matched`.
|
|
111
|
+
|
|
112
|
+
```vue
|
|
113
|
+
<!-- All four crumbs in one loop, no special-case for the last item -->
|
|
114
|
+
<CoarBreadcrumb>
|
|
115
|
+
<CoarBreadcrumbItem
|
|
116
|
+
v-for="(crumb, i) in trail"
|
|
117
|
+
:key="crumb.path"
|
|
118
|
+
:to="crumb.path"
|
|
119
|
+
:icon="crumb.icon"
|
|
120
|
+
:active="i === trail.length - 1"
|
|
121
|
+
>
|
|
122
|
+
{{ crumb.label }}
|
|
123
|
+
</CoarBreadcrumbItem>
|
|
124
|
+
</CoarBreadcrumb>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Icons
|
|
128
|
+
|
|
129
|
+
Pass `icon` for a Lucide-style leading icon, or use the `#icon` slot for custom content (avatar, badge, coloured icon).
|
|
130
|
+
|
|
131
|
+
```vue
|
|
132
|
+
<CoarBreadcrumb>
|
|
133
|
+
<!-- Named icon via prop -->
|
|
134
|
+
<CoarBreadcrumbItem to="/" icon="home">Home</CoarBreadcrumbItem>
|
|
135
|
+
|
|
136
|
+
<!-- Custom icon via #icon slot — overrides icon prop -->
|
|
137
|
+
<CoarBreadcrumbItem to="/teams/alpha">
|
|
138
|
+
<template #icon>
|
|
139
|
+
<CoarAvatar :src="team.avatarUrl" size="xs" />
|
|
140
|
+
</template>
|
|
141
|
+
{{ team.name }}
|
|
142
|
+
</CoarBreadcrumbItem>
|
|
143
|
+
|
|
144
|
+
<CoarBreadcrumbItem active>Settings</CoarBreadcrumbItem>
|
|
145
|
+
</CoarBreadcrumb>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The icon renders inside the `<a>` / `<span>` so it shares the link's hit-area and styling (hover, focus, disabled states all apply uniformly).
|
|
149
|
+
|
|
150
|
+
## Custom content (dropdown, picker, etc.)
|
|
151
|
+
|
|
152
|
+
When `to` / `href` / `active` are all omitted, the item falls back to rendering the bare slot. Use this for inline UI like a project-switcher dropdown embedded in the trail:
|
|
153
|
+
|
|
154
|
+
```vue
|
|
155
|
+
<CoarBreadcrumb>
|
|
156
|
+
<CoarBreadcrumbItem to="/projects">Projects</CoarBreadcrumbItem>
|
|
157
|
+
|
|
158
|
+
<!-- Bare-slot mode: library renders just the <li>, you control the rest -->
|
|
159
|
+
<CoarBreadcrumbItem>
|
|
160
|
+
<CoarSelect
|
|
161
|
+
v-model="currentProject"
|
|
162
|
+
:options="availableProjects"
|
|
163
|
+
size="s"
|
|
164
|
+
variant="ghost"
|
|
165
|
+
/>
|
|
166
|
+
</CoarBreadcrumbItem>
|
|
167
|
+
|
|
168
|
+
<CoarBreadcrumbItem active>Settings</CoarBreadcrumbItem>
|
|
169
|
+
</CoarBreadcrumb>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
This also covers the legacy CSS-only pattern (`<CoarBreadcrumbItem><a href="/x">Foo</a></CoarBreadcrumbItem>`) — consumer-slotted anchors keep working without changes.
|
|
173
|
+
|
|
174
|
+
## Router Integration
|
|
175
|
+
|
|
176
|
+
When `to` is set and `vue-router` is registered (`app.use(router)`), the item renders via `<RouterLink>` in custom-slot mode for SPA navigation. Without a router, it falls back to a plain `<a href={String(to)}>`. The detection uses `resolveDynamicComponent('RouterLink')` — no hard dependency on `vue-router`.
|
|
177
|
+
|
|
178
|
+
> **Info**
|
|
179
|
+
>
|
|
180
|
+
> `vue-router` is declared as an **optional `peerDependenciesMeta`** entry. Install it for SPA routing, omit it for static / `href`-only / bare-slot use.
|
|
181
|
+
|
|
182
|
+
> **Warning: Object `to` without router**
|
|
183
|
+
>
|
|
184
|
+
> Passing an object literal (`:to="{ name: 'projects' }"`) when no router is installed falls back to `String(to)`, producing `href="[object Object]"` — a broken link. The component logs a DEV-only `console.warn` once per component instance. Pass a string path for the no-router case.
|
|
185
|
+
|
|
186
|
+
## Sizes
|
|
187
|
+
|
|
188
|
+
Two sizes:
|
|
189
|
+
|
|
190
|
+
- **`m`** (default, 14 px) — primary navigation. Sits at the top of a page above the page title.
|
|
191
|
+
- **`s`** (13 px) — secondary chrome. File-explorer paths, settings trails, address-bar style indicators sitting above other content.
|
|
192
|
+
|
|
193
|
+
```vue
|
|
194
|
+
<CoarBreadcrumb separator="›" size="s" aria-label="File path">
|
|
195
|
+
<CoarBreadcrumbItem>src</CoarBreadcrumbItem>
|
|
196
|
+
<CoarBreadcrumbItem>components</CoarBreadcrumbItem>
|
|
197
|
+
<CoarBreadcrumbItem active>Button.tsx</CoarBreadcrumbItem>
|
|
198
|
+
</CoarBreadcrumb>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Pass items without `to` / `href` to render as plain text (the slot-only escape hatch) — useful for path indicators where the segments aren't independently navigable.
|
|
202
|
+
|
|
203
|
+
## Accessibility
|
|
204
|
+
|
|
205
|
+
### Keyboard Navigation
|
|
206
|
+
|
|
207
|
+
| Key | Action |
|
|
208
|
+
|-----|--------|
|
|
209
|
+
| `Tab` | Move between breadcrumb links |
|
|
210
|
+
| `Enter` | Activate the focused link |
|
|
211
|
+
| `Shift + Tab` | Move focus backward |
|
|
212
|
+
|
|
213
|
+
## API
|
|
214
|
+
|
|
215
|
+
### CoarBreadcrumb Props
|
|
216
|
+
|
|
217
|
+
| Prop | Type | Default | Description |
|
|
218
|
+
|------|------|---------|-------------|
|
|
219
|
+
| `separator` | `string` | `'/'` | Separator character between items |
|
|
220
|
+
| `ariaLabel` | `string` | `'Breadcrumb'` | Accessible label for the nav landmark |
|
|
221
|
+
| `size` | `'m' \| 's'` | `'m'` | Visual density. `'s'` (13 px) for secondary chrome — file-explorer paths, settings trails, etc. Drives only the font-size token; spacing + colors stay identical to `'m'` so both sizes look consistent in the same UI. |
|
|
222
|
+
|
|
223
|
+
### CoarBreadcrumbItem Props
|
|
224
|
+
|
|
225
|
+
| Prop | Type | Default | Description |
|
|
226
|
+
|------|------|---------|-------------|
|
|
227
|
+
| `to` | `RouteLocationRaw \| string` | `undefined` | Vue Router target. Library renders an `<a>` (via `<RouterLink>` if available, plain `<a>` otherwise). Ignored when `active` is true. |
|
|
228
|
+
| `href` | `string` | `undefined` | External URL. Used when `to` is not set. |
|
|
229
|
+
| `icon` | `string` | `undefined` | Leading icon name. Rendered inside the link / active span. |
|
|
230
|
+
| `active` | `boolean` | `false` | Mark as the current/active page — renders as `<span aria-current="page">`, NOT a link to itself. Takes precedence over `to` / `href`. |
|
|
231
|
+
| `disabled` | `boolean` | `false` | Disabled link (only meaningful in link modes): `aria-disabled`, `tabindex=-1`, navigation suppressed. |
|
|
232
|
+
|
|
233
|
+
### CoarBreadcrumbItem Slots
|
|
234
|
+
|
|
235
|
+
| Slot | Description |
|
|
236
|
+
|------|-------------|
|
|
237
|
+
| `default` | Item content — text for the common case, or any custom content (dropdown, button, etc.) in bare-slot mode |
|
|
238
|
+
| `icon` | Custom icon content. Overrides the `icon` prop when both are provided. Use for avatars, badges, coloured icons. |
|