@kubex/zinc 1.1.98 → 1.1.99
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/AGENTS.md +5 -0
- package/CLAUDE.md +5 -0
- package/dist/custom-elements.json +2930 -2072
- package/dist/vscode.html-custom-data.json +198 -59
- package/dist/web-types.json +501 -207
- package/dist/zn.d.ts +203 -9
- package/dist/zn.min.js +343 -297
- package/docs/pages/components/background.md +143 -0
- package/docs/pages/components/checkbox-group.md +13 -1
- package/docs/pages/components/checkbox.md +59 -1
- package/docs/pages/components/radio-group.md +12 -0
- package/docs/pages/components/radio.md +188 -0
- package/docs/pages/components/remarkd-editor.md +22 -0
- package/docs/pages/components/scroll-container.md +14 -15
- package/package.json +1 -1
- package/src/components/background/background.component.ts +111 -0
- package/src/components/background/background.scss +236 -0
- package/src/components/background/background.test.ts +120 -0
- package/src/components/background/index.ts +12 -0
- package/src/components/checkbox/checkbox.component.ts +62 -6
- package/src/components/checkbox/checkbox.scss +1 -0
- package/src/components/checkbox/checkbox.test.ts +56 -0
- package/src/components/checkbox-group/checkbox-group.component.ts +15 -0
- package/src/components/checkbox-group/checkbox-group.scss +23 -5
- package/src/components/checkbox-group/checkbox-group.test.ts +15 -0
- package/src/components/confirm/confirm.component.ts +3 -3
- package/src/components/confirm/confirm.test.ts +15 -0
- package/src/components/dialog/dialog.component.ts +3 -2
- package/src/components/editor/editor.component.ts +7 -6
- package/src/components/header/header.scss +1 -1
- package/src/components/navbar/navbar.scss +11 -0
- package/src/components/radio/radio.component.ts +63 -7
- package/src/components/radio/radio.scss +1 -0
- package/src/components/radio/radio.test.ts +56 -0
- package/src/components/radio-group/radio-group.component.ts +16 -3
- package/src/components/radio-group/radio-group.scss +23 -4
- package/src/components/radio-group/radio-group.test.ts +15 -0
- package/src/components/remarkd-editor/remarkd-editor.component.ts +118 -5
- package/src/components/remarkd-editor/remarkd-editor.scss +8 -1
- package/src/components/remarkd-editor/remarkd-editor.test.ts +96 -0
- package/src/components/scroll-container/scroll-container.component.ts +15 -1
- package/src/components/scroll-container/scroll-container.scss +4 -2
- package/src/components/scroll-container/scroll-container.test.ts +13 -0
- package/src/components/slideout/slideout.component.ts +3 -2
- package/src/components/thumbnail-group/thumbnail-group.scss +0 -1
- package/src/components/tile/tile.scss +4 -2
- package/src/components/translation-group/translation-group.test.ts +22 -0
- package/src/components/translations/translations.component.ts +18 -3
- package/src/form-control.scss +3 -1
- package/src/internal/conditional.ts +2 -2
- package/src/internal/form.ts +2 -1
- package/src/internal/selection-card.ts +19 -0
- package/src/selection-card.scss +187 -0
- package/src/utilities/query.test.ts +18 -1
- package/src/utilities/query.ts +8 -0
- package/src/zinc.ts +1 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
meta:
|
|
3
|
+
title: Background
|
|
4
|
+
description: Layer a colour, decorative image, image strength, motion and contrast overlay behind content.
|
|
5
|
+
layout: component
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`zn-background` builds a presentation background without making assumptions about the content laid over it. Give the element a height (or let its content establish one), then use the default slot for foreground content.
|
|
9
|
+
|
|
10
|
+
```html:preview
|
|
11
|
+
<zn-background
|
|
12
|
+
image="https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?w=1400&q=80"
|
|
13
|
+
color="#18382f"
|
|
14
|
+
image-strength="full"
|
|
15
|
+
motion="drift"
|
|
16
|
+
overlay="strong"
|
|
17
|
+
overlay-tone="dark"
|
|
18
|
+
floating-icons="school,lightbulb,auto_awesome,psychology,rocket_launch,public"
|
|
19
|
+
style="min-height: 24rem; border-radius: var(--zn-border-radius-large); color: white;">
|
|
20
|
+
<zn-sp style="max-width: 38rem;" xl>
|
|
21
|
+
<h2>Build a calm, legible canvas</h2>
|
|
22
|
+
<p>The image, movement and contrast treatment stay behind any slotted Zinc or HTML content.</p>
|
|
23
|
+
</zn-sp>
|
|
24
|
+
</zn-background>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Treatments
|
|
28
|
+
|
|
29
|
+
Use `image-strength="soft|medium|full"` to set the image opacity, `motion="none|drift|breathe"` to choose its movement, and `overlay="none|soft|strong"` to control the contrast gradient. `overlay-tone="light"` places a white gradient over the image; use `dark` when light foreground content needs a dark gradient.
|
|
30
|
+
|
|
31
|
+
Motion automatically stops for people who request reduced motion. Set `paused` when a background remains in the document but is not currently visible, such as an inactive slide.
|
|
32
|
+
|
|
33
|
+
### Image strength
|
|
34
|
+
|
|
35
|
+
```html:preview
|
|
36
|
+
<zn-cols layout="1,1,1">
|
|
37
|
+
<zn-background color="#dcefeb" image="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=800&q=70" image-strength="soft" overlay="soft" style="min-height: 13rem;">
|
|
38
|
+
<zn-sp><strong>Soft image</strong></zn-sp>
|
|
39
|
+
</zn-background>
|
|
40
|
+
<zn-background color="#dcefeb" image="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=800&q=70" image-strength="medium" overlay="soft" style="min-height: 13rem;">
|
|
41
|
+
<zn-sp><strong>Medium image</strong></zn-sp>
|
|
42
|
+
</zn-background>
|
|
43
|
+
<zn-background color="#10231d" image="https://images.unsplash.com/photo-1441974231531-c6227db76b6e?w=800&q=70" image-strength="full" overlay="strong" overlay-tone="dark" style="min-height: 13rem; color: white;">
|
|
44
|
+
<zn-sp><strong>Full image</strong></zn-sp>
|
|
45
|
+
</zn-background>
|
|
46
|
+
</zn-cols>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Motion
|
|
50
|
+
|
|
51
|
+
`drift` slowly travels across the image, while `breathe` gently changes its scale. The oversized image canvas keeps the edges covered throughout both animations.
|
|
52
|
+
|
|
53
|
+
```html:preview
|
|
54
|
+
<zn-cols layout="1,1,1">
|
|
55
|
+
<zn-background
|
|
56
|
+
color="#18382f"
|
|
57
|
+
image="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=900&q=75"
|
|
58
|
+
motion="none"
|
|
59
|
+
overlay="strong"
|
|
60
|
+
overlay-tone="dark"
|
|
61
|
+
style="min-height: 14rem; color: white;">
|
|
62
|
+
<zn-sp><strong>No motion</strong></zn-sp>
|
|
63
|
+
</zn-background>
|
|
64
|
+
<zn-background
|
|
65
|
+
color="#18382f"
|
|
66
|
+
image="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=900&q=75"
|
|
67
|
+
motion="drift"
|
|
68
|
+
overlay="strong"
|
|
69
|
+
overlay-tone="dark"
|
|
70
|
+
style="min-height: 14rem; color: white;">
|
|
71
|
+
<zn-sp><strong>Gentle drift</strong></zn-sp>
|
|
72
|
+
</zn-background>
|
|
73
|
+
<zn-background
|
|
74
|
+
color="#18382f"
|
|
75
|
+
image="https://images.unsplash.com/photo-1470071459604-3b5ec3a7fe05?w=900&q=75"
|
|
76
|
+
motion="breathe"
|
|
77
|
+
overlay="strong"
|
|
78
|
+
overlay-tone="dark"
|
|
79
|
+
style="min-height: 14rem; color: white;">
|
|
80
|
+
<zn-sp><strong>Gentle breathe</strong></zn-sp>
|
|
81
|
+
</zn-background>
|
|
82
|
+
</zn-cols>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Overlay strength
|
|
86
|
+
|
|
87
|
+
The overlay sits above the image and below the slotted content. Choose its strength based on how much contrast the foreground needs.
|
|
88
|
+
|
|
89
|
+
```html:preview
|
|
90
|
+
<zn-cols layout="1,1,1">
|
|
91
|
+
<zn-background
|
|
92
|
+
color="#dcefeb"
|
|
93
|
+
image="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=900&q=75"
|
|
94
|
+
overlay="none"
|
|
95
|
+
style="min-height: 14rem;">
|
|
96
|
+
<zn-sp><strong>No overlay</strong></zn-sp>
|
|
97
|
+
</zn-background>
|
|
98
|
+
<zn-background
|
|
99
|
+
color="#dcefeb"
|
|
100
|
+
image="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=900&q=75"
|
|
101
|
+
overlay="soft"
|
|
102
|
+
overlay-tone="light"
|
|
103
|
+
style="min-height: 14rem;">
|
|
104
|
+
<zn-sp><strong>Soft light overlay</strong></zn-sp>
|
|
105
|
+
</zn-background>
|
|
106
|
+
<zn-background
|
|
107
|
+
color="#10231d"
|
|
108
|
+
image="https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=900&q=75"
|
|
109
|
+
overlay="strong"
|
|
110
|
+
overlay-tone="dark"
|
|
111
|
+
style="min-height: 14rem; color: white;">
|
|
112
|
+
<zn-sp><strong>Strong dark overlay</strong></zn-sp>
|
|
113
|
+
</zn-background>
|
|
114
|
+
</zn-cols>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Floating icons
|
|
118
|
+
|
|
119
|
+
Pass up to eight comma-separated Zinc icon names to `floating-icons`. The icons are decorative and non-interactive. Each uses a fixed ambient anchor with its own timing and fades between 1% and no more than 50% opacity.
|
|
120
|
+
|
|
121
|
+
Icon size follows the background width: 5% of the available space, capped at 150px. Floating motion stops when reduced motion is requested or when the background has `paused`.
|
|
122
|
+
|
|
123
|
+
```html:preview
|
|
124
|
+
<zn-background
|
|
125
|
+
color="#151b34"
|
|
126
|
+
image="https://images.unsplash.com/photo-1446776811953-b23d57bd21aa?w=1400&q=80"
|
|
127
|
+
image-strength="medium"
|
|
128
|
+
overlay="strong"
|
|
129
|
+
overlay-tone="dark"
|
|
130
|
+
floating-icons="rocket_launch,public,star,science,satellite_alt,explore,orbit,auto_awesome"
|
|
131
|
+
style="min-height: 28rem; color: white; --zn-background-floating-icon-color: #d9e2ff;">
|
|
132
|
+
<zn-sp style="max-width: 34rem;" xl>
|
|
133
|
+
<h2>Explore the next horizon</h2>
|
|
134
|
+
<p>Floating icons remain a background treatment, so the foreground content keeps normal focus and pointer behaviour.</p>
|
|
135
|
+
</zn-sp>
|
|
136
|
+
</zn-background>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## CSS customisation
|
|
140
|
+
|
|
141
|
+
Use `--zn-background-image-position` to change the image focal point, `--zn-background-overlay-angle` to turn the overlay gradient, and `--zn-background-floating-icon-color` to recolour the ambient icons. `--zn-background-color` provides a reusable fallback when the `color` attribute is omitted.
|
|
142
|
+
|
|
143
|
+
The `base`, `image`, `overlay`, `floating-icons`, `floating-icon`, and `content` CSS parts are available for application-specific treatments that cannot be expressed with the attributes or custom properties.
|
|
@@ -106,6 +106,18 @@ This option can be combined with the `horizontal` attribute.
|
|
|
106
106
|
:::tip
|
|
107
107
|
When [checkboxes](/components/checkbox) are wrapped with the Checkbox Group , adding the `contained` attribute to the
|
|
108
108
|
parent Checkbox Group or to _any_ checkbox in the group will create `contained` checkboxes for the entire group.
|
|
109
|
+
|
|
110
|
+
Contained checkboxes can also render as [multi-select cards](/components/checkbox#multi-select-cards) with an image,
|
|
111
|
+
title, description, and positioned indicator. The checkbox group continues to manage validation and submits every
|
|
112
|
+
selected value under the group's name.
|
|
113
|
+
|
|
114
|
+
Contained checkboxes are rounded by default; add `square` to the group to square off every checkbox in it. With
|
|
115
|
+
`horizontal`, cards in a row are given equal height, and `--zn-checkbox-group-column-width` (default `152px`) sets the
|
|
116
|
+
minimum column width used by the grid.
|
|
117
|
+
|
|
118
|
+
Add `wrap` to lay the checkboxes out as a wrapping row instead of an equal-width grid: each card starts from
|
|
119
|
+
`--zn-checkbox-group-column-width` and grows to fill its line, and setting that property to `auto` sizes every card from
|
|
120
|
+
its own content.
|
|
109
121
|
:::
|
|
110
122
|
|
|
111
123
|
### Disabling Options
|
|
@@ -193,4 +205,4 @@ make the browser display the error message you provide. To clear the error, call
|
|
|
193
205
|
});
|
|
194
206
|
});
|
|
195
207
|
</script>
|
|
196
|
-
```
|
|
208
|
+
```
|
|
@@ -188,6 +188,64 @@ Add the `contained` attribute to draw a card-like container around a checkbox. T
|
|
|
188
188
|
When checkboxes are wrapped with [Checkbox Group](/components/checkbox-group), adding the `contained` attribute to the parent Checkbox Group or to _any_ checkbox in the group will create `contained` checkboxes for the entire group.
|
|
189
189
|
:::
|
|
190
190
|
|
|
191
|
+
### Multi-select Cards
|
|
192
|
+
|
|
193
|
+
Contained checkboxes support the same card content and placement options as [contained radios](/components/radio#selection-cards),
|
|
194
|
+
while preserving checkbox semantics. Use them inside `zn-checkbox-group` when people may select more than one card.
|
|
195
|
+
|
|
196
|
+
Set the title with `card-title` (or use the default slot), supporting text with `description`, and an image with `src`
|
|
197
|
+
and `image-alt` or the `image` slot. `image-position` accepts `top`, `right`, `bottom`, and `left`. Cards are rounded
|
|
198
|
+
by default; add `square` to the group to square off every card.
|
|
199
|
+
|
|
200
|
+
```html:preview
|
|
201
|
+
<zn-checkbox-group
|
|
202
|
+
label="Choose benefits"
|
|
203
|
+
help-text="Select all that apply"
|
|
204
|
+
name="benefits"
|
|
205
|
+
contained
|
|
206
|
+
horizontal>
|
|
207
|
+
<zn-checkbox
|
|
208
|
+
value="health"
|
|
209
|
+
card-title="Health insurance"
|
|
210
|
+
description="Medical and dental cover."
|
|
211
|
+
image-position="top"
|
|
212
|
+
control-position="top-right">
|
|
213
|
+
<zn-icon slot="image" src="health_and_safety" size="64"></zn-icon>
|
|
214
|
+
</zn-checkbox>
|
|
215
|
+
<zn-checkbox
|
|
216
|
+
value="pension"
|
|
217
|
+
card-title="Pension"
|
|
218
|
+
description="Employer contribution matching."
|
|
219
|
+
image-position="top"
|
|
220
|
+
control-position="top-right">
|
|
221
|
+
<zn-icon slot="image" src="savings" size="64"></zn-icon>
|
|
222
|
+
</zn-checkbox>
|
|
223
|
+
</zn-checkbox-group>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
Image and control placement is identical for radio and checkbox cards. See the
|
|
227
|
+
[image and indicator position examples](/components/radio#image-and-indicator-positions) for a visual matrix of the
|
|
228
|
+
four image directions, indicator corners, centered edge positions, and a hidden indicator.
|
|
229
|
+
|
|
230
|
+
`control-position` accepts `top-left`, `top-center`, `top-right`, `center-left`, `center`, `center-right`,
|
|
231
|
+
`bottom-left`, `bottom-center`, and `bottom-right`. The default `start` position retains the standard inline checkbox;
|
|
232
|
+
use `none` to hide the indicator so the card itself shows the selected state, while keeping checkbox semantics and the
|
|
233
|
+
full-card click target — see [hiding the input](/components/radio#hiding-the-radio-input) for what that looks like.
|
|
234
|
+
|
|
235
|
+
```html:preview
|
|
236
|
+
<zn-checkbox-group label="Choose add-ons" name="addons" contained horizontal wrap>
|
|
237
|
+
<zn-checkbox value="support" card-title="Priority support" description="One hour response time" control-position="none"></zn-checkbox>
|
|
238
|
+
<zn-checkbox value="backups" card-title="Daily backups" description="Retained for 30 days" control-position="none"></zn-checkbox>
|
|
239
|
+
<zn-checkbox value="audit" card-title="Audit log" description="Exportable as CSV" control-position="none"></zn-checkbox>
|
|
240
|
+
</zn-checkbox-group>
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Card dimensions can be adjusted with `--zn-selection-card-image-width`, `--zn-selection-card-image-height`,
|
|
244
|
+
`--zn-selection-card-min-height`, `--zn-selection-card-content-min-width`, and `--zn-selection-card-title-font-size`.
|
|
245
|
+
Use `--zn-selection-card-padding` for the inset around the card, `--zn-selection-card-gap` for the space between its
|
|
246
|
+
regions, `--zn-selection-card-control-offset` for indicator placement, `--zn-selection-card-border-radius` for the
|
|
247
|
+
corner radius, and `--zn-checkbox-group-column-width` on the group to control how many cards sit in a row.
|
|
248
|
+
|
|
191
249
|
### Borderless
|
|
192
250
|
|
|
193
251
|
Use the `borderless` attribute to remove borders from the checkbox.
|
|
@@ -483,4 +541,4 @@ Checkboxes provide several methods for programmatic control:
|
|
|
483
541
|
alert('Checkbox is ' + (isValid ? 'valid' : 'invalid'));
|
|
484
542
|
});
|
|
485
543
|
</script>
|
|
486
|
-
```
|
|
544
|
+
```
|
|
@@ -161,6 +161,18 @@ This option can be combined with the `horizontal` attribute.
|
|
|
161
161
|
:::tip
|
|
162
162
|
When [radios](/components/radio) are wrapped with the Radio Group, adding the `contained` attribute to the
|
|
163
163
|
parent Radio Group or to _any_ radio in the group will create `contained` radios for the entire group.
|
|
164
|
+
|
|
165
|
+
Contained radios can also render as richer [selection cards](/components/radio#selection-cards) with an image, title,
|
|
166
|
+
description, and positioned indicator. The radio group continues to manage their single selection, validation,
|
|
167
|
+
keyboard navigation, and submitted form value.
|
|
168
|
+
|
|
169
|
+
Contained radios are rounded by default; add `square` to the group to square off every radio in it. With
|
|
170
|
+
`horizontal`, cards in a row are given equal height, and `--zn-radio-group-column-width` (default `152px`) sets the
|
|
171
|
+
minimum column width used by the grid.
|
|
172
|
+
|
|
173
|
+
Add `wrap` to lay the radios out as a wrapping row instead of an equal-width grid: each card starts from
|
|
174
|
+
`--zn-radio-group-column-width` and grows to fill its line, and setting that property to `auto` sizes every card from
|
|
175
|
+
its own content.
|
|
164
176
|
:::
|
|
165
177
|
|
|
166
178
|
### Disabling Options
|
|
@@ -111,6 +111,194 @@ Add the `contained` attribute to draw a card-like container around a radio. This
|
|
|
111
111
|
<zn-radio name="payment" value="bank" description="Direct bank transfer (3-5 business days)" contained>Bank Transfer</zn-radio>
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
Containers are rounded by default. Add `square` to square off the corners; setting it on a
|
|
115
|
+
[radio group](/components/radio-group) squares every radio in the group.
|
|
116
|
+
|
|
117
|
+
```html:preview
|
|
118
|
+
<zn-radio-group name="delivery" value="standard" contained square>
|
|
119
|
+
<zn-radio value="standard" description="Arrives in 3-5 working days">Standard delivery</zn-radio>
|
|
120
|
+
<zn-radio value="express" description="Arrives the next working day">Express delivery</zn-radio>
|
|
121
|
+
</zn-radio-group>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Selection Cards
|
|
125
|
+
|
|
126
|
+
A contained radio can combine an image, title, supporting text, and a freely positioned radio indicator. Set the title
|
|
127
|
+
with `card-title` (or use the default slot), and set supporting text with `description` (or the `description` slot).
|
|
128
|
+
Provide an image with `src` and `image-alt`, or place richer content such as `zn-icon` in the `image` slot.
|
|
129
|
+
|
|
130
|
+
Use these cards inside [`zn-radio-group`](/components/radio-group) for a single-select form input. Adding both
|
|
131
|
+
`contained` and `horizontal` to the group produces a responsive grid of equal-height cards that stacks when the
|
|
132
|
+
available width becomes narrow.
|
|
133
|
+
|
|
134
|
+
```html:preview
|
|
135
|
+
<zn-radio-group label="Choose a pricing plan" name="plan" value="complete" contained horizontal>
|
|
136
|
+
<zn-radio
|
|
137
|
+
value="basic"
|
|
138
|
+
card-title="Basic"
|
|
139
|
+
description="For smaller businesses, with simple salaries and pay schedules."
|
|
140
|
+
control-position="top-right">
|
|
141
|
+
<zn-icon slot="image" src="support" size="64"></zn-icon>
|
|
142
|
+
</zn-radio>
|
|
143
|
+
<zn-radio
|
|
144
|
+
value="complete"
|
|
145
|
+
card-title="Complete"
|
|
146
|
+
description="For growing businesses that want to create a rewarding place to work."
|
|
147
|
+
control-position="top-right">
|
|
148
|
+
<zn-icon slot="image" src="potted_plant" size="64"></zn-icon>
|
|
149
|
+
</zn-radio>
|
|
150
|
+
</zn-radio-group>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
#### Image and Indicator Positions
|
|
154
|
+
|
|
155
|
+
Set `image-position` to `top`, `right`, `bottom`, or `left` (the default), and `control-position` to any corner,
|
|
156
|
+
edge centre, or `center`. Content is never placed underneath a positioned indicator — the card reserves a gutter for
|
|
157
|
+
it — so wider columns leave more room for text. Use `--zn-radio-group-column-width` on the group to control how many
|
|
158
|
+
cards sit in a row, or add `wrap` to the group to let cards grow to fill each line instead of sharing equal-width
|
|
159
|
+
columns.
|
|
160
|
+
|
|
161
|
+
```html:preview
|
|
162
|
+
<zn-radio-group
|
|
163
|
+
label="Card position examples"
|
|
164
|
+
name="position-example"
|
|
165
|
+
contained
|
|
166
|
+
horizontal
|
|
167
|
+
style="--zn-radio-group-column-width: 24rem;">
|
|
168
|
+
<zn-radio
|
|
169
|
+
value="top"
|
|
170
|
+
card-title="Image above"
|
|
171
|
+
description="Top image, top-left control."
|
|
172
|
+
image-position="top"
|
|
173
|
+
control-position="top-left"
|
|
174
|
+
checked>
|
|
175
|
+
<zn-icon slot="image" src="image" size="48"></zn-icon>
|
|
176
|
+
</zn-radio>
|
|
177
|
+
<zn-radio
|
|
178
|
+
value="right"
|
|
179
|
+
card-title="Image right"
|
|
180
|
+
description="Right image, top-right control."
|
|
181
|
+
image-position="right"
|
|
182
|
+
control-position="top-right">
|
|
183
|
+
<zn-icon slot="image" src="image" size="48"></zn-icon>
|
|
184
|
+
</zn-radio>
|
|
185
|
+
<zn-radio
|
|
186
|
+
value="bottom"
|
|
187
|
+
card-title="Image below"
|
|
188
|
+
description="Bottom image, bottom-left control."
|
|
189
|
+
image-position="bottom"
|
|
190
|
+
control-position="bottom-left">
|
|
191
|
+
<zn-icon slot="image" src="image" size="48"></zn-icon>
|
|
192
|
+
</zn-radio>
|
|
193
|
+
<zn-radio
|
|
194
|
+
value="left"
|
|
195
|
+
card-title="Image left"
|
|
196
|
+
description="Left image, bottom-right control."
|
|
197
|
+
image-position="left"
|
|
198
|
+
control-position="bottom-right">
|
|
199
|
+
<zn-icon slot="image" src="image" size="48"></zn-icon>
|
|
200
|
+
</zn-radio>
|
|
201
|
+
</zn-radio-group>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### Indicators on an Edge
|
|
205
|
+
|
|
206
|
+
The indicator can also be centred along any edge of the card.
|
|
207
|
+
|
|
208
|
+
```html:preview
|
|
209
|
+
<zn-radio-group
|
|
210
|
+
label="Additional indicator positions"
|
|
211
|
+
name="control-example"
|
|
212
|
+
contained
|
|
213
|
+
horizontal
|
|
214
|
+
style="--zn-radio-group-column-width: 18rem;">
|
|
215
|
+
<zn-radio
|
|
216
|
+
value="top-center"
|
|
217
|
+
card-title="Top center"
|
|
218
|
+
description="Centered along the top edge."
|
|
219
|
+
control-position="top-center">
|
|
220
|
+
<zn-icon slot="image" src="filter_center_focus" size="48"></zn-icon>
|
|
221
|
+
</zn-radio>
|
|
222
|
+
<zn-radio
|
|
223
|
+
value="center-right"
|
|
224
|
+
card-title="Center right"
|
|
225
|
+
description="Centered along the right edge."
|
|
226
|
+
control-position="center-right">
|
|
227
|
+
<zn-icon slot="image" src="filter_center_focus" size="48"></zn-icon>
|
|
228
|
+
</zn-radio>
|
|
229
|
+
<zn-radio
|
|
230
|
+
value="bottom-center"
|
|
231
|
+
card-title="Bottom center"
|
|
232
|
+
description="Centered along the bottom edge."
|
|
233
|
+
control-position="bottom-center">
|
|
234
|
+
<zn-icon slot="image" src="filter_center_focus" size="48"></zn-icon>
|
|
235
|
+
</zn-radio>
|
|
236
|
+
</zn-radio-group>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
#### Hiding the Radio Input
|
|
240
|
+
|
|
241
|
+
Set `control-position="none"` to hide the radio itself so the card *is* the control — selection is shown by the card's
|
|
242
|
+
highlighted border and background alone. Nothing is removed from the DOM: the native radio still receives focus, still
|
|
243
|
+
responds to arrow keys within a [radio group](/components/radio-group), still submits its value, and the whole card
|
|
244
|
+
stays clickable. Focusing a card in this state draws a focus ring around the card.
|
|
245
|
+
|
|
246
|
+
```html:preview
|
|
247
|
+
<zn-radio-group label="Choose a theme" name="theme" value="light" contained horizontal>
|
|
248
|
+
<zn-radio
|
|
249
|
+
value="light"
|
|
250
|
+
card-title="Light"
|
|
251
|
+
description="Bright background with dark text."
|
|
252
|
+
image-position="top"
|
|
253
|
+
control-position="none">
|
|
254
|
+
<zn-icon slot="image" src="light_mode" size="48"></zn-icon>
|
|
255
|
+
</zn-radio>
|
|
256
|
+
<zn-radio
|
|
257
|
+
value="dark"
|
|
258
|
+
card-title="Dark"
|
|
259
|
+
description="Dark background with light text."
|
|
260
|
+
image-position="top"
|
|
261
|
+
control-position="none">
|
|
262
|
+
<zn-icon slot="image" src="dark_mode" size="48"></zn-icon>
|
|
263
|
+
</zn-radio>
|
|
264
|
+
<zn-radio
|
|
265
|
+
value="system"
|
|
266
|
+
card-title="System"
|
|
267
|
+
description="Follows your device setting."
|
|
268
|
+
image-position="top"
|
|
269
|
+
control-position="none">
|
|
270
|
+
<zn-icon slot="image" src="contrast" size="48"></zn-icon>
|
|
271
|
+
</zn-radio>
|
|
272
|
+
</zn-radio-group>
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
It works just as well without an image, which gives a compact set of button-like options.
|
|
276
|
+
|
|
277
|
+
```html:preview
|
|
278
|
+
<zn-radio-group label="Billing period" name="billing" value="annual" contained horizontal wrap>
|
|
279
|
+
<zn-radio value="monthly" card-title="Monthly" description="£29 per month" control-position="none"></zn-radio>
|
|
280
|
+
<zn-radio value="annual" card-title="Annual" description="£290 per year, two months free" control-position="none"></zn-radio>
|
|
281
|
+
</zn-radio-group>
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
:::warning
|
|
285
|
+
Because a hidden indicator removes the usual radio affordance, keep the selected state obvious — a short title with
|
|
286
|
+
supporting text, as above, reads better than an image on its own.
|
|
287
|
+
:::
|
|
288
|
+
|
|
289
|
+
:::tip
|
|
290
|
+
Card attributes only apply to `contained` radios. `control-position` accepts `top-left`, `top-center`, `top-right`,
|
|
291
|
+
`center-left`, `center`, `center-right`, `bottom-left`, `bottom-center`, `bottom-right`, `none`, and the default
|
|
292
|
+
`start`, which keeps the standard inline radio.
|
|
293
|
+
:::
|
|
294
|
+
|
|
295
|
+
Card dimensions can be adjusted with `--zn-selection-card-image-width`, `--zn-selection-card-image-height`,
|
|
296
|
+
`--zn-selection-card-min-height`, and `--zn-selection-card-title-font-size`. Use `--zn-selection-card-padding` for the
|
|
297
|
+
inset around the card, `--zn-selection-card-gap` for the space between its regions,
|
|
298
|
+
`--zn-selection-card-control-offset` to change the indicator's distance from an edge,
|
|
299
|
+
`--zn-selection-card-content-min-width` for the width the text keeps before it wraps below a side image, and
|
|
300
|
+
`--zn-selection-card-border-radius` for the corner radius.
|
|
301
|
+
|
|
114
302
|
### Horizontal Layout
|
|
115
303
|
|
|
116
304
|
Use the `horizontal` attribute to apply styles relevant to radios in a horizontal layout.
|
|
@@ -135,6 +135,28 @@ NOTE: The value is the same remarkd source either way."
|
|
|
135
135
|
></zn-remarkd-editor>
|
|
136
136
|
```
|
|
137
137
|
|
|
138
|
+
### Height
|
|
139
|
+
|
|
140
|
+
The editor never grows taller than the viewport: past that, its body scrolls and
|
|
141
|
+
the toolbar stays in reach. Override the cap with `--remarkd-editor-max-height` —
|
|
142
|
+
useful when the editor sits below a header and should only fill the space left on
|
|
143
|
+
screen.
|
|
144
|
+
|
|
145
|
+
All scrolling stays inside the editor's own body: adding a block or opening the
|
|
146
|
+
image / include picker brings the new content into view, and dragging a block to a
|
|
147
|
+
scroll edge keeps the content moving. Neither touches the page or panel around the
|
|
148
|
+
editor.
|
|
149
|
+
|
|
150
|
+
```html:preview
|
|
151
|
+
<zn-remarkd-editor
|
|
152
|
+
style="--remarkd-editor-max-height: 20rem"
|
|
153
|
+
value="A short editor.
|
|
154
|
+
|
|
155
|
+
Add blocks from the toolbar and the body starts scrolling once the content
|
|
156
|
+
outgrows the 20rem cap set here."
|
|
157
|
+
></zn-remarkd-editor>
|
|
158
|
+
```
|
|
159
|
+
|
|
138
160
|
### Form Integration
|
|
139
161
|
|
|
140
162
|
`zn-remarkd-editor` is a [form control](/getting-started/form-controls); its
|
|
@@ -5,10 +5,10 @@ meta:
|
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
The scroll container provides a flexible scrolling area with optional header and footer slots that remain fixed while the main content scrolls. It supports automatic scrolling to the bottom, making it ideal for chat applications, activity feeds, and log viewers.
|
|
8
|
+
The scroll container provides a flexible scrolling area with optional header and footer slots that remain fixed while the main content scrolls. It supports automatic scrolling to the bottom, making it ideal for chat applications, activity feeds, and log viewers. Set `height` to constrain the block-level container and enable scrolling when its content exceeds that height.
|
|
9
9
|
|
|
10
10
|
```html:preview
|
|
11
|
-
<zn-scroll-container
|
|
11
|
+
<zn-scroll-container height="300px" style="border: 1px solid var(--zn-color-neutral-200);">
|
|
12
12
|
<div slot="header" style="padding: 1rem; background: var(--zn-color-neutral-100); border-bottom: 1px solid var(--zn-color-neutral-200);">
|
|
13
13
|
<strong>Header Area</strong>
|
|
14
14
|
</div>
|
|
@@ -39,7 +39,7 @@ The scroll container provides a flexible scrolling area with optional header and
|
|
|
39
39
|
The most common use case is a simple vertical scrolling container. The main content area scrolls while header and footer remain fixed.
|
|
40
40
|
|
|
41
41
|
```html:preview
|
|
42
|
-
<zn-scroll-container
|
|
42
|
+
<zn-scroll-container height="400px" style="border: 1px solid var(--zn-color-neutral-200); border-radius: 4px; overflow: hidden;">
|
|
43
43
|
<div style="padding: 1rem;">
|
|
44
44
|
<h3 style="margin-top: 0;">Scrollable Content Area</h3>
|
|
45
45
|
<p>This container has a fixed height and the content will scroll vertically when it exceeds the available space.</p>
|
|
@@ -60,7 +60,7 @@ The most common use case is a simple vertical scrolling container. The main cont
|
|
|
60
60
|
Use the `header` slot to add a fixed header that remains visible while content scrolls.
|
|
61
61
|
|
|
62
62
|
```html:preview
|
|
63
|
-
<zn-scroll-container
|
|
63
|
+
<zn-scroll-container height="350px" style="border: 1px solid var(--zn-color-neutral-200); border-radius: 4px; overflow: hidden;">
|
|
64
64
|
<div slot="header" style="padding: 1rem; background: var(--zn-color-primary-50); border-bottom: 2px solid var(--zn-color-primary-200);">
|
|
65
65
|
<h3 style="margin: 0;">Document Title</h3>
|
|
66
66
|
<p style="margin: 0.5rem 0 0 0; font-size: 0.875rem; color: var(--zn-color-neutral-600);">Last updated: January 23, 2026</p>
|
|
@@ -91,7 +91,7 @@ Use the `header` slot to add a fixed header that remains visible while content s
|
|
|
91
91
|
Use the `footer` slot to add a fixed footer that remains at the bottom. The footer is positioned absolutely and the scrollable area has padding to account for its height.
|
|
92
92
|
|
|
93
93
|
```html:preview
|
|
94
|
-
<zn-scroll-container
|
|
94
|
+
<zn-scroll-container height="350px" style="border: 1px solid var(--zn-color-neutral-200); border-radius: 4px; overflow: hidden;">
|
|
95
95
|
<div style="padding: 1rem;">
|
|
96
96
|
<h4>Content Area</h4>
|
|
97
97
|
<p>The footer remains fixed at the bottom while this content scrolls.</p>
|
|
@@ -116,7 +116,7 @@ Use the `footer` slot to add a fixed footer that remains at the bottom. The foot
|
|
|
116
116
|
Combine both header and footer slots for maximum control. The scrollable area sits between them.
|
|
117
117
|
|
|
118
118
|
```html:preview
|
|
119
|
-
<zn-scroll-container
|
|
119
|
+
<zn-scroll-container height="400px" style="border: 1px solid var(--zn-color-neutral-200); border-radius: 4px; overflow: hidden;">
|
|
120
120
|
<div slot="header" style="padding: 1rem; background: var(--zn-color-neutral-100); border-bottom: 1px solid var(--zn-color-neutral-200);">
|
|
121
121
|
<h3 style="margin: 0;">Messages</h3>
|
|
122
122
|
</div>
|
|
@@ -156,7 +156,7 @@ Combine both header and footer slots for maximum control. The scrollable area si
|
|
|
156
156
|
Use the `start-scrolled` attribute to automatically scroll to the bottom when the component loads or when new content is added. This is perfect for chat interfaces, activity logs, and notification feeds.
|
|
157
157
|
|
|
158
158
|
```html:preview
|
|
159
|
-
<zn-scroll-container start-scrolled style="
|
|
159
|
+
<zn-scroll-container height="300px" start-scrolled style="border: 1px solid var(--zn-color-neutral-200); border-radius: 4px; overflow: hidden;">
|
|
160
160
|
<div slot="header" style="padding: 1rem; background: var(--zn-color-neutral-100); border-bottom: 1px solid var(--zn-color-neutral-200);">
|
|
161
161
|
<h4 style="margin: 0;">Activity Log</h4>
|
|
162
162
|
</div>
|
|
@@ -198,7 +198,7 @@ Use the `start-scrolled` attribute to automatically scroll to the bottom when th
|
|
|
198
198
|
A practical example showing how to build a chat interface with auto-scrolling and dynamic content.
|
|
199
199
|
|
|
200
200
|
```html:preview
|
|
201
|
-
<zn-scroll-container id="chat-example" start-scrolled style="
|
|
201
|
+
<zn-scroll-container id="chat-example" height="450px" start-scrolled style="border: 1px solid var(--zn-color-neutral-200); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1);">
|
|
202
202
|
<div slot="header" style="padding: 1rem; background: var(--zn-color-primary); color: white; display: flex; align-items: center; gap: 0.75rem;">
|
|
203
203
|
<div style="width: 40px; height: 40px; border-radius: 50%; background: var(--zn-color-primary-700); display: flex; align-items: center; justify-content: center; font-weight: bold;">
|
|
204
204
|
TC
|
|
@@ -274,7 +274,7 @@ A practical example showing how to build a chat interface with auto-scrolling an
|
|
|
274
274
|
Perfect for displaying server logs, build output, or any streaming text content.
|
|
275
275
|
|
|
276
276
|
```html:preview
|
|
277
|
-
<zn-scroll-container start-scrolled style="
|
|
277
|
+
<zn-scroll-container height="350px" start-scrolled style="border: 1px solid var(--zn-color-neutral-800); border-radius: 4px; overflow: hidden; background: var(--zn-color-neutral-900);">
|
|
278
278
|
<div slot="header" style="padding: 0.75rem 1rem; background: var(--zn-color-neutral-800); color: var(--zn-color-neutral-200); font-family: monospace; font-size: 0.875rem; border-bottom: 1px solid var(--zn-color-neutral-700);">
|
|
279
279
|
<strong>build.log</strong> - Application Build Output
|
|
280
280
|
</div>
|
|
@@ -307,7 +307,7 @@ Perfect for displaying server logs, build output, or any streaming text content.
|
|
|
307
307
|
A practical example showing an activity feed that automatically scrolls to show the latest activity.
|
|
308
308
|
|
|
309
309
|
```html:preview
|
|
310
|
-
<zn-scroll-container id="activity-feed" start-scrolled style="
|
|
310
|
+
<zn-scroll-container id="activity-feed" height="400px" start-scrolled style="border: 1px solid var(--zn-color-neutral-200); border-radius: 4px; overflow: hidden;">
|
|
311
311
|
<div slot="header" style="padding: 1rem; background: var(--zn-color-neutral-50); border-bottom: 1px solid var(--zn-color-neutral-200); display: flex; justify-content: space-between; align-items: center;">
|
|
312
312
|
<h4 style="margin: 0;">Recent Activity</h4>
|
|
313
313
|
<zn-chip size="small" type="info">Live</zn-chip>
|
|
@@ -358,7 +358,7 @@ A practical example showing an activity feed that automatically scrolls to show
|
|
|
358
358
|
A comprehensive example showing how to build a notification center with categorized notifications.
|
|
359
359
|
|
|
360
360
|
```html:preview
|
|
361
|
-
<zn-scroll-container start-scrolled style="
|
|
361
|
+
<zn-scroll-container height="450px" start-scrolled style="border: 1px solid var(--zn-color-neutral-200); border-radius: 8px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.1);">
|
|
362
362
|
<div slot="header" style="padding: 1.25rem; background: var(--zn-color-white); border-bottom: 1px solid var(--zn-color-neutral-200);">
|
|
363
363
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
364
364
|
<div>
|
|
@@ -460,7 +460,7 @@ A comprehensive example showing how to build a notification center with categori
|
|
|
460
460
|
You can programmatically scroll to the bottom using the `scrollEnd()` method.
|
|
461
461
|
|
|
462
462
|
```html:preview
|
|
463
|
-
<zn-scroll-container id="programmatic-scroll"
|
|
463
|
+
<zn-scroll-container id="programmatic-scroll" height="300px" style="border: 1px solid var(--zn-color-neutral-200); border-radius: 4px; overflow: hidden;">
|
|
464
464
|
<div id="scroll-content" style="padding: 1rem;">
|
|
465
465
|
<p>Content line 1</p>
|
|
466
466
|
<p>Content line 2</p>
|
|
@@ -507,7 +507,7 @@ You can programmatically scroll to the bottom using the `scrollEnd()` method.
|
|
|
507
507
|
The footer's height is automatically tracked and the scrollable area adjusts accordingly. This happens dynamically when the footer content changes size.
|
|
508
508
|
|
|
509
509
|
```html:preview
|
|
510
|
-
<zn-scroll-container start-scrolled style="
|
|
510
|
+
<zn-scroll-container height="400px" start-scrolled style="border: 1px solid var(--zn-color-neutral-200); border-radius: 4px; overflow: hidden;">
|
|
511
511
|
<div style="padding: 1rem;">
|
|
512
512
|
<p>The scrollable area automatically adjusts its padding based on the footer's height.</p>
|
|
513
513
|
<p>This ensures that content is never hidden behind the fixed footer.</p>
|
|
@@ -552,7 +552,7 @@ The footer's height is automatically tracked and the scrollable area adjusts acc
|
|
|
552
552
|
A minimal example showing just the essential markup.
|
|
553
553
|
|
|
554
554
|
```html:preview
|
|
555
|
-
<zn-scroll-container
|
|
555
|
+
<zn-scroll-container height="250px" style="border: 1px solid var(--zn-color-neutral-200);">
|
|
556
556
|
<div style="padding: 1rem;">
|
|
557
557
|
<p>Simple scrollable content without header or footer.</p>
|
|
558
558
|
<p>Just add content to the default slot.</p>
|
|
@@ -565,4 +565,3 @@ A minimal example showing just the essential markup.
|
|
|
565
565
|
</zn-scroll-container>
|
|
566
566
|
```
|
|
567
567
|
|
|
568
|
-
|