@unframed/cli 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/skill/unframed/SKILL.md
CHANGED
|
@@ -5,7 +5,7 @@ description: Builds UI with Unframed web components (@unframed/core, @unframed/r
|
|
|
5
5
|
|
|
6
6
|
# Unframed UI
|
|
7
7
|
|
|
8
|
-
Unframed 0.
|
|
8
|
+
Unframed 0.8.0: accessible UI components as standard custom elements (Lit). Every tag starts with `uf-`. They work in plain HTML and every framework; React, Vue and Angular have wrapper packages for typed props, events and form bindings.
|
|
9
9
|
|
|
10
10
|
## Before writing code
|
|
11
11
|
|
|
@@ -37,19 +37,24 @@ Unframed 0.7.0: accessible UI components as standard custom elements (Lit). Ever
|
|
|
37
37
|
| Accordion: A stack of sections that expand and collapse. | `<uf-accordion>` `<uf-accordion-item>` | `@unframed/core/accordion` |
|
|
38
38
|
| Avatar: Shows a person's picture, initials or icon. | `<uf-avatar>` | `@unframed/core/avatar` |
|
|
39
39
|
| Badge: Labels a status, a category or a count. | `<uf-badge>` | `@unframed/core/badge` |
|
|
40
|
+
| Breadcrumbs: Shows the path to the current page. | `<uf-breadcrumbs>` `<uf-breadcrumb-item>` | `@unframed/core/breadcrumbs` |
|
|
40
41
|
| Button: Triggers an action or navigates to a URL. | `<uf-button>` | `@unframed/core/button` |
|
|
41
42
|
| Card: Groups related content and actions. | `<uf-card>` | `@unframed/core/card` |
|
|
42
43
|
| Checkbox: Lets users turn an option on or off, or pick several options. | `<uf-checkbox>` `<uf-checkbox-group>` | `@unframed/core/checkbox` `@unframed/core/checkbox-group` |
|
|
43
44
|
| Combobox: Lets users search a list and pick one option. | `<uf-combobox>` | `@unframed/core/combobox` |
|
|
44
45
|
| Date picker: Lets users type or pick a date. | `<uf-date-picker>` `<uf-calendar>` | `@unframed/core/date-picker` `@unframed/core/calendar` |
|
|
45
46
|
| Dialog: Shows content in a modal window on top of the page. | `<uf-dialog>` | `@unframed/core/dialog` |
|
|
47
|
+
| Drawer: A panel that slides in from an edge of the screen. | `<uf-drawer>` | `@unframed/core/drawer` |
|
|
46
48
|
| Dropdown menu: Opens a menu of actions from a button. | `<uf-dropdown>` `<uf-menu>` `<uf-menu-item>` | `@unframed/core/dropdown` `@unframed/core/menu` |
|
|
47
49
|
| Icon: Shows a small symbol. | `<uf-icon>` | `@unframed/core/icon` |
|
|
48
50
|
| Input: Lets users enter a single line of text. | `<uf-input>` | `@unframed/core/input` |
|
|
49
51
|
| Pagination: Moves between the pages of a long list. | `<uf-pagination>` | `@unframed/core/pagination` |
|
|
50
52
|
| Popover: Shows floating content next to a trigger. | `<uf-popover>` | `@unframed/core/popover` |
|
|
53
|
+
| Progress: Shows how far a task has got. | `<uf-progress>` | `@unframed/core/progress` |
|
|
51
54
|
| Radio group: Lets users pick exactly one option from a list. | `<uf-radio-group>` `<uf-radio>` | `@unframed/core/radio-group` `@unframed/core/radio` |
|
|
52
55
|
| Select: Lets users pick one option from a dropdown list. | `<uf-select>` | `@unframed/core/select` |
|
|
56
|
+
| Slider: Lets users pick a number in a range. | `<uf-slider>` | `@unframed/core/slider` |
|
|
57
|
+
| Spinner: Shows that something is loading. | `<uf-spinner>` | `@unframed/core/spinner` |
|
|
53
58
|
| Switch: Turns a setting on or off. | `<uf-switch>` | `@unframed/core/switch` |
|
|
54
59
|
| Table: Shows data in rows and columns, with sorting. | `<uf-table>` | `@unframed/core/table` |
|
|
55
60
|
| Tabs: Organizes content into panels, one visible at a time. | `<uf-tabs>` `<uf-tab>` `<uf-tab-panel>` | `@unframed/core/tabs` |
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Unframed 0.
|
|
1
|
+
# Unframed 0.8.0 components
|
|
2
2
|
|
|
3
3
|
## Accordion
|
|
4
4
|
|
|
@@ -233,6 +233,92 @@ Six colors by meaning, in three appearances: `soft` (the default), `solid` and `
|
|
|
233
233
|
| `--uf-badge-border-color` | Border color. |
|
|
234
234
|
| `--uf-badge-radius` | Corner radius. Use `999px` for a pill. |
|
|
235
235
|
|
|
236
|
+
## Breadcrumbs
|
|
237
|
+
|
|
238
|
+
Shows where the current page sits in the site: a trail of links, from the
|
|
239
|
+
top level to here. It's a navigation landmark with a list inside, and the
|
|
240
|
+
last item is marked as the current page.
|
|
241
|
+
|
|
242
|
+
Tags: `<uf-breadcrumbs>`, `<uf-breadcrumb-item>`. Import: `import '@unframed/core/breadcrumbs';` (or `npx @unframed/cli add breadcrumbs` to copy the source).
|
|
243
|
+
|
|
244
|
+
### Basic
|
|
245
|
+
|
|
246
|
+
The last item is the current page: it is not a link, and screen readers announce it as the current page.
|
|
247
|
+
|
|
248
|
+
```html
|
|
249
|
+
<uf-breadcrumbs>
|
|
250
|
+
<uf-breadcrumb-item href="/">Home</uf-breadcrumb-item>
|
|
251
|
+
<uf-breadcrumb-item href="/docs">Docs</uf-breadcrumb-item>
|
|
252
|
+
<uf-breadcrumb-item>Theming</uf-breadcrumb-item>
|
|
253
|
+
</uf-breadcrumbs>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
- It is a navigation landmark named "Breadcrumb" (translatable), or `label`. Name it differently if a page has two.
|
|
257
|
+
- Separators are hidden from screen readers, which announce the trail as a list.
|
|
258
|
+
|
|
259
|
+
### Custom separator and an icon
|
|
260
|
+
|
|
261
|
+
Put any element in the `separator` slot: it is copied between the items.
|
|
262
|
+
|
|
263
|
+
```html
|
|
264
|
+
<uf-breadcrumbs>
|
|
265
|
+
<span slot="separator">/</span>
|
|
266
|
+
<uf-breadcrumb-item href="/people/john-smith">
|
|
267
|
+
<uf-icon slot="prefix" name="user"></uf-icon>John Smith
|
|
268
|
+
</uf-breadcrumb-item>
|
|
269
|
+
<uf-breadcrumb-item href="/people/john-smith/projects">Projects</uf-breadcrumb-item>
|
|
270
|
+
<uf-breadcrumb-item>Website redesign</uf-breadcrumb-item>
|
|
271
|
+
</uf-breadcrumbs>
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### `<uf-breadcrumbs>` API
|
|
275
|
+
|
|
276
|
+
#### Attributes and properties
|
|
277
|
+
|
|
278
|
+
| Attribute | Property | Type | Default | Description |
|
|
279
|
+
|---|---|---|---|---|
|
|
280
|
+
| `label` | | `string \| undefined` | | Accessible name of the navigation. Defaults to "Breadcrumb", in the page's language. |
|
|
281
|
+
|
|
282
|
+
#### Slots
|
|
283
|
+
|
|
284
|
+
| Slot | Description |
|
|
285
|
+
|---|---|
|
|
286
|
+
| (default) | `<uf-breadcrumb-item>` elements. |
|
|
287
|
+
| `separator` | A custom separator, e.g. `<span slot="separator">/</span>`. Copied between the items. |
|
|
288
|
+
|
|
289
|
+
#### CSS parts
|
|
290
|
+
|
|
291
|
+
| Part | Description |
|
|
292
|
+
|---|---|
|
|
293
|
+
| `base` | The `<nav>` element. |
|
|
294
|
+
| `list` | The list of items. |
|
|
295
|
+
|
|
296
|
+
### `<uf-breadcrumb-item>` API
|
|
297
|
+
|
|
298
|
+
#### Attributes and properties
|
|
299
|
+
|
|
300
|
+
| Attribute | Property | Type | Default | Description |
|
|
301
|
+
|---|---|---|---|---|
|
|
302
|
+
| `href` | | `string \| undefined` | | Link to this step. |
|
|
303
|
+
| `target` | | `string \| undefined` | | Link target, used with `href`. |
|
|
304
|
+
| `current` | | `boolean` | `false` | The current page. `<uf-breadcrumbs>` sets it on the last item. |
|
|
305
|
+
|
|
306
|
+
#### Slots
|
|
307
|
+
|
|
308
|
+
| Slot | Description |
|
|
309
|
+
|---|---|
|
|
310
|
+
| (default) | The label. |
|
|
311
|
+
| `prefix` | An icon before the label. |
|
|
312
|
+
| `separator` | Set by `<uf-breadcrumbs>`; you don't need it yourself. |
|
|
313
|
+
|
|
314
|
+
#### CSS parts
|
|
315
|
+
|
|
316
|
+
| Part | Description |
|
|
317
|
+
|---|---|
|
|
318
|
+
| `link` | The link, for items with `href`. |
|
|
319
|
+
| `label` | The current page's label, or an item without `href`. |
|
|
320
|
+
| `separator` | The separator after the item. |
|
|
321
|
+
|
|
236
322
|
## Button
|
|
237
323
|
|
|
238
324
|
A button that works like a native `<button>`, inside or outside a form,
|
|
@@ -902,6 +988,102 @@ Escape, the close button and any element with `data-dialog="close"` close it.
|
|
|
902
988
|
| `--uf-dialog-radius` | Corner radius. |
|
|
903
989
|
| `--uf-dialog-backdrop` | Backdrop color. |
|
|
904
990
|
|
|
991
|
+
## Drawer
|
|
992
|
+
|
|
993
|
+
A panel that slides in from an edge of the screen, for navigation, filters or
|
|
994
|
+
details. It is a modal dialog, so it behaves like `<uf-dialog>`: it traps
|
|
995
|
+
focus, makes the page inert, closes with Escape, and returns focus to the
|
|
996
|
+
opener. Any element inside with `data-dialog="close"` closes it.
|
|
997
|
+
|
|
998
|
+
Tags: `<uf-drawer>`. Import: `import '@unframed/core/drawer';` (or `npx @unframed/cli add drawer` to copy the source).
|
|
999
|
+
|
|
1000
|
+
### Filters
|
|
1001
|
+
|
|
1002
|
+
A modal panel from the end edge. Escape, the close button and any element with `data-dialog="close"` close it.
|
|
1003
|
+
|
|
1004
|
+
```html
|
|
1005
|
+
<uf-button variant="outline" onclick="this.nextElementSibling.show()">Filters</uf-button>
|
|
1006
|
+
<uf-drawer label="Filters" light-dismiss>
|
|
1007
|
+
<uf-checkbox-group label="Status">
|
|
1008
|
+
<uf-checkbox value="open">Open</uf-checkbox>
|
|
1009
|
+
<uf-checkbox value="closed">Closed</uf-checkbox>
|
|
1010
|
+
</uf-checkbox-group>
|
|
1011
|
+
<uf-button slot="footer" variant="ghost" data-dialog="close">Cancel</uf-button>
|
|
1012
|
+
<uf-button slot="footer" data-dialog="close">Apply</uf-button>
|
|
1013
|
+
</uf-drawer>
|
|
1014
|
+
```
|
|
1015
|
+
|
|
1016
|
+
- It is a modal dialog: focus stays inside, the page behind is inert and does not scroll, and focus returns to the button on close.
|
|
1017
|
+
|
|
1018
|
+
### Placement
|
|
1019
|
+
|
|
1020
|
+
`start`, `end` (the default), `top` or `bottom`. Start and end follow the page direction. `--uf-drawer-size` sets the width, or the height for top and bottom.
|
|
1021
|
+
|
|
1022
|
+
```html
|
|
1023
|
+
<uf-drawer label="Menu" placement="start">…</uf-drawer>
|
|
1024
|
+
<uf-drawer label="Cart" placement="end" style="--uf-drawer-size: 28rem">…</uf-drawer>
|
|
1025
|
+
<uf-drawer label="Cookies" placement="bottom">…</uf-drawer>
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
### `<uf-drawer>` API
|
|
1029
|
+
|
|
1030
|
+
#### Attributes and properties
|
|
1031
|
+
|
|
1032
|
+
| Attribute | Property | Type | Default | Description |
|
|
1033
|
+
|---|---|---|---|---|
|
|
1034
|
+
| `placement` | | `DrawerPlacement` | `'end'` | The edge it slides in from: `start` (left, in left-to-right pages), `end`, `top` or `bottom`. |
|
|
1035
|
+
| `open` | | `boolean` | `false` | Whether the dialog is open. |
|
|
1036
|
+
| `label` | | `string \| undefined` | | Title of the dialog, also its accessible name. |
|
|
1037
|
+
| `light-dismiss` | `lightDismiss` | `boolean` | `false` | Closes the dialog when the backdrop is clicked. |
|
|
1038
|
+
| `without-header` | `withoutHeader` | `boolean` | `false` | Hides the header. Set `label` anyway, so the dialog keeps an accessible name. |
|
|
1039
|
+
|
|
1040
|
+
#### Methods
|
|
1041
|
+
|
|
1042
|
+
| Method | Description |
|
|
1043
|
+
|---|---|
|
|
1044
|
+
| `show()` | Opens the dialog. |
|
|
1045
|
+
| `hide()` | Closes the dialog, without firing `uf-request-close`. |
|
|
1046
|
+
| `requestClose(source?: DialogCloseSource)` | Asks to close, as a user action would. Listeners can cancel it. |
|
|
1047
|
+
|
|
1048
|
+
#### Events
|
|
1049
|
+
|
|
1050
|
+
| Event | Type | Description |
|
|
1051
|
+
|---|---|---|
|
|
1052
|
+
| `uf-show` | `Event` | The drawer opened. |
|
|
1053
|
+
| `uf-hide` | `Event` | The drawer closed. |
|
|
1054
|
+
| `uf-request-close` | `CustomEvent<DialogRequestCloseDetail>` | The user tried to close the drawer. Call `preventDefault()` to keep it open. |
|
|
1055
|
+
|
|
1056
|
+
#### Slots
|
|
1057
|
+
|
|
1058
|
+
| Slot | Description |
|
|
1059
|
+
|---|---|
|
|
1060
|
+
| (default) | The drawer content. |
|
|
1061
|
+
| `label` | The title, when you need markup. Overrides `label`. |
|
|
1062
|
+
| `header-actions` | Extra buttons next to the close button. |
|
|
1063
|
+
| `footer` | Actions at the bottom, usually buttons. |
|
|
1064
|
+
|
|
1065
|
+
#### CSS parts
|
|
1066
|
+
|
|
1067
|
+
| Part | Description |
|
|
1068
|
+
|---|---|
|
|
1069
|
+
| `dialog` | The native `<dialog>`. |
|
|
1070
|
+
| `header` | The header with title and close button. |
|
|
1071
|
+
| `title` | The title. |
|
|
1072
|
+
| `close-button` | The close button. |
|
|
1073
|
+
| `body` | The content area. |
|
|
1074
|
+
| `footer` | The footer. |
|
|
1075
|
+
|
|
1076
|
+
#### CSS custom properties
|
|
1077
|
+
|
|
1078
|
+
| Property | Description |
|
|
1079
|
+
|---|---|
|
|
1080
|
+
| `--uf-drawer-size` | Width of a side drawer, or height of a top or bottom one. Defaults to `24rem`. |
|
|
1081
|
+
| `--uf-dialog-bg` | Background of the drawer. |
|
|
1082
|
+
| `--uf-dialog-padding` | Padding of header, body and footer. |
|
|
1083
|
+
| `--uf-dialog-backdrop` | Backdrop color. |
|
|
1084
|
+
| `--uf-dialog-width` | Width of the dialog. Defaults to `32rem`. |
|
|
1085
|
+
| `--uf-dialog-radius` | Corner radius. |
|
|
1086
|
+
|
|
905
1087
|
## Dropdown menu
|
|
906
1088
|
|
|
907
1089
|
A button that opens a `<uf-menu>`, following the WAI-ARIA menu button
|
|
@@ -1322,6 +1504,72 @@ Tags: `<uf-popover>`. Import: `import '@unframed/core/popover';` (or `npx @unfra
|
|
|
1322
1504
|
| `--uf-popover-padding` | Padding of the panel. |
|
|
1323
1505
|
| `--uf-popover-width` | Width of the panel. Defaults to its content. |
|
|
1324
1506
|
|
|
1507
|
+
## Progress
|
|
1508
|
+
|
|
1509
|
+
A bar that shows how far a task has got. Without a `value` it's
|
|
1510
|
+
indeterminate: an animated bar for work whose length isn't known, like a
|
|
1511
|
+
native `<progress>`.
|
|
1512
|
+
|
|
1513
|
+
Tags: `<uf-progress>`. Import: `import '@unframed/core/progress';` (or `npx @unframed/cli add progress` to copy the source).
|
|
1514
|
+
|
|
1515
|
+
### Value
|
|
1516
|
+
|
|
1517
|
+
`value` out of `max` (100 by default). `show-value` adds the percentage.
|
|
1518
|
+
|
|
1519
|
+
```html
|
|
1520
|
+
<uf-progress label="Uploading report.pdf" value="45" show-value></uf-progress>
|
|
1521
|
+
<uf-progress label="Storage" value="92" variant="warning" show-value></uf-progress>
|
|
1522
|
+
<uf-progress label="Profile complete" value="5" max="5" variant="success" size="sm"></uf-progress>
|
|
1523
|
+
```
|
|
1524
|
+
|
|
1525
|
+
- Screen readers announce it as a progress bar with its label and percentage. Without a `label`, it is named "Progress" (translatable).
|
|
1526
|
+
|
|
1527
|
+
### Indeterminate
|
|
1528
|
+
|
|
1529
|
+
Leave out `value` when the length of the work is not known.
|
|
1530
|
+
|
|
1531
|
+
```html
|
|
1532
|
+
<uf-progress label="Preparing your export"></uf-progress>
|
|
1533
|
+
```
|
|
1534
|
+
|
|
1535
|
+
### `<uf-progress>` API
|
|
1536
|
+
|
|
1537
|
+
#### Attributes and properties
|
|
1538
|
+
|
|
1539
|
+
| Attribute | Property | Type | Default | Description |
|
|
1540
|
+
|---|---|---|---|---|
|
|
1541
|
+
| `value` | | `number \| undefined` | | Progress so far, from 0 to `max`. Leave it out for an indeterminate bar. |
|
|
1542
|
+
| `max` | | `number` | `100` | The value that means done. |
|
|
1543
|
+
| `label` | | `string \| undefined` | | Visible label, also the bar's accessible name. Without one, it's named "Progress". |
|
|
1544
|
+
| `show-value` | `showValue` | `boolean` | `false` | Shows the percentage next to the label. |
|
|
1545
|
+
| `variant` | | `ProgressVariant` | `'accent'` | Color, by meaning: `accent`, `success`, `warning` or `danger`. |
|
|
1546
|
+
| `size` | | `ProgressSize` | `'md'` | Height of the bar: `sm` or `md`. |
|
|
1547
|
+
|
|
1548
|
+
#### Slots
|
|
1549
|
+
|
|
1550
|
+
| Slot | Description |
|
|
1551
|
+
|---|---|
|
|
1552
|
+
| `label` | The label, when you need markup. Overrides `label`. |
|
|
1553
|
+
|
|
1554
|
+
#### CSS parts
|
|
1555
|
+
|
|
1556
|
+
| Part | Description |
|
|
1557
|
+
|---|---|
|
|
1558
|
+
| `base` | The wrapper around label and bar. |
|
|
1559
|
+
| `label` | The label. |
|
|
1560
|
+
| `value` | The percentage, when `show-value` is set. |
|
|
1561
|
+
| `track` | The bar's background. |
|
|
1562
|
+
| `indicator` | The filled part of the bar. |
|
|
1563
|
+
|
|
1564
|
+
#### CSS custom properties
|
|
1565
|
+
|
|
1566
|
+
| Property | Description |
|
|
1567
|
+
|---|---|
|
|
1568
|
+
| `--uf-progress-height` | Height of the bar. |
|
|
1569
|
+
| `--uf-progress-radius` | Corner radius of the bar. Use `999px` for a pill. |
|
|
1570
|
+
| `--uf-progress-track-color` | Color of the bar's background. |
|
|
1571
|
+
| `--uf-progress-indicator-color` | Color of the filled part. |
|
|
1572
|
+
|
|
1325
1573
|
## Radio group
|
|
1326
1574
|
|
|
1327
1575
|
A group of `<uf-radio>` options with one selected value. Arrow keys move
|
|
@@ -1523,6 +1771,154 @@ Built on the native `<select>`: write plain `<option>` and `<optgroup>` children
|
|
|
1523
1771
|
| `--uf-field-border-color` | Border color of the box. |
|
|
1524
1772
|
| `--uf-field-radius` | Corner radius of the box. |
|
|
1525
1773
|
|
|
1774
|
+
## Slider
|
|
1775
|
+
|
|
1776
|
+
Picks a number in a range by dragging a handle, or with the arrow keys. Built
|
|
1777
|
+
on the native range input, so keyboard, touch and screen readers work as
|
|
1778
|
+
they do everywhere; it submits its value with the form.
|
|
1779
|
+
|
|
1780
|
+
Tags: `<uf-slider>`. Import: `import '@unframed/core/slider';` (or `npx @unframed/cli add slider` to copy the source).
|
|
1781
|
+
|
|
1782
|
+
### Basic
|
|
1783
|
+
|
|
1784
|
+
A native range input underneath: arrow keys, Page Up/Down, Home and End, touch, and screen readers work as everywhere.
|
|
1785
|
+
|
|
1786
|
+
```html
|
|
1787
|
+
<uf-slider name="volume" label="Volume" hint="Applies to every device" value="40" show-value></uf-slider>
|
|
1788
|
+
```
|
|
1789
|
+
|
|
1790
|
+
- The value is a number. It submits with its form, and `input` fires while dragging, `change` when the user lets go.
|
|
1791
|
+
|
|
1792
|
+
### Range and step
|
|
1793
|
+
|
|
1794
|
+
`min`, `max` and `step`. The value always lands on a step within the range.
|
|
1795
|
+
|
|
1796
|
+
```html
|
|
1797
|
+
<uf-slider label="Maximum price (€)" min="0" max="500" step="10" value="250" show-value></uf-slider>
|
|
1798
|
+
<uf-slider label="Rating" min="1" max="5" value="4" show-value disabled></uf-slider>
|
|
1799
|
+
```
|
|
1800
|
+
|
|
1801
|
+
### `<uf-slider>` API
|
|
1802
|
+
|
|
1803
|
+
#### Attributes and properties
|
|
1804
|
+
|
|
1805
|
+
| Attribute | Property | Type | Default | Description |
|
|
1806
|
+
|---|---|---|---|---|
|
|
1807
|
+
| `value` | `defaultValue` | `number \| undefined` | | Initial value, restored on form reset. Set with the `value` attribute. Defaults to the middle of the range, like a native slider. |
|
|
1808
|
+
| `min` | | `number` | `0` | Lowest value. |
|
|
1809
|
+
| `max` | | `number` | `100` | Highest value. |
|
|
1810
|
+
| `step` | | `number` | `1` | Granularity: the value moves in steps of this size. |
|
|
1811
|
+
| `label` | | `string \| undefined` | | Visible label, also the slider's accessible name. |
|
|
1812
|
+
| `hint` | | `string \| undefined` | | Help text below the slider. |
|
|
1813
|
+
| `show-value` | `showValue` | `boolean` | `false` | Shows the current value next to the label. |
|
|
1814
|
+
| `name` | | `string` | `''` | Name submitted with the form. |
|
|
1815
|
+
| `disabled` | | `boolean` | `false` | Disables the control. |
|
|
1816
|
+
| `required` | | `boolean` | `false` | Makes the control required for form submission. |
|
|
1817
|
+
|
|
1818
|
+
#### Properties only
|
|
1819
|
+
|
|
1820
|
+
| Property | Type | Description |
|
|
1821
|
+
|---|---|---|
|
|
1822
|
+
| `value` | `number` | Current value. |
|
|
1823
|
+
| `form` | `HTMLFormElement \| null` | Read-only. The form this control belongs to, if any. |
|
|
1824
|
+
| `validity` | `ValidityState` | Read-only. The control's validity state, like a native input's. |
|
|
1825
|
+
| `validationMessage` | `string` | Read-only. The error message shown when the value is invalid. |
|
|
1826
|
+
| `willValidate` | `boolean` | Read-only. Whether the control takes part in form validation. |
|
|
1827
|
+
|
|
1828
|
+
#### Methods
|
|
1829
|
+
|
|
1830
|
+
| Method | Description |
|
|
1831
|
+
|---|---|
|
|
1832
|
+
| `checkValidity()` | Returns whether the value is valid, without showing an error. |
|
|
1833
|
+
| `reportValidity()` | Returns whether the value is valid, and shows the error if not. |
|
|
1834
|
+
| `setCustomValidity(message: string)` | Sets a custom error message. Pass an empty string to clear it. |
|
|
1835
|
+
|
|
1836
|
+
#### Events
|
|
1837
|
+
|
|
1838
|
+
| Event | Type | Description |
|
|
1839
|
+
|---|---|---|
|
|
1840
|
+
| `input` | | Fired while the handle moves. |
|
|
1841
|
+
| `change` | `Event` | Fired when the user lets go, or after a key press. |
|
|
1842
|
+
|
|
1843
|
+
#### Slots
|
|
1844
|
+
|
|
1845
|
+
| Slot | Description |
|
|
1846
|
+
|---|---|
|
|
1847
|
+
| `label` | The label, when you need markup. Overrides `label`. |
|
|
1848
|
+
| `hint` | Help text below the slider. Overrides `hint`. |
|
|
1849
|
+
|
|
1850
|
+
#### CSS parts
|
|
1851
|
+
|
|
1852
|
+
| Part | Description |
|
|
1853
|
+
|---|---|
|
|
1854
|
+
| `field` | The wrapper around label, slider, hint and error. |
|
|
1855
|
+
| `form-label` | The label. |
|
|
1856
|
+
| `value` | The current value, when `show-value` is set. |
|
|
1857
|
+
| `input` | The native range `<input>`. |
|
|
1858
|
+
| `hint` | The hint text. |
|
|
1859
|
+
| `error` | The validation message. |
|
|
1860
|
+
|
|
1861
|
+
#### CSS custom properties
|
|
1862
|
+
|
|
1863
|
+
| Property | Description |
|
|
1864
|
+
|---|---|
|
|
1865
|
+
| `--uf-slider-track-height` | Height of the track. |
|
|
1866
|
+
| `--uf-slider-track-color` | Color of the track's empty part. |
|
|
1867
|
+
| `--uf-slider-fill-color` | Color of the track up to the handle. |
|
|
1868
|
+
| `--uf-slider-thumb-size` | Diameter of the handle. |
|
|
1869
|
+
|
|
1870
|
+
## Spinner
|
|
1871
|
+
|
|
1872
|
+
A spinning circle for work in progress whose length isn't known. Screen
|
|
1873
|
+
readers announce it as "Loading" (translatable), or as its `label`.
|
|
1874
|
+
|
|
1875
|
+
Tags: `<uf-spinner>`. Import: `import '@unframed/core/spinner';` (or `npx @unframed/cli add spinner` to copy the source).
|
|
1876
|
+
|
|
1877
|
+
### Sizes
|
|
1878
|
+
|
|
1879
|
+
`sm`, `md` (the default) or `lg`, or any size with `--uf-spinner-size`.
|
|
1880
|
+
|
|
1881
|
+
```html
|
|
1882
|
+
<uf-spinner size="sm"></uf-spinner>
|
|
1883
|
+
<uf-spinner></uf-spinner>
|
|
1884
|
+
<uf-spinner size="lg"></uf-spinner>
|
|
1885
|
+
<uf-spinner style="--uf-spinner-size: 3.5rem"></uf-spinner>
|
|
1886
|
+
```
|
|
1887
|
+
|
|
1888
|
+
### Label and color
|
|
1889
|
+
|
|
1890
|
+
Screen readers announce "Loading" (translatable), or `label`. Colors come from the theme, or `--uf-spinner-indicator-color`.
|
|
1891
|
+
|
|
1892
|
+
```html
|
|
1893
|
+
<uf-spinner label="Loading John Smith's orders"></uf-spinner>
|
|
1894
|
+
<uf-spinner label="Saving" style="--uf-spinner-indicator-color: var(--uf-color-success)"></uf-spinner>
|
|
1895
|
+
```
|
|
1896
|
+
|
|
1897
|
+
- For a button that is busy, use the button's `loading` instead: it keeps the button focusable and its label for screen readers.
|
|
1898
|
+
|
|
1899
|
+
### `<uf-spinner>` API
|
|
1900
|
+
|
|
1901
|
+
#### Attributes and properties
|
|
1902
|
+
|
|
1903
|
+
| Attribute | Property | Type | Default | Description |
|
|
1904
|
+
|---|---|---|---|---|
|
|
1905
|
+
| `label` | | `string \| undefined` | | Accessible name. Defaults to "Loading", in the page's language. |
|
|
1906
|
+
| `size` | | `SpinnerSize` | `'md'` | Size: `sm`, `md` or `lg`. |
|
|
1907
|
+
|
|
1908
|
+
#### CSS parts
|
|
1909
|
+
|
|
1910
|
+
| Part | Description |
|
|
1911
|
+
|---|---|
|
|
1912
|
+
| `base` | The spinner. |
|
|
1913
|
+
|
|
1914
|
+
#### CSS custom properties
|
|
1915
|
+
|
|
1916
|
+
| Property | Description |
|
|
1917
|
+
|---|---|
|
|
1918
|
+
| `--uf-spinner-size` | Diameter. Overrides `size`. |
|
|
1919
|
+
| `--uf-spinner-track-color` | Color of the circle. |
|
|
1920
|
+
| `--uf-spinner-indicator-color` | Color of the moving arc. |
|
|
1921
|
+
|
|
1526
1922
|
## Switch
|
|
1527
1923
|
|
|
1528
1924
|
An on/off switch with its label as content. Use it for settings that apply
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Using Unframed 0.
|
|
1
|
+
# Using Unframed 0.8.0 in each framework
|
|
2
2
|
|
|
3
3
|
## HTML & JavaScript
|
|
4
4
|
|
|
@@ -68,8 +68,8 @@ dialog.addEventListener('uf-hide', () => toast('Welcome aboard!', { variant: 'su
|
|
|
68
68
|
<!doctype html>
|
|
69
69
|
<html lang="en">
|
|
70
70
|
<head>
|
|
71
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@unframed/tokens@0.
|
|
72
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.
|
|
71
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@unframed/tokens@0.8/dist/tokens.css" />
|
|
72
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@unframed/core@0.8/+esm"></script>
|
|
73
73
|
</head>
|
|
74
74
|
<body>
|
|
75
75
|
<uf-button variant="primary">It works</uf-button>
|