@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocoar/vue-ui",
|
|
3
|
-
"version": "3.2.0-beta.
|
|
3
|
+
"version": "3.2.0-beta.6",
|
|
4
4
|
"description": "Cocoar Design System — a touch-first Vue 3 component library with 30+ accessible, themeable components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -40,16 +40,18 @@
|
|
|
40
40
|
},
|
|
41
41
|
"files": [
|
|
42
42
|
"dist",
|
|
43
|
-
"styles"
|
|
43
|
+
"styles",
|
|
44
|
+
"skills"
|
|
44
45
|
],
|
|
45
46
|
"scripts": {
|
|
46
47
|
"build": "vite build",
|
|
48
|
+
"prepack": "node scripts/copy-skill.mjs",
|
|
47
49
|
"test": "vitest run",
|
|
48
50
|
"lint": "eslint src/",
|
|
49
51
|
"typecheck": "vue-tsc --noEmit"
|
|
50
52
|
},
|
|
51
53
|
"dependencies": {
|
|
52
|
-
"@cocoar/vue-localization": "3.2.0-beta.
|
|
54
|
+
"@cocoar/vue-localization": "3.2.0-beta.6",
|
|
53
55
|
"@fontsource/cascadia-code": "^5.2.3",
|
|
54
56
|
"@fontsource/inter": "^5.2.8",
|
|
55
57
|
"@fontsource/poppins": "^5.2.7",
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cocoar-vue-ui
|
|
3
|
+
description: >
|
|
4
|
+
Cocoar Design System for Vue 3 (@cocoar/vue-ui and its companion packages). Use when working
|
|
5
|
+
with Coar* components (CoarButton, CoarSelect, CoarFormField, CoarDialog, CoarDataGrid,
|
|
6
|
+
CoarCalendar, CoarTree, CoarMarkdown, CoarPageBuilder …), --coar-* design tokens, theming and
|
|
7
|
+
dark mode, the overlay plugin, Temporal-based date pickers, @cocoar/vue-localization,
|
|
8
|
+
@cocoar/vue-data-grid, @cocoar/vue-calendar, @cocoar/vue-markdown (-editor, -form, -mermaid),
|
|
9
|
+
@cocoar/vue-page-builder, @cocoar/vue-document-viewer, @cocoar/vue-map,
|
|
10
|
+
@cocoar/vue-file-explorer-core or @cocoar/vue-script-editor.
|
|
11
|
+
metadata:
|
|
12
|
+
author: Bernhard Windisch
|
|
13
|
+
source: https://docs.cocoar.dev/cocoar-ui-vue/
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Cocoar UI Vue
|
|
17
|
+
|
|
18
|
+
A touch-first Vue 3 component library for the Cocoar Design System: 30+ accessible, themeable,
|
|
19
|
+
tree-shakeable components in `@cocoar/vue-ui`, plus companion packages for localization, data
|
|
20
|
+
grid, calendar, markdown, page builder, document viewer, map, file explorer and script editor.
|
|
21
|
+
This skill is the documentation, page by page, under `references/`, with every live demo inlined
|
|
22
|
+
as a `vue` code block. The index at the bottom says which page answers what.
|
|
23
|
+
|
|
24
|
+
## Packages
|
|
25
|
+
|
|
26
|
+
| Package | Purpose |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `@cocoar/vue-ui` | The component library: form controls, display, navigation, layout, overlays, transitions, virtual list, drag & drop; design tokens and styles |
|
|
29
|
+
| `@cocoar/vue-localization` | `createCoarLocalization()` plugin: locale-aware formatting (`useL10n`), translations (`useI18n`), timezone detection |
|
|
30
|
+
| `@cocoar/vue-data-grid` | `CoarDataGrid` — AG Grid wrapper with Cocoar theming, typed column definitions and Cocoar cell editors |
|
|
31
|
+
| `@cocoar/vue-calendar` | `CoarCalendar` + standalone Year/Month/Week/Day/Agenda/Timeline views; Temporal-only public surface |
|
|
32
|
+
| `@cocoar/vue-markdown` | `CoarMarkdown` viewer + the shared rendering registry (custom embeds, fence renderers) |
|
|
33
|
+
| `@cocoar/vue-markdown-editor` | `CoarMarkdownEditor` — Milkdown WYSIWYG editor sharing the viewer's component map |
|
|
34
|
+
| `@cocoar/vue-markdown-form` | `CoarMarkdownForm` — template-driven forms with fixed prose and registered field controls |
|
|
35
|
+
| `@cocoar/vue-mermaid`, `@cocoar/vue-markdown-mermaid` | `CoarMermaidDiagram` and the adapter that renders ```` ```mermaid ```` fences in the viewer |
|
|
36
|
+
| `@cocoar/vue-script-editor` | `CoarScriptEditor` — Monaco-based TS/JS/JSON editor with constrained and authoring modes |
|
|
37
|
+
| `@cocoar/vue-page-builder` | `CoarPageBuilder` (visual editor) + `CoarPageRenderer` (runtime) over an open element registry |
|
|
38
|
+
| `@cocoar/vue-document-viewer` | `CoarDocumentViewer` — PDF/image/gallery pages via a `PageProvider`, tools, annotations |
|
|
39
|
+
| `@cocoar/vue-map` | `CoarMap` + `CoarMapEditor` — Leaflet map fed with resolved data |
|
|
40
|
+
| `@cocoar/vue-file-explorer-core` | Headless `useFileExplorer({ store })` over an `AssetStore<T>`; compose with `CoarTree` + `CoarPanelLayout` |
|
|
41
|
+
| `@cocoar/vue-fragment-parser` | URL fragment parsing and modal routing composables |
|
|
42
|
+
|
|
43
|
+
Every companion package has `@cocoar/vue-ui` as a peer dependency and pins the same version.
|
|
44
|
+
|
|
45
|
+
## Things an assistant gets wrong without the docs
|
|
46
|
+
|
|
47
|
+
- **Two imports in `main.ts`, and one CSS class for dark mode.** `import '@cocoar/vue-ui/fonts'`
|
|
48
|
+
(optional, self-hosted Poppins + Inter) and `import '@cocoar/vue-ui/styles'` (tokens and
|
|
49
|
+
component styles). Dark mode is the `dark-mode` class on the root element — not a
|
|
50
|
+
`data-theme` attribute and not `prefers-color-scheme` alone. Companion packages ship their own
|
|
51
|
+
stylesheet under the same convention (`@cocoar/vue-calendar/styles`, `@cocoar/vue-markdown/styles`,
|
|
52
|
+
`@cocoar/vue-page-builder/styles`, `@cocoar/vue-document-viewer/styles`, `@cocoar/vue-map/styles` …).
|
|
53
|
+
- **Overlays need the plugin and the host.** `app.use(CoarOverlayPlugin)` once and
|
|
54
|
+
`<CoarOverlayHost />` in the root layout, or Dialog, Toast, Popover, Tooltip and Popconfirm render
|
|
55
|
+
nothing. `useDialog().confirm(...)` and Popconfirm return Promises that reject when the overlay
|
|
56
|
+
is torn down — always `.catch()`.
|
|
57
|
+
- **Boolean props default to `false`, without exception.** Features are opt-in: `clearable` on
|
|
58
|
+
every input, `closable` on `CoarTag`, `show-search` on `CoarDataGrid`. Do not assume a feature is
|
|
59
|
+
on because other libraries default it on.
|
|
60
|
+
- **Dates are `Temporal`, not `Date` or strings.** The date pickers use `Temporal.PlainDate`,
|
|
61
|
+
`Temporal.PlainDateTime` and `Temporal.ZonedDateTime` (via `@js-temporal/polyfill`, already a
|
|
62
|
+
dependency); `CoarCalendar` events carry `Temporal.PlainDate` (all-day) or
|
|
63
|
+
`Temporal.ZonedDateTime` (timed) and reject anything else. Convert the wire format at the boundary.
|
|
64
|
+
- **Theming is a handful of base colors, not a palette.** Set `--coar-accent`, `--coar-success`,
|
|
65
|
+
`--coar-error`, `--coar-warning`, `--coar-info` on `:root`; every shade scale for light and
|
|
66
|
+
dark mode is derived with oklch. Style with `--coar-*` tokens; do not hard-code hex values or
|
|
67
|
+
override generated shades.
|
|
68
|
+
- **Touch-first, tablet-first.** Interactive elements are at least 44 × 44 px and work with touch
|
|
69
|
+
and focus; hover is an enhancement only. No hover-only interactions, no phone-first layouts.
|
|
70
|
+
- **Props, not slots, where the docs say so.** `CoarCheckbox` takes its text via the `label` prop,
|
|
71
|
+
`CoarBadge` via `content`. `CoarTag` uses `closable` and `@closed`; `CoarPopconfirm` uses
|
|
72
|
+
`message` with `@confirmed` / `@cancelled`. `CoarFormField` wraps a control and supplies label,
|
|
73
|
+
hint, status and required to it.
|
|
74
|
+
- **Localization is a plugin, not a prop.** `app.use(createCoarLocalization({ ... }))` once; then
|
|
75
|
+
`useL10n()` / `useI18n()` in components. Formatting reacts to language changes automatically.
|
|
76
|
+
- **Companion packages are separate installs.** `@cocoar/vue-ui` does not pull in the data grid,
|
|
77
|
+
calendar, markdown or page builder; add the package you need, its styles, and (for the data grid)
|
|
78
|
+
AG Grid's own modules as the page describes.
|
|
79
|
+
|
|
80
|
+
<!-- Everything below is generated by apps/docs/scripts/sync-skill.mjs from the docs frontmatter. Edit the docs, not this file. -->
|
|
81
|
+
|
|
82
|
+
## Reference documentation
|
|
83
|
+
|
|
84
|
+
Each file under `references/` is one page of the documentation with its live demos inlined
|
|
85
|
+
as `vue` code blocks. Read the one whose description matches the task; they are independent
|
|
86
|
+
of each other.
|
|
87
|
+
|
|
88
|
+
### Guide
|
|
89
|
+
|
|
90
|
+
- [Getting Started](references/guide/getting-started.md) — Set up @cocoar/vue-ui in a Vue 3 project: install, import fonts and styles, use components, toggle dark mode, and register the overlay plugin.
|
|
91
|
+
- [Error Handling](references/guide/error-handling.md) — Error handling patterns in Cocoar UI: graceful fallbacks, overlay Promise rejections, error toasts, and handling failures in application code.
|
|
92
|
+
- [Theming](references/guide/theming.md) — Theme Cocoar with CSS custom properties: set five oklch base colors and all shade scales for light and dark mode recalculate automatically.
|
|
93
|
+
- [Migrating to 2.11](references/guide/migration.md) — Migration guide for Cocoar UI 2.11: date/time pickers move onto CoarFormField, the clear button becomes opt-in, and two CSS tokens are renamed.
|
|
94
|
+
- [Migrating Page Builder to 3.0](references/guide/migration-page-builder-3.md) — Migration guide for @cocoar/vue-page-builder 3.0: four PageConfig concepts removed, several names disambiguated, and documents migrated to schemaVersion 6.
|
|
95
|
+
|
|
96
|
+
### Foundations
|
|
97
|
+
|
|
98
|
+
- [Design Principles](references/foundations/design-principles.md) — The six Cocoar Design System principles — clarity, consistency, accessibility, touch-first, performance, developer experience — plus the design token architecture and do's and don'ts.
|
|
99
|
+
- [Colors](references/foundations/colors.md) — Cocoar's two-layer color system: primitive palettes and semantic tokens that adapt to light and dark mode, with naming convention and full token reference.
|
|
100
|
+
- [Typography](references/foundations/typography.md) — The Cocoar type scale: eleven utility classes from display to footnote using Inter and Poppins, with sizes, weights, and usage examples.
|
|
101
|
+
- [Spacing & Effects](references/foundations/spacing.md) — Spacing and effects tokens: the 4 px spacing scale, border radius, stroke widths, and six shadow elevation levels with reference tables.
|
|
102
|
+
- [Icons](references/foundations/icons.md) — CoarIcon and the built-in SVG icon set: preset sizes, colors, rotation, spin animation, and registering custom icon sources with fallback.
|
|
103
|
+
- [Motion](references/foundations/motion.md) — Motion design tokens: duration and easing CSS variables plus pre-composed transition values, with interactive demos and usage examples.
|
|
104
|
+
- [Theme Editor](references/foundations/theming.md) — CoarThemeEditor, a live token editor: explore primitive, semantic, and component token layers, apply presets, and export a CSS snippet.
|
|
105
|
+
|
|
106
|
+
### Localization (@cocoar/vue-localization)
|
|
107
|
+
|
|
108
|
+
- [Localization Setup](references/foundations/localization/setup.md) — Install and configure @cocoar/vue-localization: register the createCoarLocalization() plugin, set locale and translation URLs, and switch languages at runtime.
|
|
109
|
+
- [Formatting](references/foundations/localization/formatting.md) — Locale-aware number, currency, percent, and date formatting via the useL10n() composable from @cocoar/vue-localization, reacting to language changes.
|
|
110
|
+
- [Translations](references/foundations/localization/translations.md) — Translation lookup with the useI18n() composable: t() and tRef() with parameter interpolation, HTTP-loaded or code-registered translations, and fallbacks.
|
|
111
|
+
- [Timezones](references/foundations/localization/timezones.md) — The useTimezone() composable exposes the detected IANA timezone as a reactive ref, with support for custom timezone providers.
|
|
112
|
+
|
|
113
|
+
### Form controls
|
|
114
|
+
|
|
115
|
+
- [Button](references/components/button.md) — CoarButton — action button with five variants, four sizes, icons, loading and disabled states, full width and router-aware link rendering.
|
|
116
|
+
- [Form Field](references/components/form-field.md) — CoarFormField — label, hint and validation wrapper for form controls with a severity-aware status icon, pinnable popover and live-evaluated rules
|
|
117
|
+
- [Text Input](references/components/text-input.md) — CoarTextInput — text field with validation states, prefix/suffix decorations, clearable option, four sizes and multiline textarea mode
|
|
118
|
+
- [Number Input](references/components/number-input.md) — CoarNumberInput — numeric input with min/max clamping, configurable step, optional stepper buttons, four sizes and standard form states
|
|
119
|
+
- [Password Input](references/components/password-input.md) — CoarPasswordInput — masked text input with show/hide visibility toggle, clearable option, four sizes, validation states and CoarFormField integration
|
|
120
|
+
- [OTP Input (New in 2.0)](references/components/otp-input.md) — CoarOtpInput — N-cell one-time-code input with auto-advance, paste spreading, numeric/alphanumeric/text modes, masking, transform/accept hooks and a complete event
|
|
121
|
+
- [Select](references/components/select.md) — CoarSelect, CoarMultiSelect and CoarTagSelect — dropdown selection with inline search, clearable state, option groups, sorting and form-field integration
|
|
122
|
+
- [Listbox](references/components/listbox.md) — CoarListbox — single-column selectable list with grouping, search, multi-select highlighting, keyboard navigation, custom item renderers and display-only mode
|
|
123
|
+
- [Dual Listbox](references/components/dual-listbox.md) — CoarDualListbox — two-column transfer list with move buttons, per-column search, grouping, custom item renderers and drag & drop between columns
|
|
124
|
+
- [Checkbox](references/components/checkbox.md) — CoarCheckbox — boolean checkbox with v-model, indeterminate state, four sizes, label positioning, validation states and CoarFormField integration.
|
|
125
|
+
- [Checkbox Group](references/components/checkbox-group.md) — CoarCheckboxGroup — coordinate multiple checkboxes through one array or boolean-record model, with FormField integration.
|
|
126
|
+
- [Radio Group](references/components/radio-group.md) — CoarRadioGroup and CoarRadioButton — single-choice selection with horizontal or vertical layout, four sizes, label positioning, keyboard navigation and form-field integration
|
|
127
|
+
- [Switch](references/components/switch.md) — CoarSwitch — toggle for boolean settings that apply immediately, with four sizes, label positioning, validation states and keyboard and screen-reader support
|
|
128
|
+
- [Segmented Control](references/components/segmented-control.md) — CoarSegmentedControl — toolbar button-bar for switching between mutually-exclusive view options, with icons, four sizes, disabled segments and full-width mode
|
|
129
|
+
- [Date Picker](references/components/date-picker.md) — CoarPlainDatePicker — calendar date picker returning Temporal.PlainDate, with min/max limits, validation states, four sizes and form-field integration.
|
|
130
|
+
- [DateTime Picker](references/components/date-time-picker.md) — CoarPlainDateTimePicker — combined calendar and time input returning a timezone-less Temporal.PlainDateTime, with validation states, four sizes and localized labels.
|
|
131
|
+
- [Zoned DateTime Picker](references/components/zoned-date-time-picker.md) — CoarZonedDateTimePicker — timezone-aware datetime picker capturing date, time and IANA timezone as one Temporal.ZonedDateTime, with form states and four sizes
|
|
132
|
+
- [Date · optional time](references/components/date-or-time-picker.md) — CoarZonedDateTimeOrDatePicker and CoarPlainDateTimeOrDatePicker — date pickers with a clock toggle switching between plain date and date-with-time values.
|
|
133
|
+
- [Date Views (New in 2.0)](references/components/date-views.md) — CoarPlainDateView, CoarPlainDateTimeView and CoarZonedDateTimeView — read-only, locale-aware displays for Temporal date values with cross-zone projection.
|
|
134
|
+
|
|
135
|
+
### Display
|
|
136
|
+
|
|
137
|
+
- [Avatar](references/components/avatar.md) — CoarAvatar — user avatar with image and generated-initials fallback, six sizes, circle or square shape, clickable mode and group stacking.
|
|
138
|
+
- [Badge](references/components/badge.md) — CoarBadge — count and status badge with six semantic variants, five sizes, max-value capping, dot mode, pulse animation and border ring.
|
|
139
|
+
- [Card](references/components/card.md) — CoarCard — content container with elevated and outlined styles, semantic color variants, padding sizes and header, footer and inset slots.
|
|
140
|
+
- [Code Block](references/components/code-block.md) — CoarCodeBlock — syntax-highlighted code display with copy-to-clipboard button, collapsible behavior, line numbers, title label and color variants.
|
|
141
|
+
- [Data List](references/components/data-list.md) — CoarDataList — virtualized, searchable, sortable record list with a free multi-line item template, key-based selection, grouping and a headless useDataListModel composable
|
|
142
|
+
- [Divider](references/components/divider.md) — CoarDivider — horizontal separator with optional slotted label, left/center/right alignment, subtle or strong weight and spacing controls.
|
|
143
|
+
- [Link](references/components/link.md) — CoarLink — styled anchor for router and external navigation with accent/subtle variants, three sizes, safe new-tab defaults and disabled handling
|
|
144
|
+
- [Note](references/components/note.md) — CoarNote — callout for supplementary information with six semantic color variants, three padding sizes and rich HTML slot content
|
|
145
|
+
- [Notice](references/components/notice.md) — CoarNotice — compact inline notices and application banners with six semantic variants
|
|
146
|
+
- [Progress Bar](references/components/progress-bar.md) — CoarProgressBar — determinate and indeterminate progress indicator with semantic color variants, three sizes, optional value display and accessible labels
|
|
147
|
+
- [Spinner](references/components/spinner.md) — CoarSpinner — animated loading indicator for operations of unknown duration, with four sizes, accessible labels and full-page overlay patterns
|
|
148
|
+
- [Table](references/components/table.md) — CoarTable — lightweight styled table wrapper with striped, plain and bordered variants, compact padding, hover highlighting and rich cell content
|
|
149
|
+
- [Tag](references/components/tag.md) — CoarTag — label chip with six semantic color variants, three sizes, closable and selectable modes for metadata, categories and filter bars
|
|
150
|
+
|
|
151
|
+
### Navigation
|
|
152
|
+
|
|
153
|
+
- [Menu](references/components/menu.md) — CoarMenu — context menus and action lists with full keyboard support, icons, headings, dividers, nested and flyout submenus and router-aware link items
|
|
154
|
+
- [Context Menu](references/components/context-menu.md) — CoarContextMenu with useContextMenu — right-click menu at the pointer position with viewport clamping, submenus, flyouts and auto-close behavior.
|
|
155
|
+
- [Sidebar](references/components/sidebar.md) — CoarSidebar — navigation sidebar with header/content/footer sections, collapsible icon-only mode, expand and flyout groups, four-side orientation and router-aware items
|
|
156
|
+
- [Navbar](references/components/navbar.md) — CoarNavbar — top-level navigation bar with start, center and end content slots, elevated shadow by default or a flat bordered variant
|
|
157
|
+
- [Tabs](references/components/tabs.md) — CoarTabGroup and CoarTab — v-model tab navigation with disabled tabs, tab-bar actions slot, fill-height mode and full keyboard support
|
|
158
|
+
- [Tree](references/components/tree.md) — CoarTree — generic tree primitive with keyboard navigation, drag-and-drop reorder, single/multiple/checkbox selection, context menus, lazy loading and a fluent useTree builder
|
|
159
|
+
- [Breadcrumb](references/components/breadcrumb.md) — CoarBreadcrumb — hierarchical navigation trail with router-aware links, non-interactive active item, icons and automatic render-mode selection per crumb.
|
|
160
|
+
- [Pagination](references/components/pagination.md) — CoarPagination — page navigation computed from totalItems and pageSize with ellipsis truncation, first/last buttons and localized aria-labels
|
|
161
|
+
|
|
162
|
+
### Layout
|
|
163
|
+
|
|
164
|
+
- [Panel Layout (Preview)](references/components/panel-layout.md) — CoarSplitPane and CoarPanelLayout — resizable split panes and a VS-Code-style workbench shell with top/left/content/right/bottom/status regions
|
|
165
|
+
- [Wizard (Preview)](references/components/wizard.md) — CoarWizard — multi-step flow shell for modals with animated body resize, scrollable auto-centering step indicator, edge-placeable progress strip and step gating
|
|
166
|
+
|
|
167
|
+
### Overlay
|
|
168
|
+
|
|
169
|
+
- [Dialog](references/components/dialog.md) — useDialog — promise-based modal dialogs for confirm, alert and custom components, with configurable buttons, sizes and localized labels.
|
|
170
|
+
- [Popover](references/components/popover.md) — CoarPopover — anchored panel for rich interactive content with hover, click or combined trigger modes and automatic viewport-aware positioning
|
|
171
|
+
- [Popconfirm](references/components/popconfirm.md) — CoarPopconfirm — inline confirmation bubble anchored to a trigger element, with confirm/cancel actions, danger variant, custom labels and placement control
|
|
172
|
+
- [Toast](references/components/toast.md) — useToast and CoarToastContainer — non-blocking notification service with semantic variants, duration and position control, action buttons and progress indicator
|
|
173
|
+
- [Tooltip](references/components/tooltip.md) — v-tooltip directive — text-only hover and focus hints for any element, with placement options and accessible labels for icon buttons
|
|
174
|
+
|
|
175
|
+
### Utilities
|
|
176
|
+
|
|
177
|
+
- [Transitions](references/components/transitions.md) — CoarFade, CoarSlide, CoarScale, CoarCollapse — pre-built Vue transition wrappers on design-system motion tokens with duration presets and prefers-reduced-motion support
|
|
178
|
+
- [Virtual List](references/components/virtual-list.md) — useVirtualList — composable that virtualizes large scrollable lists, rendering only visible rows with overscan, variable item heights and scrollToIndex
|
|
179
|
+
- [Drag & Drop](references/components/drag-drop.md) — useDragDrop — HTML5 drag-and-drop composable with group, accept and canDrop matching rules for building custom drag surfaces like Kanban boards.
|
|
180
|
+
- [Fragment Parser & Modal Routing](references/components/fragment-parser.md) — @cocoar/vue-fragment-parser — parses URL hash fragments into typed routes with parameters; composables enable deep-linkable modals with browser-back to close
|
|
181
|
+
|
|
182
|
+
### Content (@cocoar/vue-markdown, -editor, -form, -mermaid, @cocoar/vue-script-editor)
|
|
183
|
+
|
|
184
|
+
- [Markdown](references/components/markdown.md) — @cocoar/vue-markdown — markdown rendering split into a framework-agnostic parser (markdown-core) and the CoarMarkdown Vue component with GFM support
|
|
185
|
+
- [Markdown Editor (Preview)](references/components/markdown-editor.md) — CoarMarkdownEditor — Milkdown-based WYSIWYG markdown editor with lossless round-trip, floating or fixed toolbar and a render registry shared with CoarMarkdown
|
|
186
|
+
- [Markdown Form](references/components/markdown-form.md) — CoarMarkdownForm renders a fixed Markdown template with registered fill controls, separate typed values, validation and readonly output.
|
|
187
|
+
- [Custom Embeds (Preview)](references/components/markdown-embeds.md) — Markdown custom embeds — register Vue components rendered from :::key{props} directives in both viewer and editor, with lossless round-trip to plain text
|
|
188
|
+
- [Diagrams (Preview)](references/components/markdown-diagrams.md) — @cocoar/vue-markdown-mermaid — renders mermaid code fences in CoarMarkdown as Cocoar-themed diagrams; lazy-loaded, strict security, degrades to plain code blocks
|
|
189
|
+
- [Mermaid Diagram (Preview)](references/components/mermaid.md) — CoarMermaidDiagram — standalone Mermaid diagram component for Vue 3 rendering from a source string; Cocoar-themed, lazily loaded, with opt-in zoom/pan
|
|
190
|
+
- [Script Editor](references/components/script-editor.md) — @cocoar/vue-script-editor — Monaco-based TypeScript/JavaScript/JSON editor with v-model, custom type definitions, constrained mode with protected lines and automatic theming
|
|
191
|
+
|
|
192
|
+
### Data Grid (@cocoar/vue-data-grid)
|
|
193
|
+
|
|
194
|
+
- [Data Grid](references/components/data-grid.md) — CoarDataGrid — AG Grid-based data grid with fluent builder API, locale-aware column types, wrapper-column decorations and Cocoar theming with dark mode.
|
|
195
|
+
- [Editing](references/components/data-grid/editing.md) — CoarDataGrid in-cell editing — editable() with per-row predicates, custom Vue editors via cellEditorConfig, and onCellValueChanged for committed edits.
|
|
196
|
+
- [Text Column](references/components/data-grid/text.md) — CoarDataGrid text column — col.text() edits cells with CoarTextInput via CoarTextCellEditor, with placeholder, maxLength, and per-row editable gating.
|
|
197
|
+
- [Number Column](references/components/data-grid/number.md) — CoarDataGrid number column — col.number() formats locale-aware and edits with CoarNumberCellEditor supporting min/max, decimals, step, and stepper buttons.
|
|
198
|
+
- [Select Column](references/components/data-grid/select.md) — CoarDataGrid select column — col.select() renders the matched option label and edits via CoarSelect with auto-commit on pick, clearable, searchable, and row-aware options.
|
|
199
|
+
- [Multi-Select & Tag-Select Columns (New in 2.0)](references/components/data-grid/multi-select.md) — CoarDataGrid multi-value columns — col.multiSelect() and col.tagSelect() edit array cells via CoarMultiSelect or CoarTagSelect, with chips display, search, and allowCreate.
|
|
200
|
+
- [Date Columns (New in 2.0)](references/components/data-grid/date-columns.md) — CoarDataGrid date columns — col.plainDate/plainDateTime/zonedDateTime render Temporal values locale-aware and edit via the matching Cocoar date-time picker.
|
|
201
|
+
- [Checkbox Column](references/components/data-grid/checkbox.md) — CoarDataGrid checkbox column — col.checkbox() renders a read-only CoarCheckbox per cell, with opt-in edit-mode toggling, per-row gating, and indeterminate tri-state.
|
|
202
|
+
|
|
203
|
+
### Page Builder (@cocoar/vue-page-builder)
|
|
204
|
+
|
|
205
|
+
- [Page Builder (Preview)](references/components/page-builder/index.md) — Overview of @cocoar/vue-page-builder, a headless visual page composition framework: consumer-defined element registry, portable JSON schemas, shared PageConfig for builder and renderer.
|
|
206
|
+
- [`<CoarPageBuilder>` (Preview)](references/components/page-builder/coar-page-builder.md) — CoarPageBuilder visual editor: outline and properties inspector, drag-and-drop canvas, searchable element library and reusable compositions, emitting a PageNode JSON schema via v-model.
|
|
207
|
+
- [`<CoarPageRenderer>` (Preview)](references/components/page-builder/coar-page-renderer.md) — CoarPageRenderer turns a PageNode schema into live Cocoar components at runtime, enforcing the allowedElements security boundary with actions, validation and initialValues.
|
|
208
|
+
- [Authoring contract](references/components/page-builder/authoring-contract.md) — Page Builder authoring contract — the inventory of every renderer capability, the authoring surface that writes it, and which gaps are named exceptions versus open.
|
|
209
|
+
- [Custom elements](references/components/page-builder/custom-elements.md) — Registering consumer element types via PageElementDefinition: props-bag wire format, runtime renderer with usePageElement, plus palette, preview and inspector integration.
|
|
210
|
+
- [IDP integration](references/components/page-builder/idp-integration.md) — Integrate Page Builder 2.20 into an identity provider with isolated SES Worker sessions, host-owned capabilities, versioned documents and server-authoritative publication.
|
|
211
|
+
|
|
212
|
+
### Document Viewer (@cocoar/vue-document-viewer)
|
|
213
|
+
|
|
214
|
+
- [Document Viewer (Preview)](references/components/document-viewer/index.md) — Source-agnostic document viewer for Vue 3 — CoarDocumentViewer renders PDFs, images, and image galleries with shared toolbar chrome, side panels, and an annotation layer.
|
|
215
|
+
- [CoarDocumentViewer](references/components/document-viewer/coar-document-viewer.md) — CoarDocumentViewer component reference — the source prop, toolbar and side-panel chrome toggles, annotation surface props, and v-model panel open state.
|
|
216
|
+
- [Toolbar customization](references/components/document-viewer/toolbar.md) — CoarDocumentViewer toolbar customization — the order-driven tools array of tool identifiers, separator trimming rules, and the full CoarDocumentViewerTool reference.
|
|
217
|
+
- [Annotations](references/components/document-viewer/annotations.md) — CoarDocumentViewer annotation layer — controlled marker, comment, ink, and freetext annotations; the consumer owns the data and applies create/update/delete events.
|
|
218
|
+
|
|
219
|
+
### Map (@cocoar/vue-map)
|
|
220
|
+
|
|
221
|
+
- [Map (Preview)](references/components/map/index.md) — CoarMap, a standalone data-driven Leaflet map for Vue 3 that renders pins, routes, popups and a legend from MapData plus MapConfig.
|
|
222
|
+
- [Map Editor (Preview)](references/components/map/editor.md) — CoarMapEditor, the write counterpart of CoarMap: place, move, edit, reorder and delete points visually, emitting fresh MapData via v-model.
|
|
223
|
+
|
|
224
|
+
### File Explorer (@cocoar/vue-file-explorer-core)
|
|
225
|
+
|
|
226
|
+
- [File Explorer (Preview)](references/components/file-explorer/index.md) — Headless VSCode-style file explorer engine for Vue 3 — useFileExplorer drives a pluggable AssetStore backend; you compose the layout from @cocoar/vue-ui primitives.
|
|
227
|
+
- [useFileExplorer](references/components/file-explorer/use-file-explorer.md) — useFileExplorer composable reference — options, reactive tree and tab state, imperative ops, and navigation returned by the file-explorer engine.
|
|
228
|
+
- [AssetStore<T> contract](references/components/file-explorer/asset-store.md) — AssetStore contract for the file-explorer engine — the backend-agnostic read/write interface (loadTree, uploadFile, rename, move) with optional lazy and browse-only modes.
|
|
229
|
+
- [In-memory store](references/components/file-explorer/in-memory-store.md) — createInMemoryAssetStore — the reference AssetStore implementation with reactive latency, failure, lazy, and conflict knobs for demos, tests, and prototyping.
|
|
230
|
+
|
|
231
|
+
### Calendar (@cocoar/vue-calendar)
|
|
232
|
+
|
|
233
|
+
- [Calendar (Preview)](references/components/calendar/index.md) — @cocoar/vue-calendar — Temporal-based Vue 3 calendar with Year, Month, Week, Day and Agenda views, iOS-style display variations, recurrence and standalone sub-views
|
|
234
|
+
- [`<CoarCalendar>` — Composer (Preview)](references/components/calendar/coar-calendar.md) — CoarCalendar — top-level calendar shell wiring the iOS-style Year, Month, Day and Agenda hierarchy plus Week and Work Week, driven by the chainable useCalendar builder
|
|
235
|
+
- [`<CoarYearView>` — Year View (Preview)](references/components/calendar/year-view.md) — CoarYearView — responsive twelve-month calendar overview with today marker and drill-in to the continuous Month view
|
|
236
|
+
- [Month Views (Preview)](references/components/calendar/month-view.md) — Month views — continuously scrolling Compact, Stacked and Details months, responsive Month List, and the lower-level CoarMonthView section
|
|
237
|
+
- [`<CoarDayView>` — Day View (Preview)](references/components/calendar/day-view.md) — CoarDayView — one-day or width-aware multi-day time grid with hour axis, all-day band, configurable columns, time range and slot duration
|
|
238
|
+
- [`<CoarWeekView>` — Week View (Preview)](references/components/calendar/week-view.md) — CoarWeekView — 7-day time-grid calendar view with hour axis, all-day band, locale-aware first day of week and a customizable day-header slot
|
|
239
|
+
- [`<CoarWorkWeekView>` — Work Week View (Preview)](references/components/calendar/work-week-view.md) — CoarWorkWeekView — week view filtered to a configurable working-day set (default Mon-Fri), supporting 6-day, 4-day and Sun-Thu weeks on the same time grid
|
|
240
|
+
- [`<CoarAgendaView>` — Agenda View (Preview)](references/components/calendar/agenda-view.md) — CoarAgendaView — virtualized chronological agenda list grouped by day, with floating day headers, multi-day event continuation and imperative scroll-to-date
|
|
241
|
+
- [`<CoarTimelineView>` — Timeline View (Preview)](references/components/calendar/timeline-view.md) — CoarTimelineView — Gantt-lite timeline with one row per event, horizontal time-axis bars, automatic recurring-series row collapsing and drag-to-pan window
|
|
242
|
+
- [Performance baseline (Preview)](references/components/calendar/performance.md) — Performance baseline for @cocoar/vue-calendar — Long Animation Frame measurements and targets for virtualization, 2D scrolling and drag-and-drop with auto-scroll
|
|
243
|
+
|
|
244
|
+
The same content is online at https://docs.cocoar.dev/cocoar-ui-vue/ (index for LLMs: https://docs.cocoar.dev/cocoar-ui-vue/llms.txt).
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
<!-- Generated from apps/docs/components/avatar.md by apps/docs/scripts/sync-skill.mjs. Do not edit; edit the docs page. -->
|
|
2
|
+
|
|
3
|
+
# Avatar
|
|
4
|
+
|
|
5
|
+
Use avatars to give users and entities a recognizable visual identity throughout your application. They display a profile image when available and gracefully fall back to generated initials, so every user always has a face -- even before they upload a photo.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { CoarAvatar } from '@cocoar/vue-ui';
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
Pass a `name` and the avatar automatically extracts and displays initials. Ideal for user lists, comment threads, and anywhere you need a quick visual identifier.
|
|
14
|
+
|
|
15
|
+
**Demo — `avatar/demos/AvatarBasic.vue`**
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<template>
|
|
19
|
+
<div style="display: flex; flex-wrap: wrap; gap: 12px; align-items: center;">
|
|
20
|
+
<CoarAvatar name="John Doe" />
|
|
21
|
+
<CoarAvatar name="Jane Smith" />
|
|
22
|
+
<CoarAvatar name="Alice" />
|
|
23
|
+
<CoarAvatar name="Bob Wilson" />
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import { CoarAvatar } from '@cocoar/vue-ui';
|
|
29
|
+
</script>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## With Image
|
|
33
|
+
|
|
34
|
+
Provide a `src` URL to show a profile photo. If the image fails to load, the avatar seamlessly reverts to initials so the layout never breaks.
|
|
35
|
+
|
|
36
|
+
**Demo — `avatar/demos/AvatarImage.vue`**
|
|
37
|
+
|
|
38
|
+
```vue
|
|
39
|
+
<template>
|
|
40
|
+
<div style="display: flex; flex-wrap: wrap; gap: 12px; align-items: center;">
|
|
41
|
+
<CoarAvatar src="https://i.pravatar.cc/150?img=1" name="User One" />
|
|
42
|
+
<CoarAvatar src="https://i.pravatar.cc/150?img=2" name="User Two" />
|
|
43
|
+
<CoarAvatar src="https://i.pravatar.cc/150?img=3" name="User Three" />
|
|
44
|
+
<CoarAvatar src="https://invalid-url.xyz/broken.jpg" name="Broken Image" />
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { CoarAvatar } from '@cocoar/vue-ui';
|
|
50
|
+
</script>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Sizes
|
|
54
|
+
|
|
55
|
+
Six sizes let you match the avatar to its context -- use `xs` in dense tables or chat lists, and `xxl` for prominent profile headers.
|
|
56
|
+
|
|
57
|
+
**Demo — `avatar/demos/AvatarSizes.vue`**
|
|
58
|
+
|
|
59
|
+
```vue
|
|
60
|
+
<template>
|
|
61
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;">
|
|
62
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
63
|
+
<CoarAvatar name="AB" size="xs" />
|
|
64
|
+
<span style="font-size: 11px; color: #64748b; font-family: monospace;">xs</span>
|
|
65
|
+
</div>
|
|
66
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
67
|
+
<CoarAvatar name="AB" size="s" />
|
|
68
|
+
<span style="font-size: 11px; color: #64748b; font-family: monospace;">s</span>
|
|
69
|
+
</div>
|
|
70
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
71
|
+
<CoarAvatar name="AB" size="m" />
|
|
72
|
+
<span style="font-size: 11px; color: #64748b; font-family: monospace;">m</span>
|
|
73
|
+
</div>
|
|
74
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
75
|
+
<CoarAvatar name="AB" size="l" />
|
|
76
|
+
<span style="font-size: 11px; color: #64748b; font-family: monospace;">l</span>
|
|
77
|
+
</div>
|
|
78
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
79
|
+
<CoarAvatar name="AB" size="xl" />
|
|
80
|
+
<span style="font-size: 11px; color: #64748b; font-family: monospace;">xl</span>
|
|
81
|
+
</div>
|
|
82
|
+
</div>
|
|
83
|
+
</template>
|
|
84
|
+
|
|
85
|
+
<script setup lang="ts">
|
|
86
|
+
import { CoarAvatar } from '@cocoar/vue-ui';
|
|
87
|
+
</script>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Shapes
|
|
91
|
+
|
|
92
|
+
Choose between circle (the default, great for people) and square (useful for teams, organizations, or app icons).
|
|
93
|
+
|
|
94
|
+
**Demo — `avatar/demos/AvatarShapes.vue`**
|
|
95
|
+
|
|
96
|
+
```vue
|
|
97
|
+
<template>
|
|
98
|
+
<div style="display: flex; flex-wrap: wrap; gap: 16px; align-items: center;">
|
|
99
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
100
|
+
<CoarAvatar name="JD" shape="circle" size="l" />
|
|
101
|
+
<span style="font-size: 11px; color: #64748b; font-family: monospace;">circle</span>
|
|
102
|
+
</div>
|
|
103
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
104
|
+
<CoarAvatar name="JD" shape="square" size="l" />
|
|
105
|
+
<span style="font-size: 11px; color: #64748b; font-family: monospace;">square</span>
|
|
106
|
+
</div>
|
|
107
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
108
|
+
<CoarAvatar src="https://i.pravatar.cc/150?img=5" name="JD" shape="circle" size="l" />
|
|
109
|
+
<span style="font-size: 11px; color: #64748b; font-family: monospace;">circle + image</span>
|
|
110
|
+
</div>
|
|
111
|
+
<div style="display: flex; flex-direction: column; align-items: center; gap: 4px;">
|
|
112
|
+
<CoarAvatar src="https://i.pravatar.cc/150?img=5" name="JD" shape="square" size="l" />
|
|
113
|
+
<span style="font-size: 11px; color: #64748b; font-family: monospace;">square + image</span>
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
</template>
|
|
117
|
+
|
|
118
|
+
<script setup lang="ts">
|
|
119
|
+
import { CoarAvatar } from '@cocoar/vue-ui';
|
|
120
|
+
</script>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Avatar Group
|
|
124
|
+
|
|
125
|
+
Stack avatars with negative margins to show team members or participants at a glance. Add a "+N" overflow indicator when the list is too long to display in full.
|
|
126
|
+
|
|
127
|
+
**Demo — `avatar/demos/AvatarGroup.vue`**
|
|
128
|
+
|
|
129
|
+
```vue
|
|
130
|
+
<template>
|
|
131
|
+
<div class="avatar-stack">
|
|
132
|
+
<CoarAvatar src="https://i.pravatar.cc/150?img=10" name="User A" size="m" />
|
|
133
|
+
<CoarAvatar src="https://i.pravatar.cc/150?img=11" name="User B" size="m" />
|
|
134
|
+
<CoarAvatar src="https://i.pravatar.cc/150?img=12" name="User C" size="m" />
|
|
135
|
+
<CoarAvatar src="https://i.pravatar.cc/150?img=13" name="User D" size="m" />
|
|
136
|
+
<CoarAvatar name="+5" size="m" />
|
|
137
|
+
</div>
|
|
138
|
+
</template>
|
|
139
|
+
|
|
140
|
+
<script setup lang="ts">
|
|
141
|
+
import { CoarAvatar } from '@cocoar/vue-ui';
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<style scoped>
|
|
145
|
+
.avatar-stack {
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
}
|
|
149
|
+
.avatar-stack > * + * {
|
|
150
|
+
margin-left: -8px;
|
|
151
|
+
}
|
|
152
|
+
.avatar-stack > * {
|
|
153
|
+
border: 2px solid var(--coar-background-neutral-primary, #fff);
|
|
154
|
+
border-radius: 50%;
|
|
155
|
+
}
|
|
156
|
+
</style>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## API
|
|
160
|
+
|
|
161
|
+
### Props
|
|
162
|
+
|
|
163
|
+
| Prop | Type | Default | Description |
|
|
164
|
+
|------|------|---------|-------------|
|
|
165
|
+
| `name` | `string` | `''` | User's name (used for initials fallback) |
|
|
166
|
+
| `src` | `string` | `undefined` | Image URL |
|
|
167
|
+
| `size` | `'xs' \| 's' \| 'm' \| 'l' \| 'xl' \| 'xxl'` | `'m'` | Avatar size |
|
|
168
|
+
| `shape` | `'circle' \| 'square'` | `'circle'` | Avatar shape |
|
|
169
|
+
| `initials` | `string` | `''` | Custom initials override |
|
|
170
|
+
| `clickable` | `boolean` | `false` | Make avatar interactive (button role) |
|
|
171
|
+
|
|
172
|
+
## i18n Keys
|
|
173
|
+
|
|
174
|
+
These keys can be translated via [`@cocoar/vue-localization`](../foundations/localization/translations.md).
|
|
175
|
+
|
|
176
|
+
| Key | Default (English) | Used as |
|
|
177
|
+
|-----|-------------------|---------|
|
|
178
|
+
| `coar.ui.avatar.avatar` | `'Avatar'` | `aria-label` and `alt` text fallback when no `name` prop is set |
|