@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,160 @@
|
|
|
1
|
+
# Spinner
|
|
2
|
+
|
|
3
|
+
Displays a compact loading indicator for inline status, buttons, badges, input groups, and empty states.
|
|
4
|
+
|
|
5
|
+
Use Spinner when work is in progress but the surrounding layout should stay visible and composable.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { SpinnerComponent } from '@edsis/ui/spinner';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Bring in companion entrypoints such as Button, Badge, Item, Empty, or Input Group only when the surrounding example needs them.
|
|
14
|
+
|
|
15
|
+
## Basic usage
|
|
16
|
+
|
|
17
|
+
By default, `ui-spinner` exposes `role="status"` with an accessible name of `Loading`.
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<ui-spinner aria-label="Loading invoices" />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Common patterns
|
|
24
|
+
|
|
25
|
+
### Size and color
|
|
26
|
+
|
|
27
|
+
Use the `class` input to change size, color, or surrounding spacing.
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<div class="flex items-center gap-4">
|
|
31
|
+
<ui-spinner class="size-3" aria-label="Refreshing alerts" />
|
|
32
|
+
<ui-spinner class="size-4 text-primary" aria-label="Refreshing dashboard" />
|
|
33
|
+
<ui-spinner class="size-6 text-muted-foreground" aria-label="Loading analytics" />
|
|
34
|
+
</div>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Decorative inline status
|
|
38
|
+
|
|
39
|
+
When nearby text already explains the loading state, mark the spinner as decorative so assistive technology does not hear duplicate status announcements.
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<button ui-button type="button" disabled class="gap-2">
|
|
43
|
+
<ui-spinner decorative />
|
|
44
|
+
Loading...
|
|
45
|
+
</button>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Button and badge composition
|
|
49
|
+
|
|
50
|
+
There is no React-style `data-icon` API in the Angular library. Place `ui-spinner` before or after the visible label and use standard gap utilities on the host surface.
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<button ui-button type="button" variant="outline" disabled class="gap-2">
|
|
54
|
+
<ui-spinner decorative />
|
|
55
|
+
Please wait
|
|
56
|
+
</button>
|
|
57
|
+
|
|
58
|
+
<ui-badge class="gap-1.5">
|
|
59
|
+
<ui-spinner decorative class="size-3" />
|
|
60
|
+
Syncing
|
|
61
|
+
</ui-badge>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Item row
|
|
65
|
+
|
|
66
|
+
The upstream preview maps cleanly to the local Item primitive.
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<ui-item variant="muted" class="w-full max-w-xs [--radius:1rem]">
|
|
70
|
+
<ui-item-media>
|
|
71
|
+
<ui-spinner decorative />
|
|
72
|
+
</ui-item-media>
|
|
73
|
+
<ui-item-content>
|
|
74
|
+
<ui-item-title>Processing payment...</ui-item-title>
|
|
75
|
+
</ui-item-content>
|
|
76
|
+
<ui-item-content class="flex-none justify-end">
|
|
77
|
+
<span class="text-sm tabular-nums">$100.00</span>
|
|
78
|
+
</ui-item-content>
|
|
79
|
+
</ui-item>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Input group status
|
|
83
|
+
|
|
84
|
+
Spinner works as projected content inside `ui-input-group-addon` for inline or block-end status rows.
|
|
85
|
+
|
|
86
|
+
```html
|
|
87
|
+
<ui-input-group>
|
|
88
|
+
<input ui-input-group-input placeholder="Send a message..." disabled />
|
|
89
|
+
<ui-input-group-addon align="inline-end">
|
|
90
|
+
<ui-spinner decorative />
|
|
91
|
+
</ui-input-group-addon>
|
|
92
|
+
</ui-input-group>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Empty state
|
|
96
|
+
|
|
97
|
+
Project the spinner into `ui-empty-media` when a request is still processing.
|
|
98
|
+
|
|
99
|
+
```html
|
|
100
|
+
<ui-empty class="w-full max-w-xl rounded-2xl border border-border bg-card/40">
|
|
101
|
+
<ui-empty-header>
|
|
102
|
+
<ui-empty-media variant="icon">
|
|
103
|
+
<ui-spinner decorative class="size-5" />
|
|
104
|
+
</ui-empty-media>
|
|
105
|
+
<ui-empty-title>Processing your request</ui-empty-title>
|
|
106
|
+
<ui-empty-description>Please wait while the operation completes.</ui-empty-description>
|
|
107
|
+
</ui-empty-header>
|
|
108
|
+
</ui-empty>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### RTL
|
|
112
|
+
|
|
113
|
+
Set `dir="rtl"` on the surrounding container or layout shell. The spinner stays direction-agnostic while the surrounding row flips logically.
|
|
114
|
+
|
|
115
|
+
```html
|
|
116
|
+
<section dir="rtl" lang="ar" class="w-full max-w-xs">
|
|
117
|
+
<ui-item variant="muted">
|
|
118
|
+
<ui-item-media>
|
|
119
|
+
<ui-spinner decorative />
|
|
120
|
+
</ui-item-media>
|
|
121
|
+
<ui-item-content>
|
|
122
|
+
<ui-item-title>جاري معالجة الدفع...</ui-item-title>
|
|
123
|
+
</ui-item-content>
|
|
124
|
+
</ui-item>
|
|
125
|
+
</section>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## API reference
|
|
129
|
+
|
|
130
|
+
| Input | Type | Default | Notes |
|
|
131
|
+
| ----------------- | ---------------- | ----------- | ------------------------------------------------------- |
|
|
132
|
+
| `class` | `string` | `''` | Controls size, color, and layout spacing. |
|
|
133
|
+
| `decorative` | `boolean` | `false` | Removes status semantics and sets `aria-hidden="true"`. |
|
|
134
|
+
| `aria-label` | `string` | `'Loading'` | Accessible name when the spinner stands alone. |
|
|
135
|
+
| `aria-labelledby` | `string \| null` | `null` | Connects the spinner to nearby visible text. |
|
|
136
|
+
|
|
137
|
+
Native host attributes such as `id`, `dir`, `data-*`, and custom utility classes still pass through to the rendered custom element.
|
|
138
|
+
|
|
139
|
+
## Styling and theming
|
|
140
|
+
|
|
141
|
+
The spinner inherits `currentColor`, so it automatically matches the surrounding button, badge, item, or muted text color unless a utility overrides it.
|
|
142
|
+
|
|
143
|
+
The default animation uses `animate-spin` and automatically stops under `prefers-reduced-motion`.
|
|
144
|
+
|
|
145
|
+
## Accessibility
|
|
146
|
+
|
|
147
|
+
- Default host is a named `status` element for standalone loading indicators.
|
|
148
|
+
- Set `decorative` when nearby text already announces the loading state.
|
|
149
|
+
- Use `aria-labelledby` instead of a second invisible label when visible copy already exists in the same row.
|
|
150
|
+
- Keep the spinner paired with meaningful text or layout context for passive loading states.
|
|
151
|
+
|
|
152
|
+
## Angular notes
|
|
153
|
+
|
|
154
|
+
- `ui-spinner` is a standalone component with no providers or services.
|
|
155
|
+
- Size and color remain utility-driven instead of introducing React-style variant props.
|
|
156
|
+
- The `decorative` input is the Angular-first way to avoid repeated status announcements inside composed controls.
|
|
157
|
+
|
|
158
|
+
## Source parity
|
|
159
|
+
|
|
160
|
+
This Angular implementation follows the shadcn Spinner page closely for preview, sizing, buttons, badges, input groups, empty states, and RTL composition while translating the API to standalone imports, utility-driven styling, and explicit accessibility bindings.
|
package/switch/README.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
A shadcn-style switch primitive built on Angular Material's `mat-slide-toggle`, with `ControlValueAccessor` support for `ngModel` and reactive forms.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { FormsModule } from '@angular/forms';
|
|
9
|
+
import { SwitchComponent } from '@edsis/ui/switch';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Add `FormsModule` only when the host component uses `ngModel`. Reactive forms work through the same primitive.
|
|
13
|
+
|
|
14
|
+
## Basic usage
|
|
15
|
+
|
|
16
|
+
Use projected content for compact inline labels.
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<ui-switch [(ngModel)]="airplaneMode" name="airplane-mode">Airplane mode</ui-switch>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
For helper text or card-like settings rows, move the copy outside the switch and connect it with `aria-labelledby` plus `aria-describedby`.
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<div class="flex items-start justify-between gap-4 rounded-xl border border-border bg-card/40 p-4">
|
|
26
|
+
<div class="space-y-1">
|
|
27
|
+
<p id="switch-share-label" class="font-medium">Share across devices</p>
|
|
28
|
+
<p id="switch-share-description" class="text-sm leading-5 text-muted-foreground">
|
|
29
|
+
Focus is shared across devices, and turns off when you leave the app.
|
|
30
|
+
</p>
|
|
31
|
+
</div>
|
|
32
|
+
<ui-switch
|
|
33
|
+
[ngModel]="shareAcrossDevices()"
|
|
34
|
+
(ngModelChange)="shareAcrossDevices.set($event)"
|
|
35
|
+
name="share-across-devices"
|
|
36
|
+
aria-labelledby="switch-share-label"
|
|
37
|
+
aria-describedby="switch-share-description" />
|
|
38
|
+
</div>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Reactive forms continue to work through the component's value accessor.
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<ui-switch [formControl]="form.controls.notifications" aria-label="Email notifications" />
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Common patterns
|
|
48
|
+
|
|
49
|
+
### Descriptive settings row
|
|
50
|
+
|
|
51
|
+
Use `aria-labelledby` and `aria-describedby` when the visible copy sits outside the switch.
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<div class="flex items-start justify-between gap-4">
|
|
55
|
+
<div class="space-y-1">
|
|
56
|
+
<p id="setting-label" class="font-medium">Share across devices</p>
|
|
57
|
+
<p id="setting-description" class="text-sm text-muted-foreground">
|
|
58
|
+
Focus is shared across devices, and turns off when you leave the app.
|
|
59
|
+
</p>
|
|
60
|
+
</div>
|
|
61
|
+
<ui-switch
|
|
62
|
+
[ngModel]="shareAcrossDevices()"
|
|
63
|
+
(ngModelChange)="shareAcrossDevices.set($event)"
|
|
64
|
+
name="share-across-devices"
|
|
65
|
+
aria-labelledby="setting-label"
|
|
66
|
+
aria-describedby="setting-description" />
|
|
67
|
+
</div>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Choice card layout
|
|
71
|
+
|
|
72
|
+
The upstream shadcn example wraps the whole field in a clickable label. This Angular primitive keeps the switch as the single interactive control and uses the surrounding card only for layout.
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<div class="rounded-xl border border-border bg-card/40 p-4">
|
|
76
|
+
<div class="flex items-start justify-between gap-4">
|
|
77
|
+
<div class="space-y-1">
|
|
78
|
+
<p id="notifications-label" class="font-medium">Enable notifications</p>
|
|
79
|
+
<p id="notifications-description" class="text-sm text-muted-foreground">
|
|
80
|
+
Receive notifications when focus mode is enabled or disabled.
|
|
81
|
+
</p>
|
|
82
|
+
</div>
|
|
83
|
+
<ui-switch
|
|
84
|
+
[ngModel]="notificationsEnabled()"
|
|
85
|
+
(ngModelChange)="notificationsEnabled.set($event)"
|
|
86
|
+
name="notifications-card"
|
|
87
|
+
aria-labelledby="notifications-label"
|
|
88
|
+
aria-describedby="notifications-description" />
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Invalid state
|
|
94
|
+
|
|
95
|
+
Forward `aria-invalid="true"` when validation should promote the switch into the destructive token set.
|
|
96
|
+
|
|
97
|
+
```html
|
|
98
|
+
<ui-switch
|
|
99
|
+
[ngModel]="acceptTerms()"
|
|
100
|
+
(ngModelChange)="acceptTerms.set($event)"
|
|
101
|
+
name="terms-switch"
|
|
102
|
+
aria-invalid="true"
|
|
103
|
+
aria-label="Accept terms and conditions" />
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Size
|
|
107
|
+
|
|
108
|
+
Use `size="sm"` for denser settings lists and compact preference panes.
|
|
109
|
+
|
|
110
|
+
```html
|
|
111
|
+
<ui-switch size="sm" [(ngModel)]="compactPreference" name="compact-preference">Compact mode</ui-switch>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## API reference
|
|
115
|
+
|
|
116
|
+
| Input | Type | Default | Notes |
|
|
117
|
+
| ------------------ | --------------------------- | -------------- | ------------------------------------------------------------------------- |
|
|
118
|
+
| `id` | `string` | auto-generated | Forwarded to Material; the focusable switch button becomes `<id>-button`. |
|
|
119
|
+
| `name` | `string \| null` | `null` | Forwarded to the underlying switch control. |
|
|
120
|
+
| `disabled` | `boolean` | `false` | Merges with form-driven disabled state. |
|
|
121
|
+
| `required` | `boolean` | `false` | Forwarded to the underlying Material switch. |
|
|
122
|
+
| `aria-label` | `string \| null` | `null` | Use for compact or text-free switch controls. |
|
|
123
|
+
| `aria-describedby` | `string \| null` | `null` | Links helper or error text outside the control. |
|
|
124
|
+
| `aria-labelledby` | `string \| null` | `null` | Best choice for descriptive rows and card layouts. |
|
|
125
|
+
| `aria-invalid` | `boolean \| string \| null` | `null` | Switches the control into the destructive invalid treatment. |
|
|
126
|
+
| `size` | `'default' \| 'sm'` | `'default'` | Smaller track for dense settings lists. |
|
|
127
|
+
| `class` | `string` | `''` | Adds utility classes to the wrapped Material host. |
|
|
128
|
+
|
|
129
|
+
| Output | Payload |
|
|
130
|
+
| --------------- | --------- |
|
|
131
|
+
| `checkedChange` | `boolean` |
|
|
132
|
+
|
|
133
|
+
Public method: `focus()`.
|
|
134
|
+
|
|
135
|
+
## Styling and theming
|
|
136
|
+
|
|
137
|
+
The component uses a Material bridge so the MDC switch structure is restyled with the library theme tokens.
|
|
138
|
+
|
|
139
|
+
- Default track and handle colors use the shared `primary`, `input`, and `background` tokens.
|
|
140
|
+
- `aria-invalid="true"` switches the switch into the destructive token set.
|
|
141
|
+
- `size="sm"` tightens the track and handle sizing without creating a second entrypoint.
|
|
142
|
+
- Pass spacing or alignment utilities through `class` when the switch needs to line up with multi-line content.
|
|
143
|
+
|
|
144
|
+
Additional visual adjustments belong in `switch.component.css` inside the library.
|
|
145
|
+
|
|
146
|
+
## Accessibility
|
|
147
|
+
|
|
148
|
+
- Give the switch an accessible name through projected content, `aria-label`, or `aria-labelledby`.
|
|
149
|
+
- Use `aria-describedby` for helper or error text rendered outside the control.
|
|
150
|
+
- Prefer `aria-labelledby` over `label[for]` when the visible label is external, because Angular Material renders a focusable switch button rather than a labelable text input.
|
|
151
|
+
- `aria-invalid` is forwarded to the underlying Material host for validation styling and assistive technology cues.
|
|
152
|
+
|
|
153
|
+
## Keyboard interactions
|
|
154
|
+
|
|
155
|
+
- `Tab` moves focus to the switch in DOM order.
|
|
156
|
+
- `Space` toggles the checked state.
|
|
157
|
+
|
|
158
|
+
## Angular notes
|
|
159
|
+
|
|
160
|
+
- `ngModel`, reactive forms, and `checkedChange` all work with the same primitive.
|
|
161
|
+
- Passing `id` forwards a stable base id to Angular Material; the focusable button receives the derived `<id>-button` id.
|
|
162
|
+
- The direct `disabled` input and `setDisabledState()` from forms are merged, so either source can disable the control.
|
|
163
|
+
|
|
164
|
+
## Source parity
|
|
165
|
+
|
|
166
|
+
This Angular implementation follows the shadcn Switch examples while translating the upstream Field helpers and clickable-card label pattern into Angular-friendly descriptive containers, ARIA relationships, and signal-friendly state handling.
|
package/table/README.md
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
Responsive native table primitives for invoices, product lists, row actions, and compact data summaries.
|
|
4
|
+
|
|
5
|
+
Use Table when information has real row and column relationships. The Angular primitive keeps shadcn's composition model while preserving semantic `<table>`, `<thead>`, `<tbody>`, `<tfoot>`, `<tr>`, `<th>`, `<td>`, and `<caption>` elements.
|
|
6
|
+
|
|
7
|
+
shadcn's `data-table` guide maps to this entrypoint rather than a separate Angular package surface. Compose Table with the local button, checkbox, input, badge, and dropdown-menu primitives when you need sorting, filtering, row selection, column visibility, row actions, or pagination.
|
|
8
|
+
|
|
9
|
+
## Import
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import {
|
|
13
|
+
TableBodyComponent,
|
|
14
|
+
TableCaptionComponent,
|
|
15
|
+
TableCellComponent,
|
|
16
|
+
TableComponent,
|
|
17
|
+
TableFooterComponent,
|
|
18
|
+
TableHeadComponent,
|
|
19
|
+
TableHeaderComponent,
|
|
20
|
+
TableRowComponent,
|
|
21
|
+
} from '@edsis/ui/table';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Row action menus can compose with the local button and dropdown-menu primitives.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { ButtonComponent } from '@edsis/ui/button';
|
|
28
|
+
import {
|
|
29
|
+
MenuContentDirective,
|
|
30
|
+
MenuItemComponent,
|
|
31
|
+
MenuSeparatorComponent,
|
|
32
|
+
MenuSurfaceComponent,
|
|
33
|
+
MenuTriggerDirective,
|
|
34
|
+
} from '@edsis/ui/dropdown-menu';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Composition
|
|
38
|
+
|
|
39
|
+
Apply the attribute-selector parts to the matching semantic table tags.
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
ui-table
|
|
43
|
+
|-- caption[ui-table-caption]
|
|
44
|
+
|-- thead[ui-table-header]
|
|
45
|
+
| `-- tr[ui-table-row]
|
|
46
|
+
| |-- th[ui-table-head]
|
|
47
|
+
| |-- th[ui-table-head]
|
|
48
|
+
| |-- th[ui-table-head]
|
|
49
|
+
| `-- th[ui-table-head]
|
|
50
|
+
|-- tbody[ui-table-body]
|
|
51
|
+
| `-- tr[ui-table-row]
|
|
52
|
+
| |-- td[ui-table-cell]
|
|
53
|
+
| |-- td[ui-table-cell]
|
|
54
|
+
| |-- td[ui-table-cell]
|
|
55
|
+
| `-- td[ui-table-cell]
|
|
56
|
+
`-- tfoot[ui-table-footer]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
Use `ui-table` as the responsive wrapper. Bind rows with Angular control flow and stable tracking.
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<ui-table>
|
|
65
|
+
<caption ui-table-caption>
|
|
66
|
+
A list of your recent invoices.
|
|
67
|
+
</caption>
|
|
68
|
+
<thead ui-table-header>
|
|
69
|
+
<tr ui-table-row>
|
|
70
|
+
<th ui-table-head class="w-25">Invoice</th>
|
|
71
|
+
<th ui-table-head>Status</th>
|
|
72
|
+
<th ui-table-head>Method</th>
|
|
73
|
+
<th ui-table-head class="text-right">Amount</th>
|
|
74
|
+
</tr>
|
|
75
|
+
</thead>
|
|
76
|
+
<tbody ui-table-body>
|
|
77
|
+
@for (invoice of invoices; track invoice.invoice) {
|
|
78
|
+
<tr ui-table-row>
|
|
79
|
+
<td ui-table-cell class="font-medium">{{ invoice.invoice }}</td>
|
|
80
|
+
<td ui-table-cell>{{ invoice.status }}</td>
|
|
81
|
+
<td ui-table-cell>{{ invoice.method }}</td>
|
|
82
|
+
<td ui-table-cell class="text-right">{{ invoice.amount }}</td>
|
|
83
|
+
</tr>
|
|
84
|
+
}
|
|
85
|
+
</tbody>
|
|
86
|
+
</ui-table>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Common patterns
|
|
90
|
+
|
|
91
|
+
### Footer totals
|
|
92
|
+
|
|
93
|
+
Use `tfoot[ui-table-footer]` for totals and summaries. `colspan` stays on the native `td`.
|
|
94
|
+
|
|
95
|
+
```html
|
|
96
|
+
<ui-table>
|
|
97
|
+
<caption ui-table-caption>
|
|
98
|
+
A list of your recent invoices.
|
|
99
|
+
</caption>
|
|
100
|
+
<thead ui-table-header>
|
|
101
|
+
...
|
|
102
|
+
</thead>
|
|
103
|
+
<tbody ui-table-body>
|
|
104
|
+
...
|
|
105
|
+
</tbody>
|
|
106
|
+
<tfoot ui-table-footer>
|
|
107
|
+
<tr ui-table-row>
|
|
108
|
+
<td ui-table-cell colspan="3">Total</td>
|
|
109
|
+
<td ui-table-cell class="text-right">$2,500.00</td>
|
|
110
|
+
</tr>
|
|
111
|
+
</tfoot>
|
|
112
|
+
</ui-table>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Row actions
|
|
116
|
+
|
|
117
|
+
Compose action menus with `ui-button`, `uiMenuTrigger`, and the dropdown-menu surface.
|
|
118
|
+
|
|
119
|
+
```html
|
|
120
|
+
<ng-template uiMenuContent #productActionsMenu="uiMenuContent">
|
|
121
|
+
<ui-menu-surface class="w-36">
|
|
122
|
+
<button ui-menu-item>Edit</button>
|
|
123
|
+
<button ui-menu-item>Duplicate</button>
|
|
124
|
+
<ui-menu-separator />
|
|
125
|
+
<button ui-menu-item variant="destructive">Delete</button>
|
|
126
|
+
</ui-menu-surface>
|
|
127
|
+
</ng-template>
|
|
128
|
+
|
|
129
|
+
<ui-table>
|
|
130
|
+
<thead ui-table-header>
|
|
131
|
+
<tr ui-table-row>
|
|
132
|
+
<th ui-table-head>Product</th>
|
|
133
|
+
<th ui-table-head>Price</th>
|
|
134
|
+
<th ui-table-head class="text-right">Actions</th>
|
|
135
|
+
</tr>
|
|
136
|
+
</thead>
|
|
137
|
+
<tbody ui-table-body>
|
|
138
|
+
@for (product of products; track product.name) {
|
|
139
|
+
<tr ui-table-row>
|
|
140
|
+
<td ui-table-cell class="font-medium">{{ product.name }}</td>
|
|
141
|
+
<td ui-table-cell>{{ product.price }}</td>
|
|
142
|
+
<td ui-table-cell class="text-right">
|
|
143
|
+
<button
|
|
144
|
+
ui-button
|
|
145
|
+
type="button"
|
|
146
|
+
variant="ghost"
|
|
147
|
+
size="icon-sm"
|
|
148
|
+
[attr.aria-label]="'Open actions for ' + product.name"
|
|
149
|
+
[uiMenuTrigger]="productActionsMenu">
|
|
150
|
+
<span aria-hidden="true">...</span>
|
|
151
|
+
</button>
|
|
152
|
+
</td>
|
|
153
|
+
</tr>
|
|
154
|
+
}
|
|
155
|
+
</tbody>
|
|
156
|
+
</ui-table>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Data table guide mapping
|
|
160
|
+
|
|
161
|
+
The upstream shadcn `data-table` page is a composition guide, not a standalone primitive. In this Angular library the same guidance starts with `@edsis/ui/table` and layers behavior around it.
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
import { BadgeComponent } from '@edsis/ui/badge';
|
|
165
|
+
import { ButtonComponent } from '@edsis/ui/button';
|
|
166
|
+
import { CheckboxComponent } from '@edsis/ui/checkbox';
|
|
167
|
+
import {
|
|
168
|
+
MenuCheckboxItemComponent,
|
|
169
|
+
MenuContentDirective,
|
|
170
|
+
MenuGroupComponent,
|
|
171
|
+
MenuItemComponent,
|
|
172
|
+
MenuLabelComponent,
|
|
173
|
+
MenuSeparatorComponent,
|
|
174
|
+
MenuSurfaceComponent,
|
|
175
|
+
MenuTriggerDirective,
|
|
176
|
+
} from '@edsis/ui/dropdown-menu';
|
|
177
|
+
import { InputComponent } from '@edsis/ui/input';
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Keep Table as the markup layer and put behavior in Angular signals, services, or a table state library. A small explicit pipeline is usually easier to maintain than a generic catch-all data-table wrapper.
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
readonly filterText = signal('');
|
|
184
|
+
readonly sortState = signal<{ column: 'status' | 'email' | 'amount'; direction: 'asc' | 'desc' } | null>(null);
|
|
185
|
+
readonly selectedIds = signal<ReadonlySet<string>>(new Set());
|
|
186
|
+
|
|
187
|
+
readonly filteredRows = computed(() => {
|
|
188
|
+
const query = filterText().trim().toLowerCase();
|
|
189
|
+
return query ? rows.filter((row) => row.email.toLowerCase().includes(query)) : rows;
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
readonly sortedRows = computed(() => sortRows(filteredRows(), sortState()));
|
|
193
|
+
readonly pageRows = computed(() => paginateRows(sortedRows(), currentPage(), pageSize));
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Selected rows can use the shadcn-compatible `data-state="selected"` hook so row styling stays synchronized with the checkbox state.
|
|
197
|
+
|
|
198
|
+
```html
|
|
199
|
+
<ui-table>
|
|
200
|
+
<thead ui-table-header>
|
|
201
|
+
...
|
|
202
|
+
</thead>
|
|
203
|
+
<tbody ui-table-body>
|
|
204
|
+
@for (row of filteredRows(); track row.id) {
|
|
205
|
+
<tr ui-table-row [attr.data-state]="selectedIds().has(row.id) ? 'selected' : null">
|
|
206
|
+
<td ui-table-cell>{{ row.title }}</td>
|
|
207
|
+
<td ui-table-cell>{{ row.status }}</td>
|
|
208
|
+
<td ui-table-cell class="text-right">{{ row.amount }}</td>
|
|
209
|
+
</tr>
|
|
210
|
+
}
|
|
211
|
+
</tbody>
|
|
212
|
+
</ui-table>
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### RTL
|
|
216
|
+
|
|
217
|
+
Set direction on a wrapper or directly on `ui-table`. Keep alignment explicit for amount and numeric columns.
|
|
218
|
+
|
|
219
|
+
```html
|
|
220
|
+
<div dir="rtl" lang="ar" class="text-right">
|
|
221
|
+
<ui-table>
|
|
222
|
+
<caption ui-table-caption>
|
|
223
|
+
قائمة بفواتيرك الأخيرة.
|
|
224
|
+
</caption>
|
|
225
|
+
<thead ui-table-header>
|
|
226
|
+
<tr ui-table-row>
|
|
227
|
+
<th ui-table-head class="w-25 text-right">الفاتورة</th>
|
|
228
|
+
<th ui-table-head class="text-right">الحالة</th>
|
|
229
|
+
<th ui-table-head class="text-right">الطريقة</th>
|
|
230
|
+
<th ui-table-head class="text-right">المبلغ</th>
|
|
231
|
+
</tr>
|
|
232
|
+
</thead>
|
|
233
|
+
<tbody ui-table-body>
|
|
234
|
+
...
|
|
235
|
+
</tbody>
|
|
236
|
+
</ui-table>
|
|
237
|
+
</div>
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
## API reference
|
|
241
|
+
|
|
242
|
+
### `TableComponent`
|
|
243
|
+
|
|
244
|
+
| Input | Type | Default | Description |
|
|
245
|
+
| ------- | -------- | ------- | ------------------------------------------------- |
|
|
246
|
+
| `class` | `string` | `''` | Classes applied to the rendered native `<table>`. |
|
|
247
|
+
|
|
248
|
+
### Attribute parts
|
|
249
|
+
|
|
250
|
+
| Part | Selector | Input | Notes |
|
|
251
|
+
| ----------------------- | --------------------------- | ------- | ------------------------------------------------------- |
|
|
252
|
+
| `TableCaptionComponent` | `caption[ui-table-caption]` | `class` | Muted caption below the table. |
|
|
253
|
+
| `TableHeaderComponent` | `thead[ui-table-header]` | `class` | Header section with row dividers. |
|
|
254
|
+
| `TableBodyComponent` | `tbody[ui-table-body]` | `class` | Body section that removes the final row border. |
|
|
255
|
+
| `TableFooterComponent` | `tfoot[ui-table-footer]` | `class` | Footer section with muted background and top divider. |
|
|
256
|
+
| `TableRowComponent` | `tr[ui-table-row]` | `class` | Row hover state and `data-state="selected"` support. |
|
|
257
|
+
| `TableHeadComponent` | `th[ui-table-head]` | `class` | Header cell with muted foreground and nowrap text. |
|
|
258
|
+
| `TableCellComponent` | `td[ui-table-cell]` | `class` | Body or footer cell with compact padding and alignment. |
|
|
259
|
+
|
|
260
|
+
## Styling and theming
|
|
261
|
+
|
|
262
|
+
The root host is `relative block w-full overflow-x-auto`; the rendered table is `w-full caption-bottom text-sm`.
|
|
263
|
+
|
|
264
|
+
Dividers use the shared `border-border` token, row hover uses `hover:bg-muted/50`, footer uses `bg-muted/50`, and selected rows respond to `data-state="selected"` with `bg-muted`.
|
|
265
|
+
|
|
266
|
+
Pass utility classes to individual parts for column width, alignment, density, responsive visibility, and typography.
|
|
267
|
+
|
|
268
|
+
## Accessibility
|
|
269
|
+
|
|
270
|
+
- Use a `<caption ui-table-caption>` when the table conveys meaningful data.
|
|
271
|
+
- Keep column headers in native `<th ui-table-head>` cells so screen readers can announce header relationships.
|
|
272
|
+
- Use `scope`, `colspan`, `rowspan`, and `aria-sort` on native cells when your data model needs them.
|
|
273
|
+
- Do not use Table for non-tabular layout. Use CSS grid or flex layouts for purely visual alignment.
|
|
274
|
+
|
|
275
|
+
## Keyboard interactions
|
|
276
|
+
|
|
277
|
+
Static tables do not add custom keyboard behavior. Focusable controls inside cells, such as action menu buttons, keep their own native or primitive-provided keyboard behavior.
|
|
278
|
+
|
|
279
|
+
When composing a row menu, the trigger uses native button activation and the local menu handles Arrow Up, Arrow Down, Home, End, Tab dismissal, and typeahead.
|
|
280
|
+
|
|
281
|
+
## Angular notes
|
|
282
|
+
|
|
283
|
+
- All table parts are standalone components and can be imported directly.
|
|
284
|
+
- The root `ui-table` wraps projected content in a native `<table>`, so child parts should be direct table descendants in normal HTML order.
|
|
285
|
+
- Prefer Angular `@for` with a stable `track` expression for row rendering.
|
|
286
|
+
- Keep sorting, filtering, pagination, and selection state outside the primitive; Table is intentionally presentational.
|
|
287
|
+
- Attribute-selector primitives must be applied to their semantic tag, for example `th[ui-table-head]` and `td[ui-table-cell]`.
|
|
288
|
+
|
|
289
|
+
## Source parity
|
|
290
|
+
|
|
291
|
+
This Angular implementation follows the shadcn Table docs for preview, usage, composition, footer, actions, data-table guidance, and RTL. React component names map to Angular selectors, React `className` maps to `class`, and row action menus compose with the local Angular dropdown-menu primitives.
|