@reliability-design/web 1.4.9 → 1.4.11
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/CHANGELOG.md +161 -2
- package/custom-elements.json +18604 -0
- package/dist/components/rel-accordion/README.md +9 -2
- package/dist/components/rel-alert/README.md +4 -7
- package/dist/components/rel-autocomplete/README.md +209 -209
- package/dist/components/rel-avatar/README.md +228 -118
- package/dist/components/rel-breadcrumb/README.md +1 -0
- package/dist/components/rel-button/README.md +9 -9
- package/dist/components/rel-calendar/README.md +111 -109
- package/dist/components/rel-cardmedia/README.md +1 -1
- package/dist/components/rel-carousel/README.md +187 -187
- package/dist/components/rel-checkbox/README.md +159 -147
- package/dist/components/rel-chip/README.md +141 -138
- package/dist/components/rel-container/README.md +1 -1
- package/dist/components/rel-date-picker/README.md +221 -206
- package/dist/components/rel-drawer/README.md +4 -4
- package/dist/components/rel-kbd/README.md +188 -141
- package/dist/components/rel-layout/README.md +34 -34
- package/dist/components/rel-menu/README.md +17 -10
- package/dist/components/rel-menubar/README.md +218 -218
- package/dist/components/rel-otp/README.md +4 -8
- package/dist/components/rel-pagination/README.md +141 -100
- package/dist/components/rel-popover/README.md +220 -203
- package/dist/components/rel-radio/README.md +142 -131
- package/dist/components/rel-range-picker/README.md +194 -171
- package/dist/components/rel-resizable/README.md +220 -199
- package/dist/components/rel-segmented-button/README.md +158 -157
- package/dist/components/rel-select/README.md +21 -17
- package/dist/components/rel-sheet/README.md +3 -2
- package/dist/components/rel-signature-pad/README.md +161 -0
- package/dist/components/rel-slider/README.md +140 -131
- package/dist/components/rel-snackbar/README.md +170 -168
- package/dist/components/rel-split-button/README.md +129 -0
- package/dist/components/rel-stepper/README.md +171 -171
- package/dist/components/rel-switch/README.md +122 -117
- package/dist/components/rel-tab/README.md +184 -174
- package/dist/components/rel-textfield/README.md +21 -28
- package/dist/components/rel-time-picker/README.md +188 -170
- package/dist/components/rel-toast/README.md +20 -11
- package/dist/components/rel-tooltip/README.md +5 -4
- package/dist/components/rel-tree/README.md +157 -0
- package/dist/components/rel-upload/README.md +8 -5
- package/dist/index.d.mts +1608 -624
- package/dist/index.d.ts +1608 -624
- package/dist/index.js +11933 -6802
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11009 -5885
- package/dist/index.mjs.map +1 -1
- package/dist/styles/ag-grid.css +274 -0
- package/dist/styles/motion.css +31 -0
- package/dist/styles/motion.tokens.json +38 -0
- package/dist/styles/vars.css +88 -64
- package/dist/{vars-DXX6QOAG.css → vars-E22LYFMV.css} +88 -64
- package/package.json +61 -37
- package/dist/styles/focus-ring.ts +0 -84
|
@@ -1,174 +1,184 @@
|
|
|
1
|
-
# rel-tab
|
|
2
|
-
|
|
3
|
-
`<rel-tab>` implements the Figma **Tab Item** component (6473:1075) as an underline tab strip with roving-tabindex keyboard navigation, optional count or dot badges and a single shared tabpanel below the strip. Tabs are declared either with slotted `<rel-tab-item>` elements (registered by this folder; they render nothing themselves) or with the `tabs` array property. Use it to switch between peer views of the same content in place; for moving between pages use links or the navbar recipe, and for ordered multi-step flows use `<rel-stepper>`.
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```html
|
|
8
|
-
<!-- Declarative tabs with badges and a disabled item -->
|
|
9
|
-
<rel-tab id="inbox-tabs" size="medium">
|
|
10
|
-
<rel-tab-item slot="items" label="Inbox" value="inbox" badge="5"></rel-tab-item>
|
|
11
|
-
<rel-tab-item slot="items" label="Drafts" value="drafts" badge-dot></rel-tab-item>
|
|
12
|
-
<rel-tab-item slot="items" label="Archive" value="archive" disabled></rel-tab-item>
|
|
13
|
-
<div id="inbox-panel">Inbox content.</div>
|
|
14
|
-
</rel-tab>
|
|
15
|
-
|
|
16
|
-
<script>
|
|
17
|
-
const tabs = document.getElementById('inbox-tabs');
|
|
18
|
-
tabs.addEventListener('rel-tab-change', (e) => {
|
|
19
|
-
const index = e.detail; // number
|
|
20
|
-
const item = tabs.querySelectorAll('rel-tab-item')[index];
|
|
21
|
-
document.getElementById('inbox-panel').textContent = `${item.value} content.`;
|
|
22
|
-
});
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<!-- Sizes: small (32px), medium (40px), large (48px) -->
|
|
26
|
-
<rel-tab size="small">
|
|
27
|
-
<rel-tab-item slot="items" label="Overview"></rel-tab-item>
|
|
28
|
-
<rel-tab-item slot="items" label="Details"></rel-tab-item>
|
|
29
|
-
</rel-tab>
|
|
30
|
-
<rel-tab size="large"
|
|
31
|
-
<rel-tab-item slot="items" label="Overview"></rel-tab-item>
|
|
32
|
-
<rel-tab-item slot="items" label="Details"></rel-tab-item>
|
|
33
|
-
</rel-tab>
|
|
34
|
-
|
|
35
|
-
<!-- Tabs from the `tabs` property -->
|
|
36
|
-
<rel-tab id="array-tabs"></rel-tab>
|
|
37
|
-
<script>
|
|
38
|
-
document.getElementById('array-tabs').tabs = [
|
|
39
|
-
{ label: 'Overview' },
|
|
40
|
-
{ label: 'Alerts', badge: 2 },
|
|
41
|
-
{ label: 'Beta', badgeDot: true },
|
|
42
|
-
{ label: 'Coming soon', disabled: true },
|
|
43
|
-
];
|
|
44
|
-
</script>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Deprecated aliases
|
|
48
|
-
|
|
49
|
-
```html
|
|
50
|
-
<!-- size="sm" / "md" / "lg" → size="small" / "medium" / "large" (still accepted; no console notice is logged) -->
|
|
51
|
-
<rel-tab size="sm">
|
|
52
|
-
<rel-tab-item slot="items" label="Overview"></rel-tab-item>
|
|
53
|
-
</rel-tab>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
##
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
| `
|
|
101
|
-
|
|
102
|
-
###
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
1
|
+
# rel-tab
|
|
2
|
+
|
|
3
|
+
`<rel-tab>` implements the Figma **Tab Item** component (6473:1075) as an underline tab strip with roving-tabindex keyboard navigation, optional count or dot badges and a single shared tabpanel below the strip. Tabs are declared either with slotted `<rel-tab-item>` elements (registered by this folder; they render nothing themselves) or with the `tabs` array property. Use it to switch between peer views of the same content in place; for moving between pages use links or the navbar recipe, and for ordered multi-step flows use `<rel-stepper>`.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Declarative tabs with badges and a disabled item -->
|
|
9
|
+
<rel-tab id="inbox-tabs" size="medium">
|
|
10
|
+
<rel-tab-item slot="items" label="Inbox" value="inbox" badge="5"></rel-tab-item>
|
|
11
|
+
<rel-tab-item slot="items" label="Drafts" value="drafts" badge-dot></rel-tab-item>
|
|
12
|
+
<rel-tab-item slot="items" label="Archive" value="archive" disabled></rel-tab-item>
|
|
13
|
+
<div id="inbox-panel">Inbox content.</div>
|
|
14
|
+
</rel-tab>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
const tabs = document.getElementById('inbox-tabs');
|
|
18
|
+
tabs.addEventListener('rel-tab-change', (e) => {
|
|
19
|
+
const index = e.detail; // number
|
|
20
|
+
const item = tabs.querySelectorAll('rel-tab-item')[index];
|
|
21
|
+
document.getElementById('inbox-panel').textContent = `${item.value} content.`;
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<!-- Sizes: small (32px), medium (40px), large (48px) -->
|
|
26
|
+
<rel-tab size="small">
|
|
27
|
+
<rel-tab-item slot="items" label="Overview"></rel-tab-item>
|
|
28
|
+
<rel-tab-item slot="items" label="Details"></rel-tab-item>
|
|
29
|
+
</rel-tab>
|
|
30
|
+
<rel-tab size="large" active-index="1">
|
|
31
|
+
<rel-tab-item slot="items" label="Overview"></rel-tab-item>
|
|
32
|
+
<rel-tab-item slot="items" label="Details"></rel-tab-item>
|
|
33
|
+
</rel-tab>
|
|
34
|
+
|
|
35
|
+
<!-- Tabs from the `tabs` property -->
|
|
36
|
+
<rel-tab id="array-tabs"></rel-tab>
|
|
37
|
+
<script>
|
|
38
|
+
document.getElementById('array-tabs').tabs = [
|
|
39
|
+
{ label: 'Overview' },
|
|
40
|
+
{ label: 'Alerts', badge: 2 },
|
|
41
|
+
{ label: 'Beta', badgeDot: true },
|
|
42
|
+
{ label: 'Coming soon', disabled: true },
|
|
43
|
+
];
|
|
44
|
+
</script>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Deprecated aliases
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<!-- size="sm" / "md" / "lg" → size="small" / "medium" / "large" (still accepted; no console notice is logged) -->
|
|
51
|
+
<rel-tab size="sm">
|
|
52
|
+
<rel-tab-item slot="items" label="Overview"></rel-tab-item>
|
|
53
|
+
</rel-tab>
|
|
54
|
+
|
|
55
|
+
<!-- activeindex → active-index (since 1.5.0; still works, logs a one-time console notice, removed in 3.0).
|
|
56
|
+
activeIndex still reflects as activeindex in 1.x. -->
|
|
57
|
+
<rel-tab activeindex="1">
|
|
58
|
+
<rel-tab-item slot="items" label="Overview"></rel-tab-item>
|
|
59
|
+
<rel-tab-item slot="items" label="Details"></rel-tab-item>
|
|
60
|
+
</rel-tab>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
<!-- readme-gen:start -->
|
|
64
|
+
|
|
65
|
+
<!-- Generated from rel-tab.ts — do not edit; run readme-generate.mjs -->
|
|
66
|
+
|
|
67
|
+
## Elements
|
|
68
|
+
|
|
69
|
+
| Element | Class | Source |
|
|
70
|
+
| --- | --- | --- |
|
|
71
|
+
| `<rel-tab>` | `RelTab` | `rel-tab.ts` |
|
|
72
|
+
| `<rel-tab-item>` | `RelTabItem` | `rel-tab.ts` |
|
|
73
|
+
|
|
74
|
+
## API
|
|
75
|
+
|
|
76
|
+
### `<rel-tab>`
|
|
77
|
+
|
|
78
|
+
#### Attributes / Properties
|
|
79
|
+
|
|
80
|
+
| Property | Attribute | Type | Default | Description |
|
|
81
|
+
| --- | --- | --- | --- | --- |
|
|
82
|
+
| `tabs` | `tabs` | `TabItem[]` | `[]` | Tab definitions as `{ label, badge?, badgeDot?, disabled? }` objects — normally set as a property (as an attribute it must be a JSON string). Assign a new array to update; mutating in place does not re-render. Ignored when `<rel-tab-item>` children are slotted into `items`. |
|
|
83
|
+
| `activeIndex` | `active-index` | `number` | `0` | Zero-based index of the selected tab. Set it to switch tabs programmatically (no event is fired for programmatic changes). Reflected (as `activeindex` in 1.x). The `activeindex` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
84
|
+
| `size` | `size` | `"sm" \| "md" \| "lg" \| "small" \| "medium" \| "large"` | `"md"` | Tab size — styled via :host([size]) rules. Explicit item heights 32 / 40 / 48px (audit 34); `small\|medium\|large` alias `sm\|md\|lg`. Reflected. |
|
|
85
|
+
| `orientation` | `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | New in 1.5.0. Tab list layout: `horizontal` (default, a row above the panel) or `vertical` (a column beside the panel as wide as its longest label, tabs 24px apart along a rule on the list's inline-start edge, the active bar on that edge, labels that wrap rather than truncate; Up / Down move between tabs). There is no built-in breakpoint: switch to horizontal on small screens in your app. Reflected. |
|
|
86
|
+
| `iconPlacement` | `icon-placement` | `"start" \| "top"` | `"start"` | New in 1.5.0. Icon position in every tab: `start` (default, before the label) or `top` (stacked above the label, with the badge beside the label). Stacked tabs are 76 / 64 / 52px tall at large / medium / small. Works in both orientations. Reflected. |
|
|
87
|
+
|
|
88
|
+
### Events
|
|
89
|
+
|
|
90
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
91
|
+
| --- | --- | --- | --- |
|
|
92
|
+
| `rel-change` | `index` | bubbles / composed | Prefixed alias of `rel-tab-change`, added in 1.4.9 — fired on the same action with the same detail. Both events fire; listen to one. Prefer this in new code, since every interactive component in the library emits `rel-change`. `rel-tab-change` is kept for as long as 1.x. |
|
|
93
|
+
| `rel-tab-change` | `index` | bubbles / composed | Fired when the user selects a tab by click or keyboard (not on programmatic `activeIndex` changes). Detail: the new active index (number). |
|
|
94
|
+
|
|
95
|
+
### Slots
|
|
96
|
+
|
|
97
|
+
| Slot | Description |
|
|
98
|
+
| --- | --- |
|
|
99
|
+
| (default) | Content of the single tabpanel rendered under the strip (always visible — swap it yourself on `rel-tab-change`) |
|
|
100
|
+
| `items` | `<rel-tab-item>` definitions; when present they take precedence over the `tabs` array |
|
|
101
|
+
|
|
102
|
+
### CSS Parts
|
|
103
|
+
|
|
104
|
+
| Part | Description |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| `list` | The `role="tablist"` row |
|
|
107
|
+
| `item` | Each `role="tab"` element |
|
|
108
|
+
| `icon` | — |
|
|
109
|
+
| `label` | The text span inside each tab |
|
|
110
|
+
|
|
111
|
+
### Tokens / CSS Variables
|
|
112
|
+
|
|
113
|
+
#### Component hooks
|
|
114
|
+
|
|
115
|
+
Set these on the host (or an ancestor) to customise the element without touching design tokens.
|
|
116
|
+
|
|
117
|
+
| Custom property | Default | Description |
|
|
118
|
+
| --- | --- | --- |
|
|
119
|
+
| `--rel-tab-active-color` | `var(--tab-active-color)` | Underline colour of the active tab; default `var(--rel-bg-brand)` |
|
|
120
|
+
| `--rel-tab-hover-color` | `var(--tab-hover-color)` | Background of an inactive tab on hover; default `transparent` (the design darkens the label instead). Set it to bring a hover fill back. |
|
|
121
|
+
| `--rel-tab-list-width` | `max-content` | Width of the tab list when `orientation="vertical"`; default `max-content` |
|
|
122
|
+
| `--rel-tab-text-default` | `var(--tab-text-default)` | Label colour of the active tab; default `var(--rel-text-default)` |
|
|
123
|
+
| `--rel-tab-text-disabled` | `var(--rel-text-default)` | Label colour of a disabled tab; default `var(--rel-text-disabled)` |
|
|
124
|
+
| `--rel-tab-text-hover` | `var(--tab-text-hover)` | Label colour while hovering an enabled tab; default `var(--rel-text-default)` |
|
|
125
|
+
| `--rel-tab-underline-height` | `var(--tab-underline-height)` | Thickness of the active underline; default 1px (`--rel-stroke-sm`, the weight Figma draws). Set it to restore the heavier 3px bar shipped previously. |
|
|
126
|
+
|
|
127
|
+
### `<rel-tab-item>`
|
|
128
|
+
|
|
129
|
+
#### Attributes / Properties
|
|
130
|
+
|
|
131
|
+
| Property | Attribute | Type | Default | Description |
|
|
132
|
+
| --- | --- | --- | --- | --- |
|
|
133
|
+
| `label` | `label` | `string` | `""` | Text shown on the tab. |
|
|
134
|
+
| `icon` | `icon` | `string` | `""` | Icon name from the generated icon dictionary, rendered before the label (Figma "Show Icon" / "Icon"). Sized 20 / 18 / 16px with the tab's own size step. |
|
|
135
|
+
| `value` | `value` | `string` | `""` | Optional identifier for the tab. `<rel-tab>` does not read it; look it up from the item at `event.detail` when handling `rel-tab-change`. |
|
|
136
|
+
| `badge` | `badge` | `number` | `0` | Count shown in a small badge after the label; `0` hides the badge. |
|
|
137
|
+
| `badgeDot` | `badge-dot` | `boolean` | `false` | Shows a small dot instead of a numbered badge — takes precedence over `badge`. |
|
|
138
|
+
| `disabled` | `disabled` | `boolean` | `false` | Greys the tab out and skips it in click, arrow-key and Home/End navigation. |
|
|
139
|
+
|
|
140
|
+
### Events
|
|
141
|
+
|
|
142
|
+
| Event | Detail | Bubbles / composed | Description |
|
|
143
|
+
| --- | --- | --- | --- |
|
|
144
|
+
| — | — | — | This element emits no custom events. |
|
|
145
|
+
|
|
146
|
+
### Slots
|
|
147
|
+
|
|
148
|
+
| Slot | Description |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| — | This element has no slots. |
|
|
151
|
+
|
|
152
|
+
### CSS Parts
|
|
153
|
+
|
|
154
|
+
| Part | Description |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| — | None exposed. |
|
|
157
|
+
|
|
158
|
+
<!-- readme-gen:end -->
|
|
159
|
+
|
|
160
|
+
## Accessibility
|
|
161
|
+
|
|
162
|
+
- The strip is `role="tablist"`; every tab is `role="tab"` with `aria-selected`, `aria-disabled` and `aria-controls` pointing at the shared `role="tabpanel"`, which in turn is `aria-labelledby` the active tab and is focusable (`tabindex="0"`).
|
|
163
|
+
- Roving tabindex: only the active tab is in the Tab order (`tabindex="0"`); other and disabled tabs are `tabindex="-1"`.
|
|
164
|
+
- Arrow keys use automatic activation — moving focus also selects the tab and fires `rel-tab-change`.
|
|
165
|
+
- Focus is shown as a 2px outline inset inside the tab.
|
|
166
|
+
- Disabled tabs ignore clicks and keys and are skipped by arrow, Home and End navigation.
|
|
167
|
+
|
|
168
|
+
| Key | Action |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `ArrowRight` | Selects and focuses the next enabled tab (wraps to the first). |
|
|
171
|
+
| `ArrowLeft` | Selects and focuses the previous enabled tab (wraps to the last). |
|
|
172
|
+
| `Home` | Selects and focuses the first enabled tab. |
|
|
173
|
+
| `End` | Selects and focuses the last enabled tab. |
|
|
174
|
+
| `Enter` / `Space` | Selects the focused tab (no-op when disabled). |
|
|
175
|
+
| `Tab` | Leaves the strip (moves to the tabpanel). |
|
|
176
|
+
|
|
177
|
+
## Notes / Edge Cases
|
|
178
|
+
|
|
179
|
+
- There is one always-visible tabpanel (the default slot). The component does not show/hide content per tab — swap or filter the panel content yourself on `rel-tab-change` or by watching `activeIndex`.
|
|
180
|
+
- `rel-tab-change` fires for user selection only; setting `activeIndex` programmatically updates the strip silently.
|
|
181
|
+
- Slotted `<rel-tab-item>` elements take precedence over the `tabs` array. Their `value` is not read by `<rel-tab>` — look it up from the item at `event.detail` when you need an identifier. The `items` slot itself is hidden.
|
|
182
|
+
- `badge-dot` wins over `badge`; a `badge` of `0` renders no badge. Badges use the danger tone on enabled tabs and a neutral inverse tone on disabled tabs.
|
|
183
|
+
- `size` accepts `small` / `medium` / `large` (item heights 32 / 40 / 48px with body-sm / md / lg type); the short forms `sm` / `md` / `lg` are aliases (see Deprecated aliases).
|
|
184
|
+
- Legacy hook aliases still honoured: `--tab-active-color`, `--tab-underline-height`, `--tab-text-default`, `--tab-text-hover`, `--tab-text-disabled` and `--tab-hover-color` are read as fallbacks of the `--rel-tab-*` hooks.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<rel-textfield label-style="none" placeholder="Search orders" field-aria-label="Search orders"></rel-textfield>
|
|
20
20
|
|
|
21
21
|
<!-- Leading icon, helper text, required -->
|
|
22
|
-
<rel-textfield label="Search"
|
|
22
|
+
<rel-textfield label="Search" prefix-icon="search" helper-text="Type at least 3 characters" required></rel-textfield>
|
|
23
23
|
|
|
24
24
|
<!-- Prefix / suffix text (Figma .Preffix / .Suffix) -->
|
|
25
25
|
<rel-textfield label="Website" prefix-text="https://" prefix-style="fill"></rel-textfield>
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
id="pw"
|
|
37
37
|
label="Password"
|
|
38
38
|
type="password"
|
|
39
|
-
|
|
39
|
+
right-icon="visibility-on"
|
|
40
40
|
clickable-right-icon
|
|
41
41
|
right-icon-aria-label="Show password">
|
|
42
42
|
</rel-textfield>
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</script>
|
|
50
50
|
|
|
51
51
|
<!-- Error state -->
|
|
52
|
-
<rel-textfield label="Username" value="a" error
|
|
52
|
+
<rel-textfield label="Username" value="a" error error-message="Must be at least 3 characters"></rel-textfield>
|
|
53
53
|
|
|
54
54
|
<!-- Multiline (textarea) -->
|
|
55
55
|
<rel-textfield label="Notes" multiline rows="5" maxlength="500"></rel-textfield>
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
<rel-textfield label="Disabled" disabled></rel-textfield>
|
|
60
60
|
<rel-textfield id="qty" label="Quantity" type="number"></rel-textfield>
|
|
61
61
|
<script>
|
|
62
|
-
// fullWidth defaults to true;
|
|
62
|
+
// fullWidth defaults to true; full-width="false" in markup does the same as this
|
|
63
63
|
document.getElementById("qty").fullWidth = false;
|
|
64
64
|
</script>
|
|
65
65
|
```
|
|
@@ -70,6 +70,13 @@
|
|
|
70
70
|
<!-- floatingLabel → label-style="floating" (kept permanently as an alias; no console notice) -->
|
|
71
71
|
<rel-textfield label="Old spelling" floatinglabel></rel-textfield>
|
|
72
72
|
<rel-textfield label="Canonical" label-style="floating"></rel-textfield>
|
|
73
|
+
|
|
74
|
+
<!-- Lowercase-joined attribute spellings → kebab-case (since 1.5.0; the old ones still work,
|
|
75
|
+
log a one-time console notice, and are removed in 3.0) -->
|
|
76
|
+
<rel-textfield label="Old spelling" prefixicon="search" lefticon="search" righticon="visibility-on" prefixiconarialabel="Search"
|
|
77
|
+
helpertext="Helper" errormessage="Error" fullwidth></rel-textfield>
|
|
78
|
+
<rel-textfield label="Canonical" prefix-icon="search" left-icon="search" right-icon="visibility-on" prefix-icon-aria-label="Search"
|
|
79
|
+
helper-text="Helper" error-message="Error" full-width></rel-textfield>
|
|
73
80
|
```
|
|
74
81
|
|
|
75
82
|
<!-- readme-gen:start -->
|
|
@@ -86,8 +93,8 @@
|
|
|
86
93
|
| `placeholder` | `placeholder` | `string` | `""` | Placeholder shown while the field is empty. Under the floating label style it stays hidden until the field is focused. |
|
|
87
94
|
| `type` | `type` | `string` | `"text"` | Native input `type` (`text`, `email`, `password`, `number`, …). Ignored when `multiline` is set. |
|
|
88
95
|
| `value` | `value` | `string` | `""` | Current text. Updated on every keystroke; set it to control the field programmatically. |
|
|
89
|
-
| `leftIcon` | `
|
|
90
|
-
| `rightIcon` | `
|
|
96
|
+
| `leftIcon` | `left-icon` | `string` | `undefined` | Legacy name for the leading icon (a `rel-icon` name). `prefixIcon` wins when both are set. The `lefticon` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
97
|
+
| `rightIcon` | `right-icon` | `string` | `undefined` | Trailing `rel-icon` name rendered in the suffix block. Decorative unless `clickableRightIcon` is set. The `righticon` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
91
98
|
| `clickableRightIcon` | `clickable-right-icon` | `boolean` | `false` | Makes the trailing icon interactive (pointer + focusable) and emits `rel-right-icon-click` — e.g. a password show/hide toggle or clear button. |
|
|
92
99
|
| `rightIconAriaLabel` | `right-icon-aria-label` | `string` | `undefined` | Accessible label for the trailing icon when it is clickable. |
|
|
93
100
|
| `prefixText` | `prefix-text` | `string` | `undefined` | Short text rendered before the input, e.g. `"http://"` or `"$"`. Sits in the same prefix block as `prefixIcon` and is styled by `prefixStyle`. |
|
|
@@ -105,16 +112,16 @@
|
|
|
105
112
|
| `required` | `required` | `boolean` | `false` | Marks the input required: sets native `required` / `aria-required` and appends an asterisk to the label. |
|
|
106
113
|
| `multiline` | `multiline` | `boolean` | `false` | Renders a textarea instead of a single-line input (see `rows`). Prefix/suffix blocks and `type` are ignored in this mode. Reflected. |
|
|
107
114
|
| `rows` | `rows` | `number` | `3` | Visible text rows of the textarea when `multiline` is set. |
|
|
108
|
-
| `prefixIcon` | `
|
|
109
|
-
| `prefixIconAriaLabel` | `
|
|
115
|
+
| `prefixIcon` | `prefix-icon` | `string` | `undefined` | Leading `rel-icon` name rendered in the prefix block (preferred over the legacy `leftIcon`). The `prefixicon` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
116
|
+
| `prefixIconAriaLabel` | `prefix-icon-aria-label` | `string` | `undefined` | Accessible label for the leading icon. Without it the icon is `aria-hidden` (decorative). The `prefixiconarialabel` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
110
117
|
| `error` | `error` | `boolean` | `false` | Puts the field in the error state: danger border, `aria-invalid`, and `errorMessage` replacing the helper text. |
|
|
111
|
-
| `errorMessage` | `
|
|
112
|
-
| `helperText` | `
|
|
118
|
+
| `errorMessage` | `error-message` | `string` | `undefined` | Text shown below the control instead of `helperText` while the field is in the error state. The `errormessage` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
119
|
+
| `helperText` | `helper-text` | `string` | `undefined` | Helper line below the control (preferred over the legacy `supportingText`); linked to the input via `aria-describedby`. The `helpertext` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
113
120
|
| `helperIcon` | `helper-icon` | `string` | `undefined` | Icon name from the generated icon dictionary, rendered before the helper line (Figma "Supporting Icon"). Sized 16px, or 14px at `size="small"`, and it takes the helper's colour — so it turns `--rel-text-danger` in the error state. Decorative: it is hidden from screen readers, since the helper text it sits beside is already announced. |
|
|
114
121
|
| `readonly` | `readonly` | `boolean` | `false` | Makes the input read-only: focusable and selectable but not editable. |
|
|
115
122
|
| `maxLength` | `maxlength` | `number` | `undefined` | Maximum number of characters (native `maxlength`). |
|
|
116
123
|
| `name` | `name` | `string` | `undefined` | Form field name forwarded to the native input, for form submission and autofill. |
|
|
117
|
-
| `fullWidth` | `
|
|
124
|
+
| `fullWidth` | `full-width` | `boolean` | `true` | Fills the parent width as a block element (default). Unset it to render inline at the content's natural width. Reflected (as `fullwidth` in 1.x). The `fullwidth` attribute spelling is deprecated (still works; removal targeted for 3.0). |
|
|
118
125
|
|
|
119
126
|
#### Deprecated (still supported — removal targeted for 3.0)
|
|
120
127
|
|
|
@@ -185,26 +192,12 @@ Focus behaviour: `focus()` on the host focuses the inner input / textarea (the h
|
|
|
185
192
|
|
|
186
193
|
## Notes / Edge Cases
|
|
187
194
|
|
|
188
|
-
- Attribute spellings:
|
|
189
|
-
-
|
|
190
|
-
|
|
191
|
-
| Prop | `rel-textfield` | `rel-autocomplete` / `rel-select` |
|
|
192
|
-
| --- | --- | --- |
|
|
193
|
-
| `prefixIcon` | `prefixicon` | `prefix-icon` (autocomplete) |
|
|
194
|
-
| `helperText` | `helpertext` | `helper-text` (autocomplete) |
|
|
195
|
-
| `errorMessage` | `errormessage` | `error-message` (autocomplete) |
|
|
196
|
-
| `floatingLabel` | `floatinglabel` | `floating-label` (autocomplete) |
|
|
197
|
-
| `fullWidth` | `fullwidth` | `full-width` (autocomplete) |
|
|
198
|
-
| `leftIcon` | `lefticon` | `left-icon` (select) |
|
|
199
|
-
| `rightIcon` | `righticon` | `right-icon` (select) |
|
|
200
|
-
| `supportingText` | `supportingtext` | `supporting-text` (select) |
|
|
201
|
-
|
|
202
|
-
All three agree on `label-style`, `field-aria-label` and `field-aria-labelledby`. This is an inconsistency, not a design decision: the kebab spellings are the intended direction, and unifying on them means retiring the lowercase ones, which only a major version can do — so it is targeted for 3.0. Until then the Attribute column above is the authority for **this** component. In a Lit template you can sidestep the whole question with a property binding (`.prefixIcon=${…}`), which is spelling-independent; that is also how `rel-autocomplete` drives the field it wraps, so its own forwarding is unaffected by the mismatch.
|
|
203
|
-
- Legacy names still work but the canonical ones win when both are set: `leftIcon` → `prefixIcon`, `supportingText` → `helperText`, `state="error"` → `error`, `state="disabled"` → `disabled`. `lefticon` / `righticon` attributes are also read once at connect time.
|
|
195
|
+
- Attribute spellings: every multi-word attribute is kebab-case (`label-style`, `prefix-text`, `prefix-icon`, `left-icon`, `right-icon`, `prefix-icon-aria-label`, `helper-text`, `error-message`, `full-width`, …), the same spelling `rel-autocomplete` and `rel-select` use — see the Attribute column above. The older all-lowercase spellings still work since 1.5.0 but log a one-time console notice and are removed in 3.0 (see Deprecated aliases); when both spellings are present the kebab one wins. `maxlength` keeps the native HTML spelling, and the deprecated `supportingText` / `floatingLabel` props keep their old attributes. In a Lit template a property binding (`.prefixIcon=${…}`) sidesteps spelling entirely.
|
|
196
|
+
- Legacy names still work but the canonical ones win when both are set: `leftIcon` → `prefixIcon`, `supportingText` → `helperText`, `state="error"` → `error`, `state="disabled"` → `disabled`.
|
|
204
197
|
- `errorMessage` replaces the helper line only while the field is in the error state **and** the message is set; otherwise the helper text stays visible. There is no built-in validation — set `error` from your form layer.
|
|
205
198
|
- `state="error"` (legacy) auto-clears to `"default"` as soon as the user types a non-empty value and comes back once the value is emptied again; the `error` boolean never auto-clears.
|
|
206
199
|
- `multiline` renders a `<textarea>` (`rows`, vertical resize, 80px minimum height). `type`, the prefix / suffix blocks and their slots are ignored in this mode (the slots stay mounted but hidden).
|
|
207
|
-
- `fullWidth` defaults to `true
|
|
200
|
+
- `fullWidth` defaults to `true`; without it the host becomes `inline-block` at its content width. Turn it off with `full-width="false"` (since 1.5.0) or the property (`.fullWidth=${false}`). In 1.x it still reflects as the `fullwidth` attribute, so `rel-textfield[fullwidth]` selectors keep matching.
|
|
208
201
|
- `label-style="floating"`: the placeholder is hidden until the field is focused; the label floats onto the border when focused or filled. Internally the deprecated `floatingLabel` boolean is kept in sync with `labelStyle` and its reflected `floatinglabel` attribute is the styling hook, so both spellings render identically. With a `prefix-style="clear"` prefix the floated label slides back over the control's left edge (Figma "Floating Label"); `divider` / `fill` prefixes keep it after the block.
|
|
209
202
|
- `variant="legend"` + `label-style="none"` drops the `<legend>` entirely so the top border runs continuous; a `fill` prefix is squared off in this variant because it cannot reach the notched top border.
|
|
210
203
|
- `--rel-field-label-reserve` (see Component hooks) keeps a `label-style="none"` field bottom-aligned with labelled siblings; set it to `0` in toolbars or table cells.
|