@edsis/ui 0.0.2
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/README.md +40 -0
- package/accordion/README.md +195 -0
- package/alert/README.md +177 -0
- package/alert-dialog/README.md +239 -0
- package/aspect-ratio/README.md +112 -0
- package/avatar/README.md +176 -0
- package/badge/README.md +133 -0
- package/breadcrumb/README.md +216 -0
- package/button/README.md +139 -0
- package/button-group/README.md +204 -0
- package/calendar/README.md +132 -0
- package/card/README.md +220 -0
- package/carousel/README.md +276 -0
- package/chart/README.md +249 -0
- package/checkbox/README.md +149 -0
- package/collapsible/README.md +191 -0
- package/combobox/README.md +198 -0
- package/command/README.md +275 -0
- package/composer/README.md +235 -0
- package/context-menu/README.md +267 -0
- package/date-picker/README.md +177 -0
- package/dialog/README.md +237 -0
- package/drawer/README.md +145 -0
- package/dropdown-menu/README.md +311 -0
- package/editor/README.md +136 -0
- package/empty/README.md +183 -0
- package/fesm2022/edsis-ui-accordion.mjs +174 -0
- package/fesm2022/edsis-ui-accordion.mjs.map +1 -0
- package/fesm2022/edsis-ui-alert-dialog.mjs +242 -0
- package/fesm2022/edsis-ui-alert-dialog.mjs.map +1 -0
- package/fesm2022/edsis-ui-alert.mjs +90 -0
- package/fesm2022/edsis-ui-alert.mjs.map +1 -0
- package/fesm2022/edsis-ui-aspect-ratio.mjs +33 -0
- package/fesm2022/edsis-ui-aspect-ratio.mjs.map +1 -0
- package/fesm2022/edsis-ui-avatar.mjs +123 -0
- package/fesm2022/edsis-ui-avatar.mjs.map +1 -0
- package/fesm2022/edsis-ui-badge.mjs +47 -0
- package/fesm2022/edsis-ui-badge.mjs.map +1 -0
- package/fesm2022/edsis-ui-breadcrumb.mjs +186 -0
- package/fesm2022/edsis-ui-breadcrumb.mjs.map +1 -0
- package/fesm2022/edsis-ui-button-group.mjs +95 -0
- package/fesm2022/edsis-ui-button-group.mjs.map +1 -0
- package/fesm2022/edsis-ui-button.mjs +64 -0
- package/fesm2022/edsis-ui-button.mjs.map +1 -0
- package/fesm2022/edsis-ui-calendar.mjs +78 -0
- package/fesm2022/edsis-ui-calendar.mjs.map +1 -0
- package/fesm2022/edsis-ui-card.mjs +137 -0
- package/fesm2022/edsis-ui-card.mjs.map +1 -0
- package/fesm2022/edsis-ui-carousel.mjs +310 -0
- package/fesm2022/edsis-ui-carousel.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-area.mjs +6 -0
- package/fesm2022/edsis-ui-chart-area.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-bar.mjs +6 -0
- package/fesm2022/edsis-ui-chart-bar.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-line.mjs +6 -0
- package/fesm2022/edsis-ui-chart-line.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-pie.mjs +6 -0
- package/fesm2022/edsis-ui-chart-pie.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-radar.mjs +6 -0
- package/fesm2022/edsis-ui-chart-radar.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-radial.mjs +6 -0
- package/fesm2022/edsis-ui-chart-radial.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart-scatter.mjs +6 -0
- package/fesm2022/edsis-ui-chart-scatter.mjs.map +1 -0
- package/fesm2022/edsis-ui-chart.mjs +3714 -0
- package/fesm2022/edsis-ui-chart.mjs.map +1 -0
- package/fesm2022/edsis-ui-checkbox.mjs +104 -0
- package/fesm2022/edsis-ui-checkbox.mjs.map +1 -0
- package/fesm2022/edsis-ui-collapsible.mjs +116 -0
- package/fesm2022/edsis-ui-collapsible.mjs.map +1 -0
- package/fesm2022/edsis-ui-combobox.mjs +263 -0
- package/fesm2022/edsis-ui-combobox.mjs.map +1 -0
- package/fesm2022/edsis-ui-command.mjs +268 -0
- package/fesm2022/edsis-ui-command.mjs.map +1 -0
- package/fesm2022/edsis-ui-composer.mjs +329 -0
- package/fesm2022/edsis-ui-composer.mjs.map +1 -0
- package/fesm2022/edsis-ui-context-menu.mjs +100 -0
- package/fesm2022/edsis-ui-context-menu.mjs.map +1 -0
- package/fesm2022/edsis-ui-date-picker.mjs +155 -0
- package/fesm2022/edsis-ui-date-picker.mjs.map +1 -0
- package/fesm2022/edsis-ui-dialog.mjs +262 -0
- package/fesm2022/edsis-ui-dialog.mjs.map +1 -0
- package/fesm2022/edsis-ui-drawer.mjs +6 -0
- package/fesm2022/edsis-ui-drawer.mjs.map +1 -0
- package/fesm2022/edsis-ui-dropdown-menu.mjs +466 -0
- package/fesm2022/edsis-ui-dropdown-menu.mjs.map +1 -0
- package/fesm2022/edsis-ui-editor.mjs +692 -0
- package/fesm2022/edsis-ui-editor.mjs.map +1 -0
- package/fesm2022/edsis-ui-empty.mjs +132 -0
- package/fesm2022/edsis-ui-empty.mjs.map +1 -0
- package/fesm2022/edsis-ui-form.mjs +334 -0
- package/fesm2022/edsis-ui-form.mjs.map +1 -0
- package/fesm2022/edsis-ui-hover-card.mjs +284 -0
- package/fesm2022/edsis-ui-hover-card.mjs.map +1 -0
- package/fesm2022/edsis-ui-input-group.mjs +164 -0
- package/fesm2022/edsis-ui-input-group.mjs.map +1 -0
- package/fesm2022/edsis-ui-input-otp.mjs +485 -0
- package/fesm2022/edsis-ui-input-otp.mjs.map +1 -0
- package/fesm2022/edsis-ui-input.mjs +43 -0
- package/fesm2022/edsis-ui-input.mjs.map +1 -0
- package/fesm2022/edsis-ui-item.mjs +241 -0
- package/fesm2022/edsis-ui-item.mjs.map +1 -0
- package/fesm2022/edsis-ui-kanban.mjs +289 -0
- package/fesm2022/edsis-ui-kanban.mjs.map +1 -0
- package/fesm2022/edsis-ui-kbd.mjs +51 -0
- package/fesm2022/edsis-ui-kbd.mjs.map +1 -0
- package/fesm2022/edsis-ui-label.mjs +30 -0
- package/fesm2022/edsis-ui-label.mjs.map +1 -0
- package/fesm2022/edsis-ui-menubar.mjs +302 -0
- package/fesm2022/edsis-ui-menubar.mjs.map +1 -0
- package/fesm2022/edsis-ui-native-select.mjs +61 -0
- package/fesm2022/edsis-ui-native-select.mjs.map +1 -0
- package/fesm2022/edsis-ui-navigation-menu.mjs +399 -0
- package/fesm2022/edsis-ui-navigation-menu.mjs.map +1 -0
- package/fesm2022/edsis-ui-pagination.mjs +216 -0
- package/fesm2022/edsis-ui-pagination.mjs.map +1 -0
- package/fesm2022/edsis-ui-pillbox.mjs +777 -0
- package/fesm2022/edsis-ui-pillbox.mjs.map +1 -0
- package/fesm2022/edsis-ui-popover.mjs +163 -0
- package/fesm2022/edsis-ui-popover.mjs.map +1 -0
- package/fesm2022/edsis-ui-progress.mjs +53 -0
- package/fesm2022/edsis-ui-progress.mjs.map +1 -0
- package/fesm2022/edsis-ui-radio.mjs +111 -0
- package/fesm2022/edsis-ui-radio.mjs.map +1 -0
- package/fesm2022/edsis-ui-resizable.mjs +454 -0
- package/fesm2022/edsis-ui-resizable.mjs.map +1 -0
- package/fesm2022/edsis-ui-scroll-area.mjs +48 -0
- package/fesm2022/edsis-ui-scroll-area.mjs.map +1 -0
- package/fesm2022/edsis-ui-select.mjs +164 -0
- package/fesm2022/edsis-ui-select.mjs.map +1 -0
- package/fesm2022/edsis-ui-separator.mjs +33 -0
- package/fesm2022/edsis-ui-separator.mjs.map +1 -0
- package/fesm2022/edsis-ui-sheet.mjs +264 -0
- package/fesm2022/edsis-ui-sheet.mjs.map +1 -0
- package/fesm2022/edsis-ui-skeleton.mjs +29 -0
- package/fesm2022/edsis-ui-skeleton.mjs.map +1 -0
- package/fesm2022/edsis-ui-slider.mjs +405 -0
- package/fesm2022/edsis-ui-slider.mjs.map +1 -0
- package/fesm2022/edsis-ui-spinner.mjs +58 -0
- package/fesm2022/edsis-ui-spinner.mjs.map +1 -0
- package/fesm2022/edsis-ui-switch.mjs +107 -0
- package/fesm2022/edsis-ui-switch.mjs.map +1 -0
- package/fesm2022/edsis-ui-table.mjs +139 -0
- package/fesm2022/edsis-ui-table.mjs.map +1 -0
- package/fesm2022/edsis-ui-tabs.mjs +252 -0
- package/fesm2022/edsis-ui-tabs.mjs.map +1 -0
- package/fesm2022/edsis-ui-textarea.mjs +37 -0
- package/fesm2022/edsis-ui-textarea.mjs.map +1 -0
- package/fesm2022/edsis-ui-timeline.mjs +213 -0
- package/fesm2022/edsis-ui-timeline.mjs.map +1 -0
- package/fesm2022/edsis-ui-toast.mjs +71 -0
- package/fesm2022/edsis-ui-toast.mjs.map +1 -0
- package/fesm2022/edsis-ui-toggle-group.mjs +269 -0
- package/fesm2022/edsis-ui-toggle-group.mjs.map +1 -0
- package/fesm2022/edsis-ui-toggle.mjs +76 -0
- package/fesm2022/edsis-ui-toggle.mjs.map +1 -0
- package/fesm2022/edsis-ui-tooltip.mjs +339 -0
- package/fesm2022/edsis-ui-tooltip.mjs.map +1 -0
- package/fesm2022/edsis-ui-utils.mjs +13 -0
- package/fesm2022/edsis-ui-utils.mjs.map +1 -0
- package/fesm2022/edsis-ui.mjs +11 -0
- package/fesm2022/edsis-ui.mjs.map +1 -0
- package/form/README.md +210 -0
- package/hover-card/README.md +146 -0
- package/input/README.md +159 -0
- package/input-group/README.md +234 -0
- package/input-otp/README.md +273 -0
- package/item/README.md +247 -0
- package/kanban/README.md +81 -0
- package/kbd/README.md +139 -0
- package/label/README.md +136 -0
- package/menubar/README.md +269 -0
- package/native-select/README.md +176 -0
- package/navigation-menu/README.md +160 -0
- package/package.json +310 -0
- package/pagination/README.md +144 -0
- package/pillbox/README.md +67 -0
- package/popover/README.md +43 -0
- package/progress/README.md +160 -0
- package/radio/README.md +209 -0
- package/resizable/README.md +164 -0
- package/scroll-area/README.md +143 -0
- package/select/README.md +174 -0
- package/separator/README.md +170 -0
- package/sheet/README.md +183 -0
- package/skeleton/README.md +158 -0
- package/slider/README.md +207 -0
- package/spinner/README.md +160 -0
- package/switch/README.md +166 -0
- package/table/README.md +291 -0
- package/tabs/README.md +214 -0
- package/textarea/README.md +154 -0
- package/timeline/README.md +94 -0
- package/toast/README.md +321 -0
- package/toggle/README.md +131 -0
- package/toggle-group/README.md +206 -0
- package/tooltip/README.md +211 -0
- package/types/edsis-ui-accordion.d.ts +51 -0
- package/types/edsis-ui-alert-dialog.d.ts +93 -0
- package/types/edsis-ui-alert.d.ts +37 -0
- package/types/edsis-ui-aspect-ratio.d.ts +12 -0
- package/types/edsis-ui-avatar.d.ts +51 -0
- package/types/edsis-ui-badge.d.ts +19 -0
- package/types/edsis-ui-breadcrumb.d.ts +46 -0
- package/types/edsis-ui-button-group.d.ts +26 -0
- package/types/edsis-ui-button.d.ts +22 -0
- package/types/edsis-ui-calendar.d.ts +33 -0
- package/types/edsis-ui-card.d.ts +60 -0
- package/types/edsis-ui-carousel.d.ts +86 -0
- package/types/edsis-ui-chart-area.d.ts +1 -0
- package/types/edsis-ui-chart-bar.d.ts +1 -0
- package/types/edsis-ui-chart-line.d.ts +1 -0
- package/types/edsis-ui-chart-pie.d.ts +1 -0
- package/types/edsis-ui-chart-radar.d.ts +1 -0
- package/types/edsis-ui-chart-radial.d.ts +1 -0
- package/types/edsis-ui-chart-scatter.d.ts +1 -0
- package/types/edsis-ui-chart.d.ts +1094 -0
- package/types/edsis-ui-checkbox.d.ts +35 -0
- package/types/edsis-ui-collapsible.d.ts +42 -0
- package/types/edsis-ui-combobox.d.ts +51 -0
- package/types/edsis-ui-command.d.ts +99 -0
- package/types/edsis-ui-composer.d.ts +90 -0
- package/types/edsis-ui-context-menu.d.ts +35 -0
- package/types/edsis-ui-date-picker.d.ts +41 -0
- package/types/edsis-ui-dialog.d.ts +87 -0
- package/types/edsis-ui-drawer.d.ts +1 -0
- package/types/edsis-ui-dropdown-menu.d.ts +136 -0
- package/types/edsis-ui-editor.d.ts +123 -0
- package/types/edsis-ui-empty.d.ts +50 -0
- package/types/edsis-ui-form.d.ts +141 -0
- package/types/edsis-ui-hover-card.d.ts +74 -0
- package/types/edsis-ui-input-group.d.ts +51 -0
- package/types/edsis-ui-input-otp.d.ts +136 -0
- package/types/edsis-ui-input.d.ts +16 -0
- package/types/edsis-ui-item.d.ts +88 -0
- package/types/edsis-ui-kanban.d.ts +70 -0
- package/types/edsis-ui-kbd.d.ts +16 -0
- package/types/edsis-ui-label.d.ts +11 -0
- package/types/edsis-ui-menubar.d.ts +67 -0
- package/types/edsis-ui-native-select.d.ts +26 -0
- package/types/edsis-ui-navigation-menu.d.ts +96 -0
- package/types/edsis-ui-pagination.d.ts +34 -0
- package/types/edsis-ui-pillbox.d.ts +157 -0
- package/types/edsis-ui-popover.d.ts +43 -0
- package/types/edsis-ui-progress.d.ts +17 -0
- package/types/edsis-ui-radio.d.ts +40 -0
- package/types/edsis-ui-resizable.d.ts +99 -0
- package/types/edsis-ui-scroll-area.d.ts +19 -0
- package/types/edsis-ui-select.d.ts +57 -0
- package/types/edsis-ui-separator.d.ts +14 -0
- package/types/edsis-ui-sheet.d.ts +76 -0
- package/types/edsis-ui-skeleton.d.ts +10 -0
- package/types/edsis-ui-slider.d.ts +74 -0
- package/types/edsis-ui-spinner.d.ts +13 -0
- package/types/edsis-ui-switch.d.ts +40 -0
- package/types/edsis-ui-table.d.ts +52 -0
- package/types/edsis-ui-tabs.d.ts +92 -0
- package/types/edsis-ui-textarea.d.ts +12 -0
- package/types/edsis-ui-timeline.d.ts +63 -0
- package/types/edsis-ui-toast.d.ts +38 -0
- package/types/edsis-ui-toggle-group.d.ts +89 -0
- package/types/edsis-ui-toggle.d.ts +25 -0
- package/types/edsis-ui-tooltip.d.ts +89 -0
- package/types/edsis-ui-utils.d.ts +5 -0
- package/types/edsis-ui.d.ts +2 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Aspect Ratio
|
|
2
|
+
|
|
3
|
+
Displays content within a fixed width-to-height ratio.
|
|
4
|
+
|
|
5
|
+
Use Aspect Ratio for image frames, media placeholders, thumbnail cards, and any layout where the container height should derive from the available width.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { AspectRatioComponent } from '@edsis/ui/aspect-ratio';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Bind a numeric ratio with `[ratio]`. The host renders as a block-level container with `position: relative`, so projected children can fill the box with `h-full w-full` or positioned overlays.
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<div class="w-full max-w-sm">
|
|
19
|
+
<ui-aspect-ratio [ratio]="16 / 9" class="overflow-hidden rounded-lg border border-border bg-muted/30">
|
|
20
|
+
<img src="https://avatar.vercel.sh/shadcn1" alt="Demo media" class="h-full w-full object-cover" />
|
|
21
|
+
</ui-aspect-ratio>
|
|
22
|
+
</div>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Common patterns
|
|
26
|
+
|
|
27
|
+
### Landscape media
|
|
28
|
+
|
|
29
|
+
Use `16 / 9` for hero images, video posters, and card thumbnails.
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<div class="max-w-sm">
|
|
33
|
+
<ui-aspect-ratio [ratio]="16 / 9" class="overflow-hidden rounded-lg bg-muted">
|
|
34
|
+
<img src="..." alt="Landscape" class="h-full w-full object-cover" />
|
|
35
|
+
</ui-aspect-ratio>
|
|
36
|
+
</div>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Square avatars or gallery tiles
|
|
40
|
+
|
|
41
|
+
Use `1` for square media slots.
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<div class="max-w-48">
|
|
45
|
+
<ui-aspect-ratio [ratio]="1" class="overflow-hidden rounded-xl bg-muted">
|
|
46
|
+
<img src="..." alt="Square tile" class="h-full w-full object-cover" />
|
|
47
|
+
</ui-aspect-ratio>
|
|
48
|
+
</div>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Portrait cards
|
|
52
|
+
|
|
53
|
+
Use `9 / 16` when the design calls for tall image treatments.
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<div class="max-w-40">
|
|
57
|
+
<ui-aspect-ratio [ratio]="9 / 16" class="overflow-hidden rounded-xl bg-muted">
|
|
58
|
+
<img src="..." alt="Portrait tile" class="h-full w-full object-cover" />
|
|
59
|
+
</ui-aspect-ratio>
|
|
60
|
+
</div>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Figure with caption
|
|
64
|
+
|
|
65
|
+
Keep captions outside the ratio box so the media height stays stable while text can grow naturally.
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<figure class="max-w-sm">
|
|
69
|
+
<ui-aspect-ratio [ratio]="16 / 9" class="overflow-hidden rounded-lg border border-border bg-muted/30">
|
|
70
|
+
<img src="..." alt="Beautiful landscape" class="h-full w-full object-cover" />
|
|
71
|
+
</ui-aspect-ratio>
|
|
72
|
+
<figcaption class="mt-2 text-sm text-muted-foreground">Beautiful landscape</figcaption>
|
|
73
|
+
</figure>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## API reference
|
|
77
|
+
|
|
78
|
+
### `AspectRatioComponent`
|
|
79
|
+
|
|
80
|
+
| Input | Type | Default | Description |
|
|
81
|
+
| ------- | -------- | -------- | ------------------------------------------------------------------------------------------- |
|
|
82
|
+
| `ratio` | `number` | required | The desired width-to-height ratio. Use Angular expressions like `16 / 9`, `1`, or `9 / 16`. |
|
|
83
|
+
| `class` | `string` | `''` | Additional utility classes for the host container. |
|
|
84
|
+
|
|
85
|
+
## Styling and theming
|
|
86
|
+
|
|
87
|
+
Base host classes: `relative block w-full`.
|
|
88
|
+
|
|
89
|
+
Pass utility classes for rounded corners, borders, backgrounds, shadows, and max width. Add `overflow-hidden` when the projected media should be clipped to the container radius. The projected child should usually use `h-full w-full object-cover` for image-like content.
|
|
90
|
+
|
|
91
|
+
## Accessibility
|
|
92
|
+
|
|
93
|
+
Aspect Ratio has no built-in semantics beyond its host element. Accessibility comes from the projected content.
|
|
94
|
+
|
|
95
|
+
- Provide meaningful `alt` text for images.
|
|
96
|
+
- Prefer `<figure>` and `<figcaption>` when media needs visible labeling.
|
|
97
|
+
- Do not place essential text only inside a background image.
|
|
98
|
+
|
|
99
|
+
## Keyboard interactions
|
|
100
|
+
|
|
101
|
+
Aspect Ratio has no keyboard interaction. It should not receive focus unless the projected content contains an interactive control.
|
|
102
|
+
|
|
103
|
+
## Angular notes
|
|
104
|
+
|
|
105
|
+
- Import `AspectRatioComponent` directly into the standalone component that owns the media layout.
|
|
106
|
+
- Use `[ratio]` with a numeric Angular expression instead of a React prop like `ratio={16 / 9}`.
|
|
107
|
+
- The component uses a block-level custom element so width utilities such as `w-full` and `max-w-sm` behave predictably.
|
|
108
|
+
- The projected content is wrapped in an absolute fill container so overlays and full-height media stay aligned with the ratio box.
|
|
109
|
+
|
|
110
|
+
## Source parity
|
|
111
|
+
|
|
112
|
+
This Angular implementation follows the shadcn Aspect Ratio examples for landscape, square, portrait, and RTL-friendly media layouts while translating React props and fill behavior to Angular bindings and projected content.
|
package/avatar/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Avatar
|
|
2
|
+
|
|
3
|
+
Rounded image with an automatic text fallback when the image fails to load.
|
|
4
|
+
|
|
5
|
+
This Angular implementation follows the shadcn Avatar information architecture while adapting it to standalone Angular imports, signal-friendly inputs, and local menu primitives.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
AvatarBadgeComponent,
|
|
12
|
+
AvatarComponent,
|
|
13
|
+
AvatarFallbackComponent,
|
|
14
|
+
AvatarGroupComponent,
|
|
15
|
+
AvatarGroupCountComponent,
|
|
16
|
+
AvatarImageComponent,
|
|
17
|
+
} from '@edsis/ui/avatar';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```html
|
|
23
|
+
<ui-avatar size="lg">
|
|
24
|
+
<ui-avatar-image src="/me.jpg" alt="Ada Lovelace" />
|
|
25
|
+
<ui-avatar-fallback>AL</ui-avatar-fallback>
|
|
26
|
+
<ui-avatar-badge class="bg-emerald-600" aria-hidden="true"></ui-avatar-badge>
|
|
27
|
+
</ui-avatar>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
If `src` fails to load, the `<img>` is removed and the fallback becomes visible.
|
|
31
|
+
|
|
32
|
+
## Composition
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
ui-avatar
|
|
36
|
+
├── ui-avatar-image
|
|
37
|
+
├── ui-avatar-fallback
|
|
38
|
+
└── ui-avatar-badge
|
|
39
|
+
|
|
40
|
+
ui-avatar-group
|
|
41
|
+
├── ui-avatar
|
|
42
|
+
│ ├── ui-avatar-image
|
|
43
|
+
│ ├── ui-avatar-fallback
|
|
44
|
+
│ └── ui-avatar-badge
|
|
45
|
+
├── ui-avatar
|
|
46
|
+
│ ├── ui-avatar-image
|
|
47
|
+
│ ├── ui-avatar-fallback
|
|
48
|
+
│ └── ui-avatar-badge
|
|
49
|
+
└── ui-avatar-group-count
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Common patterns
|
|
53
|
+
|
|
54
|
+
### Basic avatar
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<ui-avatar>
|
|
58
|
+
<ui-avatar-image src="https://github.com/shadcn.png" alt="@shadcn" class="grayscale" />
|
|
59
|
+
<ui-avatar-fallback>CN</ui-avatar-fallback>
|
|
60
|
+
</ui-avatar>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Presence badge
|
|
64
|
+
|
|
65
|
+
Use `ui-avatar-badge` for online status, synced state, or a compact icon action.
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<ui-avatar>
|
|
69
|
+
<ui-avatar-image src="https://github.com/evilrabbit.png" alt="@evilrabbit" />
|
|
70
|
+
<ui-avatar-fallback>ER</ui-avatar-fallback>
|
|
71
|
+
<ui-avatar-badge class="bg-emerald-600" aria-hidden="true"></ui-avatar-badge>
|
|
72
|
+
</ui-avatar>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Avatar group
|
|
76
|
+
|
|
77
|
+
`ui-avatar-group` applies the overlapping stack treatment, while `ui-avatar-group-count` handles the overflow counter.
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<ui-avatar-group class="grayscale">
|
|
81
|
+
<ui-avatar>
|
|
82
|
+
<ui-avatar-image src="https://github.com/shadcn.png" alt="@shadcn" />
|
|
83
|
+
<ui-avatar-fallback>CN</ui-avatar-fallback>
|
|
84
|
+
</ui-avatar>
|
|
85
|
+
<ui-avatar>
|
|
86
|
+
<ui-avatar-image src="https://github.com/maxleiter.png" alt="@maxleiter" />
|
|
87
|
+
<ui-avatar-fallback>ML</ui-avatar-fallback>
|
|
88
|
+
</ui-avatar>
|
|
89
|
+
<ui-avatar>
|
|
90
|
+
<ui-avatar-image src="https://github.com/evilrabbit.png" alt="@evilrabbit" />
|
|
91
|
+
<ui-avatar-fallback>ER</ui-avatar-fallback>
|
|
92
|
+
</ui-avatar>
|
|
93
|
+
<ui-avatar-group-count>+3</ui-avatar-group-count>
|
|
94
|
+
</ui-avatar-group>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Size variants
|
|
98
|
+
|
|
99
|
+
Use the root `size` input instead of repeating manual width and height classes.
|
|
100
|
+
|
|
101
|
+
```html
|
|
102
|
+
<div class="flex items-center gap-3">
|
|
103
|
+
<ui-avatar size="sm">...</ui-avatar>
|
|
104
|
+
<ui-avatar>...</ui-avatar>
|
|
105
|
+
<ui-avatar size="lg">...</ui-avatar>
|
|
106
|
+
</div>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Dropdown trigger composition
|
|
110
|
+
|
|
111
|
+
Avatar stays presentational. When it opens a menu, wrap it in a button and let the button or menu trigger own focus and keyboard handling.
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<button ui-button variant="ghost" size="icon" class="h-10 w-10 rounded-full p-0" [uiMenuTrigger]="accountMenu">
|
|
115
|
+
<ui-avatar>
|
|
116
|
+
<ui-avatar-image src="https://github.com/shadcn.png" alt="Ada Lovelace" />
|
|
117
|
+
<ui-avatar-fallback>AL</ui-avatar-fallback>
|
|
118
|
+
</ui-avatar>
|
|
119
|
+
</button>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### RTL
|
|
123
|
+
|
|
124
|
+
Avatar itself does not need different markup in right-to-left layouts. Set `dir="rtl"` on the surrounding surface.
|
|
125
|
+
|
|
126
|
+
```html
|
|
127
|
+
<section dir="rtl" lang="ar" class="flex items-center gap-4 text-right">
|
|
128
|
+
<ui-avatar>
|
|
129
|
+
<ui-avatar-image src="https://github.com/shadcn.png" alt="@shadcn" class="grayscale" />
|
|
130
|
+
<ui-avatar-fallback>CN</ui-avatar-fallback>
|
|
131
|
+
</ui-avatar>
|
|
132
|
+
</section>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## API reference
|
|
136
|
+
|
|
137
|
+
| Primitive | Input(s) |
|
|
138
|
+
| --------------------------- | -------------------------------- |
|
|
139
|
+
| `AvatarComponent` | `size`, `class` |
|
|
140
|
+
| `AvatarImageComponent` | `src` (required), `alt`, `class` |
|
|
141
|
+
| `AvatarFallbackComponent` | `class` |
|
|
142
|
+
| `AvatarBadgeComponent` | `class` |
|
|
143
|
+
| `AvatarGroupComponent` | `class` |
|
|
144
|
+
| `AvatarGroupCountComponent` | `class` |
|
|
145
|
+
|
|
146
|
+
`AvatarComponent.size` accepts `'default' | 'sm' | 'lg'` and defaults to `'default'`.
|
|
147
|
+
|
|
148
|
+
## Styling and theming
|
|
149
|
+
|
|
150
|
+
Tokens consumed: `--muted`, `--muted-foreground`, `--background`, `--primary`, and `--primary-foreground`.
|
|
151
|
+
|
|
152
|
+
The default avatar size is `h-10 w-10`. Use the `size` input for the common variants and pass `class` for brand-specific overrides such as grayscale, custom borders, or alternate badge colors.
|
|
153
|
+
|
|
154
|
+
`ui-avatar-badge` is the right place for presence color overrides, and `ui-avatar-group-count` can be restyled when overflow counters should match a specific product palette.
|
|
155
|
+
|
|
156
|
+
## Accessibility
|
|
157
|
+
|
|
158
|
+
Always pass a meaningful `alt` to `<ui-avatar-image>`. If the avatar is purely
|
|
159
|
+
decorative (user's name already shown), use `alt=""`. The fallback text is
|
|
160
|
+
readable by screen readers.
|
|
161
|
+
|
|
162
|
+
Keep fallback text short, typically initials, so it remains legible in smaller sizes.
|
|
163
|
+
|
|
164
|
+
## Keyboard interactions
|
|
165
|
+
|
|
166
|
+
Avatar itself is not interactive. If it is used to open a menu, dialog, or popover, wrap it in a native button or another focusable trigger primitive so Tab, Enter, and Space behavior stays with the interactive host.
|
|
167
|
+
|
|
168
|
+
## Angular notes
|
|
169
|
+
|
|
170
|
+
- `size` is exposed as a typed Angular input on `ui-avatar`.
|
|
171
|
+
- Grouping is handled by dedicated primitives instead of utility-only composition, which keeps Angular templates explicit and reusable.
|
|
172
|
+
- Image fallback is handled internally by hiding the `<img>` after its `error` event.
|
|
173
|
+
|
|
174
|
+
## Source parity
|
|
175
|
+
|
|
176
|
+
This Angular implementation follows the shadcn Avatar concepts, examples, and API shape while adapting menu composition to the local `ui-button` plus menu primitives and Angular standalone imports.
|
package/badge/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Badge
|
|
2
|
+
|
|
3
|
+
Displays a badge or a semantic element that looks like a badge.
|
|
4
|
+
|
|
5
|
+
Use Badge for status pills, small metadata labels, compact counts, and lightweight link-like callouts that should keep the badge silhouette.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { BadgeComponent } from '@edsis/ui/badge';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Use `<ui-badge>` for the default host element or apply `[ui-badge]` to a semantic host such as `<span>` or `<a>` when the badge should inherit native behavior.
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<ui-badge>New</ui-badge>
|
|
19
|
+
<ui-badge variant="secondary">Secondary</ui-badge>
|
|
20
|
+
<ui-badge variant="destructive">Error</ui-badge>
|
|
21
|
+
<ui-badge variant="outline">Outline</ui-badge>
|
|
22
|
+
<ui-badge variant="ghost">Ghost</ui-badge>
|
|
23
|
+
|
|
24
|
+
<span ui-badge variant="secondary">v1.0</span>
|
|
25
|
+
|
|
26
|
+
<a ui-badge variant="link" href="#billing">
|
|
27
|
+
Open billing
|
|
28
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="size-3">
|
|
29
|
+
<path d="M7 17L17 7" />
|
|
30
|
+
<path d="M9 7h8v8" />
|
|
31
|
+
</svg>
|
|
32
|
+
</a>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Common patterns
|
|
36
|
+
|
|
37
|
+
### Variants
|
|
38
|
+
|
|
39
|
+
The Angular primitive follows the current shadcn badge palette and adds `ghost` plus `link` variants to cover low-emphasis and anchor-style treatments.
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<div class="flex flex-wrap gap-2">
|
|
43
|
+
<ui-badge>Default</ui-badge>
|
|
44
|
+
<ui-badge variant="secondary">Secondary</ui-badge>
|
|
45
|
+
<ui-badge variant="destructive">Destructive</ui-badge>
|
|
46
|
+
<ui-badge variant="outline">Outline</ui-badge>
|
|
47
|
+
<ui-badge variant="ghost">Ghost</ui-badge>
|
|
48
|
+
</div>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### With icon
|
|
52
|
+
|
|
53
|
+
Project an inline SVG or icon component directly inside the badge. The primitive adds compact spacing and sizes direct child SVGs automatically.
|
|
54
|
+
|
|
55
|
+
```html
|
|
56
|
+
<ui-badge variant="secondary">
|
|
57
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
58
|
+
<path d="M20 7L9 18l-5-5" />
|
|
59
|
+
</svg>
|
|
60
|
+
Verified
|
|
61
|
+
</ui-badge>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### With spinner
|
|
65
|
+
|
|
66
|
+
Spinner content can be projected like any other inline element.
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<ui-badge variant="destructive">
|
|
70
|
+
<span aria-hidden="true" class="size-3 animate-spin rounded-full border-2 border-current border-r-transparent"></span>
|
|
71
|
+
Deleting
|
|
72
|
+
</ui-badge>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Link host
|
|
76
|
+
|
|
77
|
+
shadcn React uses `asChild` for links. In Angular, use a semantic anchor host directly.
|
|
78
|
+
|
|
79
|
+
```html
|
|
80
|
+
<a ui-badge variant="link" href="#link">Open Link</a>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Custom colors
|
|
84
|
+
|
|
85
|
+
Custom color treatments are plain classes on the host.
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<ui-badge class="border-transparent bg-sky-100 text-sky-800">Blue</ui-badge>
|
|
89
|
+
<ui-badge class="border-transparent bg-emerald-100 text-emerald-800">Green</ui-badge>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## API reference
|
|
93
|
+
|
|
94
|
+
### `BadgeComponent`
|
|
95
|
+
|
|
96
|
+
| Input | Type | Default |
|
|
97
|
+
| --------- | ----------------------------------------------------------------------------- | ----------- |
|
|
98
|
+
| `variant` | `'default' \| 'secondary' \| 'destructive' \| 'outline' \| 'ghost' \| 'link'` | `'default'` |
|
|
99
|
+
| `class` | `string` | `''` |
|
|
100
|
+
|
|
101
|
+
## Styling and theming
|
|
102
|
+
|
|
103
|
+
The base badge uses `border-border` for visible outlines instead of inheriting border color from text. Variant classes override that border when the badge should render as a filled pill.
|
|
104
|
+
|
|
105
|
+
Pass `class` to add custom backgrounds, foreground colors, spacing, or width behavior. Direct child SVGs inherit `currentColor` and receive compact sizing automatically.
|
|
106
|
+
|
|
107
|
+
Powered by `class-variance-authority`. Re-export: `badgeVariants` and `BadgeVariant`.
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import { badgeVariants } from '@edsis/ui/badge';
|
|
111
|
+
|
|
112
|
+
const className = badgeVariants({ variant: 'link' });
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Accessibility
|
|
116
|
+
|
|
117
|
+
- Keep meaningful text inside the badge when it communicates a state, label, or count.
|
|
118
|
+
- Do not rely on color alone to distinguish success, warning, or destructive meaning.
|
|
119
|
+
- When the badge should be interactive, use a semantic host like `<a ui-badge>` so native keyboard and screen-reader behavior stay intact.
|
|
120
|
+
|
|
121
|
+
## Keyboard interactions
|
|
122
|
+
|
|
123
|
+
Static badges are not focusable. Anchors and other semantic hosts keep their native keyboard behavior, so Tab and Enter handling stays with the host element rather than the badge primitive itself.
|
|
124
|
+
|
|
125
|
+
## Angular notes
|
|
126
|
+
|
|
127
|
+
- Angular uses the selector `ui-badge` for the default element host and `[ui-badge]` for semantic hosts.
|
|
128
|
+
- React `asChild` maps to choosing the correct host element directly in Angular templates.
|
|
129
|
+
- `variant` is an Angular `input()` on the badge component, so it works on both element and attribute hosts.
|
|
130
|
+
|
|
131
|
+
## Source parity
|
|
132
|
+
|
|
133
|
+
This Angular badge follows the shadcn Badge information architecture and examples while translating React-specific `asChild` composition into semantic Angular host elements.
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Breadcrumb
|
|
2
|
+
|
|
3
|
+
Displays the path to the current resource using a hierarchy of links.
|
|
4
|
+
|
|
5
|
+
Use Breadcrumb for hierarchical navigation trails in docs, account areas, settings surfaces, and deep app routes where users need a quick sense of where they are.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import {
|
|
11
|
+
BreadcrumbComponent,
|
|
12
|
+
BreadcrumbEllipsisComponent,
|
|
13
|
+
BreadcrumbItemComponent,
|
|
14
|
+
BreadcrumbLinkComponent,
|
|
15
|
+
BreadcrumbListComponent,
|
|
16
|
+
BreadcrumbPageComponent,
|
|
17
|
+
BreadcrumbSeparatorComponent,
|
|
18
|
+
} from '@edsis/ui/breadcrumb';
|
|
19
|
+
import { RouterLink } from '@angular/router';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Composition
|
|
23
|
+
|
|
24
|
+
The Angular structure matches the shadcn breadcrumb composition while translating it to Angular selectors and native router-friendly anchors.
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
ui-breadcrumb
|
|
28
|
+
└── ol[ui-breadcrumb-list]
|
|
29
|
+
├── li[ui-breadcrumb-item]
|
|
30
|
+
│ └── a[ui-breadcrumb-link]
|
|
31
|
+
├── li[ui-breadcrumb-separator]
|
|
32
|
+
├── li[ui-breadcrumb-item]
|
|
33
|
+
│ └── a[ui-breadcrumb-link]
|
|
34
|
+
├── li[ui-breadcrumb-separator]
|
|
35
|
+
└── li[ui-breadcrumb-item]
|
|
36
|
+
└── span[ui-breadcrumb-page]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Basic usage
|
|
40
|
+
|
|
41
|
+
Prefer a semantic `<nav ui-breadcrumb>` root, then build the trail from list, item, link, separator, and current-page parts.
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<nav ui-breadcrumb>
|
|
45
|
+
<ol ui-breadcrumb-list>
|
|
46
|
+
<li ui-breadcrumb-item>
|
|
47
|
+
<a ui-breadcrumb-link routerLink="/">Home</a>
|
|
48
|
+
</li>
|
|
49
|
+
<li ui-breadcrumb-separator></li>
|
|
50
|
+
<li ui-breadcrumb-item>
|
|
51
|
+
<a ui-breadcrumb-link routerLink="/ui/shadcn/button">Components</a>
|
|
52
|
+
</li>
|
|
53
|
+
<li ui-breadcrumb-separator></li>
|
|
54
|
+
<li ui-breadcrumb-item>
|
|
55
|
+
<span ui-breadcrumb-page>Breadcrumb</span>
|
|
56
|
+
</li>
|
|
57
|
+
</ol>
|
|
58
|
+
</nav>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Common patterns
|
|
62
|
+
|
|
63
|
+
### Custom separator
|
|
64
|
+
|
|
65
|
+
Project custom children into `ui-breadcrumb-separator` to swap the default chevron for a slash, dot, brand icon, or other neutral divider.
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<nav ui-breadcrumb>
|
|
69
|
+
<ol ui-breadcrumb-list>
|
|
70
|
+
<li ui-breadcrumb-item><a ui-breadcrumb-link href="/">Home</a></li>
|
|
71
|
+
<li ui-breadcrumb-separator>
|
|
72
|
+
<svg class="h-2.5 w-2.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
73
|
+
<circle cx="12" cy="12" r="3"></circle>
|
|
74
|
+
</svg>
|
|
75
|
+
</li>
|
|
76
|
+
<li ui-breadcrumb-item><a ui-breadcrumb-link href="/components">Components</a></li>
|
|
77
|
+
<li ui-breadcrumb-separator>
|
|
78
|
+
<svg class="h-2.5 w-2.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
|
|
79
|
+
<circle cx="12" cy="12" r="3"></circle>
|
|
80
|
+
</svg>
|
|
81
|
+
</li>
|
|
82
|
+
<li ui-breadcrumb-item><span ui-breadcrumb-page>Breadcrumb</span></li>
|
|
83
|
+
</ol>
|
|
84
|
+
</nav>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Collapsed trail
|
|
88
|
+
|
|
89
|
+
Use `ui-breadcrumb-ellipsis` when the trail is too long to show in full. Wrap it in a labeled button when the ellipsis should open an overflow menu.
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<nav ui-breadcrumb>
|
|
93
|
+
<ol ui-breadcrumb-list>
|
|
94
|
+
<li ui-breadcrumb-item><a ui-breadcrumb-link routerLink="/">Home</a></li>
|
|
95
|
+
<li ui-breadcrumb-separator></li>
|
|
96
|
+
<li ui-breadcrumb-item><span ui-breadcrumb-ellipsis></span></li>
|
|
97
|
+
<li ui-breadcrumb-separator></li>
|
|
98
|
+
<li ui-breadcrumb-item><a ui-breadcrumb-link routerLink="/docs/components">Components</a></li>
|
|
99
|
+
<li ui-breadcrumb-separator></li>
|
|
100
|
+
<li ui-breadcrumb-item><span ui-breadcrumb-page>Breadcrumb</span></li>
|
|
101
|
+
</ol>
|
|
102
|
+
</nav>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Dropdown composition
|
|
106
|
+
|
|
107
|
+
Compose a breadcrumb item with the local menu primitives when an intermediate node should expose related destinations instead of linking directly.
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<nav ui-breadcrumb>
|
|
111
|
+
<ol ui-breadcrumb-list>
|
|
112
|
+
<li ui-breadcrumb-item><a ui-breadcrumb-link routerLink="/">Home</a></li>
|
|
113
|
+
<li ui-breadcrumb-separator></li>
|
|
114
|
+
<li ui-breadcrumb-item>
|
|
115
|
+
<button
|
|
116
|
+
ui-button
|
|
117
|
+
type="button"
|
|
118
|
+
variant="ghost"
|
|
119
|
+
class="h-auto gap-1 px-2 py-1 font-normal text-muted-foreground hover:text-foreground"
|
|
120
|
+
[uiMenuTrigger]="componentsMenu">
|
|
121
|
+
Components
|
|
122
|
+
<svg class="h-3.5 w-3.5" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
123
|
+
<polyline points="6 9 12 15 18 9"></polyline>
|
|
124
|
+
</svg>
|
|
125
|
+
</button>
|
|
126
|
+
|
|
127
|
+
<ng-template uiMenuContent #componentsMenu="uiMenuContent">
|
|
128
|
+
<ui-menu-surface class="w-44">
|
|
129
|
+
<ui-menu-label>Components</ui-menu-label>
|
|
130
|
+
<button ui-menu-item>Documentation</button>
|
|
131
|
+
<button ui-menu-item>Themes</button>
|
|
132
|
+
<button ui-menu-item>GitHub</button>
|
|
133
|
+
</ui-menu-surface>
|
|
134
|
+
</ng-template>
|
|
135
|
+
</li>
|
|
136
|
+
<li ui-breadcrumb-separator></li>
|
|
137
|
+
<li ui-breadcrumb-item><span ui-breadcrumb-page>Breadcrumb</span></li>
|
|
138
|
+
</ol>
|
|
139
|
+
</nav>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### RouterLink integration
|
|
143
|
+
|
|
144
|
+
The shadcn React examples use `asChild` for custom routing components. In Angular, apply `routerLink` or `href` directly to the anchor that carries `ui-breadcrumb-link`.
|
|
145
|
+
|
|
146
|
+
```html
|
|
147
|
+
<a ui-breadcrumb-link routerLink="/ui/shadcn">Components</a>
|
|
148
|
+
<a ui-breadcrumb-link href="https://ui.shadcn.com/docs/components/radix/breadcrumb">shadcn docs</a>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### RTL
|
|
152
|
+
|
|
153
|
+
Set `dir="rtl"` on the breadcrumb root or an ancestor container. The structure stays the same while the visual flow shifts to right-to-left.
|
|
154
|
+
|
|
155
|
+
```html
|
|
156
|
+
<nav ui-breadcrumb dir="rtl" lang="ar">
|
|
157
|
+
<ol ui-breadcrumb-list class="justify-end">
|
|
158
|
+
<li ui-breadcrumb-item><a ui-breadcrumb-link href="/">الرئيسية</a></li>
|
|
159
|
+
<li ui-breadcrumb-separator></li>
|
|
160
|
+
<li ui-breadcrumb-item><a ui-breadcrumb-link href="/components">المكونات</a></li>
|
|
161
|
+
<li ui-breadcrumb-separator></li>
|
|
162
|
+
<li ui-breadcrumb-item><span ui-breadcrumb-page>مسار التنقل</span></li>
|
|
163
|
+
</ol>
|
|
164
|
+
</nav>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## API reference
|
|
168
|
+
|
|
169
|
+
### `BreadcrumbComponent`
|
|
170
|
+
|
|
171
|
+
| Input | Type | Default |
|
|
172
|
+
| ------- | -------- | ------- |
|
|
173
|
+
| `class` | `string` | `''` |
|
|
174
|
+
|
|
175
|
+
Use on `ui-breadcrumb` or `nav[ui-breadcrumb]`. The root always emits `aria-label="breadcrumb"` and keeps the custom-element form block-level.
|
|
176
|
+
|
|
177
|
+
### Parts
|
|
178
|
+
|
|
179
|
+
| Part | Selector | Input |
|
|
180
|
+
| ------------------------------ | ------------------------------ | ------- |
|
|
181
|
+
| `BreadcrumbListComponent` | `ol[ui-breadcrumb-list]` | `class` |
|
|
182
|
+
| `BreadcrumbItemComponent` | `li[ui-breadcrumb-item]` | `class` |
|
|
183
|
+
| `BreadcrumbLinkComponent` | `a[ui-breadcrumb-link]` | `class` |
|
|
184
|
+
| `BreadcrumbPageComponent` | `span[ui-breadcrumb-page]` | `class` |
|
|
185
|
+
| `BreadcrumbSeparatorComponent` | `li[ui-breadcrumb-separator]` | `class` |
|
|
186
|
+
| `BreadcrumbEllipsisComponent` | `span[ui-breadcrumb-ellipsis]` | `class` |
|
|
187
|
+
|
|
188
|
+
`BreadcrumbSeparatorComponent` accepts projected children to replace the default chevron icon.
|
|
189
|
+
|
|
190
|
+
## Styling and theming
|
|
191
|
+
|
|
192
|
+
The breadcrumb follows the shared theme tokens for foreground and muted text. Pass `class` to the list or individual parts to control spacing, alignment, color, and embedded layouts.
|
|
193
|
+
|
|
194
|
+
For example, use `class="justify-end"` on `ui-breadcrumb-list` for RTL alignment or `class="max-w-full"` on the root to fit a constrained header.
|
|
195
|
+
|
|
196
|
+
## Accessibility
|
|
197
|
+
|
|
198
|
+
- Root `<nav>` exposes `aria-label="breadcrumb"`.
|
|
199
|
+
- The current page uses `<span ui-breadcrumb-page>` which emits `role="link"`, `aria-current="page"`, and `aria-disabled="true"` so the trail announces the current location.
|
|
200
|
+
- Separators and ellipses are `aria-hidden` and `role="presentation"`.
|
|
201
|
+
- If `ui-breadcrumb-ellipsis` becomes interactive, wrap it in a labeled button so the overflow action is announced correctly.
|
|
202
|
+
|
|
203
|
+
## Keyboard interactions
|
|
204
|
+
|
|
205
|
+
- Links use native anchor keyboard behavior.
|
|
206
|
+
- Overflow menu buttons rely on the local `ui-button` and `uiMenuTrigger` primitives for Enter, Space, ArrowDown, and Escape handling.
|
|
207
|
+
|
|
208
|
+
## Angular notes
|
|
209
|
+
|
|
210
|
+
- Prefer `<nav ui-breadcrumb>` for a semantic navigation landmark.
|
|
211
|
+
- `<ui-breadcrumb>` is also supported and renders as a block-level host by default.
|
|
212
|
+
- The React `asChild` examples map to Angular-native composition: put `routerLink` or `href` directly on `<a ui-breadcrumb-link>`.
|
|
213
|
+
|
|
214
|
+
## Source parity
|
|
215
|
+
|
|
216
|
+
This Angular implementation follows the shadcn breadcrumb information architecture while translating React-specific patterns such as `asChild` and dropdown composition into Angular RouterLink, button, and menu primitives.
|