@kubex/zinc 1.0.24 → 1.0.98
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/.claude/project.md +556 -0
- package/.github/workflows/js_build_and_deploy.yaml +9 -10
- package/dist/custom-elements.json +13431 -8728
- package/dist/vscode.html-custom-data.json +571 -37
- package/dist/web-types.json +1439 -181
- package/dist/zn.d.ts +1642 -661
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +1407 -887
- package/docs/_utilities/code-previews.cjs +10 -1
- package/docs/assets/scripts/docs.js +42 -18
- package/docs/data/data-table.json +229 -66
- package/docs/data/empty.json +6 -0
- package/docs/data/products-table.json +41 -193
- package/docs/pages/components/action-bar.md +121 -6
- package/docs/pages/components/alert.md +118 -15
- package/docs/pages/components/animated-button.md +299 -0
- package/docs/pages/components/audio-select.md +534 -0
- package/docs/pages/components/bulk-actions.md +79 -5
- package/docs/pages/components/button-group.md +235 -27
- package/docs/pages/components/button.md +139 -1
- package/docs/pages/components/chart.md +365 -9
- package/docs/pages/components/checkbox.md +387 -58
- package/docs/pages/components/chip.md +253 -33
- package/docs/pages/components/collapsible.md +393 -46
- package/docs/pages/components/cols.md +152 -30
- package/docs/pages/components/confirm.md +182 -16
- package/docs/pages/components/copy-button.md +169 -6
- package/docs/pages/components/data-select.md +194 -15
- package/docs/pages/components/data-table-filter.md +96 -5
- package/docs/pages/components/data-table-search.md +451 -0
- package/docs/pages/components/data-table-sort.md +66 -5
- package/docs/pages/components/data-table.md +727 -66
- package/docs/pages/components/datepicker.md +402 -7
- package/docs/pages/components/defined-label.md +120 -5
- package/docs/pages/components/dialog.md +339 -59
- package/docs/pages/components/dropdown.md +366 -11
- package/docs/pages/components/editor.md +604 -7
- package/docs/pages/components/empty-state.md +315 -16
- package/docs/pages/components/expanding-action.md +212 -28
- package/docs/pages/components/file.md +421 -12
- package/docs/pages/components/filter-container.md +158 -5
- package/docs/pages/components/filter-wrapper.md +167 -6
- package/docs/pages/components/form-group.md +383 -6
- package/docs/pages/components/hover-container.md +237 -6
- package/docs/pages/components/icon-picker.md +121 -0
- package/docs/pages/components/icon.md +454 -48
- package/docs/pages/components/inline-edit.md +787 -19
- package/docs/pages/components/input-group.md +207 -13
- package/docs/pages/components/input.md +194 -0
- package/docs/pages/components/key-container.md +115 -0
- package/docs/pages/components/key.md +101 -0
- package/docs/pages/components/menu.md +512 -6
- package/docs/pages/components/note.md +239 -36
- package/docs/pages/components/opt-group.md +107 -0
- package/docs/pages/components/pagination.md +332 -6
- package/docs/pages/components/pane.md +222 -6
- package/docs/pages/components/panel.md +213 -26
- package/docs/pages/components/popup.md +1354 -6
- package/docs/pages/components/priority-list.md +233 -0
- package/docs/pages/components/progress-bar.md +387 -6
- package/docs/pages/components/radio-group.md +242 -5
- package/docs/pages/components/radio.md +474 -6
- package/docs/pages/components/rating.md +331 -7
- package/docs/pages/components/reveal.md +524 -6
- package/docs/pages/components/scroll-container.md +552 -6
- package/docs/pages/components/select.md +762 -160
- package/docs/pages/components/skeleton.md +473 -30
- package/docs/pages/components/slideout.md +261 -5
- package/docs/pages/components/sp.md +99 -41
- package/docs/pages/components/split-button.md +347 -9
- package/docs/pages/components/split-pane.md +445 -6
- package/docs/pages/components/stat.md +549 -9
- package/docs/pages/components/status-indicator.md +230 -1
- package/docs/pages/components/stepper.md +563 -6
- package/docs/pages/components/tabs.md +439 -13
- package/docs/pages/components/textarea.md +415 -17
- package/docs/pages/components/tile.md +385 -26
- package/docs/pages/components/toggle.md +424 -6
- package/docs/pages/components/tooltip.md +367 -0
- package/docs/pages/components/translation-group.md +210 -0
- package/docs/pages/components/translations.md +319 -18
- package/docs/pages/components/vertical-stepper.md +401 -8
- package/docs/pages/components/well.md +300 -3
- package/docs/pages/getting-started/form-controls.md +162 -0
- package/docs/pages/index.md +116 -15
- package/package.json +5 -6
- package/scss/_global-spacing.scss +4 -0
- package/scss/_root.scss +2 -2
- package/scss/boot.scss +19 -0
- package/scss/shared/layout.scss +5 -0
- package/scss/themes/_light.scss +3 -3
- package/src/components/alert/alert.scss +1 -0
- package/src/components/animated-button/README.md +306 -0
- package/src/components/animated-button/animated-button.component.ts +229 -0
- package/src/components/animated-button/animated-button.scss +228 -0
- package/src/components/animated-button/animated-button.test.ts +143 -0
- package/src/components/animated-button/index.ts +12 -0
- package/src/components/button/button.component.ts +5 -0
- package/src/components/button-group/button-group.component.ts +25 -13
- package/src/components/button-group/button-group.scss +6 -0
- package/src/components/checkbox/checkbox.component.ts +4 -0
- package/src/components/checkbox/checkbox.scss +7 -4
- package/src/components/checkbox-group/checkbox-group.scss +7 -0
- package/src/components/chip/chip.component.ts +7 -2
- package/src/components/chip/chip.scss +16 -2
- package/src/components/collapsible/collapsible.component.ts +27 -20
- package/src/components/cols/cols.component.ts +14 -2
- package/src/components/cols/cols.scss +6 -12
- package/src/components/confirm/confirm.component.ts +7 -0
- package/src/components/copy-button/copy-button.component.ts +12 -11
- package/src/components/data-select/data-select.component.ts +215 -44
- package/src/components/data-select/data-select.scss +66 -6
- package/src/components/data-select/providers/currency-data-provider.ts +20 -6
- package/src/components/data-select/providers/provider.ts +1 -0
- package/src/components/data-select/providers/us-state-data-provider.ts +68 -0
- package/src/components/data-table/data-table.component.ts +82 -23
- package/src/components/data-table-search/data-table-search.component.ts +184 -0
- package/src/components/data-table-search/data-table-search.scss +17 -0
- package/src/components/data-table-search/data-table-search.test.ts +11 -0
- package/src/components/data-table-search/index.ts +12 -0
- package/src/components/datepicker/datepicker.component.ts +347 -13
- package/src/components/dialog/dialog.component.ts +1 -1
- package/src/components/empty-state/empty-state.scss +6 -1
- package/src/components/header/header.scss +3 -3
- package/src/components/icon/icon.component.ts +23 -1
- package/src/components/icon/icon.scss +23 -0
- package/src/components/icon-picker/brand-icons.ts +24 -0
- package/src/components/icon-picker/icon-picker.component.ts +407 -0
- package/src/components/icon-picker/icon-picker.scss +205 -0
- package/src/components/icon-picker/index.ts +12 -0
- package/src/components/icon-picker/line-icons.ts +612 -0
- package/src/components/icon-picker/material-icons.ts +14543 -0
- package/src/components/inline-edit/inline-edit.component.ts +190 -46
- package/src/components/inline-edit/inline-edit.scss +29 -0
- package/src/components/inline-edit/inline-edit.test.ts +314 -1
- package/src/components/input/input.component.ts +328 -5
- package/src/components/input/input.scss +100 -4
- package/src/components/input-group/input-group.component.ts +28 -7
- package/src/components/input-group/input-group.scss +48 -10
- package/src/components/item/item.component.ts +11 -2
- package/src/components/item/item.scss +7 -0
- package/src/components/key/index.ts +12 -0
- package/src/components/key/key.component.ts +47 -0
- package/src/components/key/key.scss +38 -0
- package/src/components/key-container/index.ts +12 -0
- package/src/components/key-container/key-container.component.ts +142 -0
- package/src/components/key-container/key-container.scss +33 -0
- package/src/components/menu-item/menu-item.component.ts +20 -0
- package/src/components/menu-item/menu-item.scss +69 -2
- package/src/components/navbar/navbar.component.ts +103 -8
- package/src/components/navbar/navbar.scss +6 -1
- package/src/components/opt-group/index.ts +12 -0
- package/src/components/opt-group/opt-group.component.ts +74 -0
- package/src/components/opt-group/opt-group.scss +37 -0
- package/src/components/opt-group/opt-group.test.ts +27 -0
- package/src/components/option/option.component.ts +1 -16
- package/src/components/option/option.scss +4 -0
- package/src/components/panel/panel.component.ts +10 -8
- package/src/components/panel/panel.scss +20 -0
- package/src/components/priority-list/index.ts +12 -0
- package/src/components/priority-list/priority-list.component.ts +611 -0
- package/src/components/priority-list/priority-list.scss +185 -0
- package/src/components/priority-list/priority-list.test.ts +139 -0
- package/src/components/progress-bar/progress-bar.component.ts +22 -16
- package/src/components/radio/radio.scss +10 -3
- package/src/components/select/select.component.ts +812 -72
- package/src/components/select/select.scss +108 -2
- package/src/components/select/select.test.ts +147 -2
- package/src/components/settings-container/settings-container.component.ts +44 -19
- package/src/components/settings-container/settings-container.scss +1 -1
- package/src/components/skeleton/skeleton.component.ts +6 -1
- package/src/components/slideout/slideout.scss +8 -3
- package/src/components/sp/sp.component.ts +3 -1
- package/src/components/sp/sp.scss +19 -0
- package/src/components/stepper/stepper.component.ts +16 -10
- package/src/components/textarea/textarea.scss +0 -4
- package/src/components/tile/tile.component.ts +12 -3
- package/src/components/tile/tile.scss +1 -1
- package/src/components/timer/timer.component.ts +15 -2
- package/src/components/toggle/toggle.component.ts +29 -26
- package/src/components/toggle/toggle.scss +13 -1
- package/src/components/translation-group/index.ts +12 -0
- package/src/components/translation-group/translation-group.component.ts +207 -0
- package/src/components/translation-group/translation-group.scss +8 -0
- package/src/components/translations/translations.component.ts +90 -42
- package/src/components/translations/translations.scss +5 -1
- package/src/components/vertical-stepper/vertical-stepper.component.ts +14 -9
- package/src/events/events.ts +12 -7
- package/src/events/zn-language-change.ts +7 -0
- package/src/events/zn-purchase.ts +11 -0
- package/src/events/zn-redirect.ts +7 -0
- package/src/events/zn-reorder.ts +7 -0
- package/src/events/zn-search-change.ts +11 -0
- package/src/events/zn-submit.ts +1 -1
- package/src/form-control.scss +4 -0
- package/src/internal/form-navigation.ts +510 -0
- package/src/internal/form.ts +6 -0
- package/src/zinc.ts +91 -83
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
meta:
|
|
3
3
|
title: Tabs
|
|
4
|
-
description:
|
|
4
|
+
description: Tabs organize content into separate views that users can switch between using tab navigation elements.
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
```html:preview
|
|
9
|
-
|
|
10
9
|
<zn-tabs caption="Example Panel" flush>
|
|
11
10
|
<zn-navbar slot="top">
|
|
12
11
|
<li tab>Customer</li>
|
|
@@ -27,31 +26,458 @@ layout: component
|
|
|
27
26
|
|
|
28
27
|
## Examples
|
|
29
28
|
|
|
30
|
-
###
|
|
29
|
+
### Basic Tabs
|
|
31
30
|
|
|
31
|
+
The tabs component works by connecting tab navigation elements (typically in a `zn-navbar` in the `top` slot) with content panels. Each panel is identified by an `id` attribute, and navigation items use a `tab` attribute to reference those IDs.
|
|
32
32
|
|
|
33
33
|
```html:preview
|
|
34
|
+
<zn-tabs flush>
|
|
35
|
+
<zn-navbar slot="top">
|
|
36
|
+
<li tab="">Overview</li>
|
|
37
|
+
<li tab="details">Details</li>
|
|
38
|
+
<li tab="settings">Settings</li>
|
|
39
|
+
</zn-navbar>
|
|
40
|
+
|
|
41
|
+
<zn-sp id="">
|
|
42
|
+
<p>Overview content goes here. This panel has an empty ID and is shown by default.</p>
|
|
43
|
+
</zn-sp>
|
|
44
|
+
|
|
45
|
+
<zn-sp id="details">
|
|
46
|
+
<p>Details panel content.</p>
|
|
47
|
+
</zn-sp>
|
|
34
48
|
|
|
49
|
+
<zn-sp id="settings">
|
|
50
|
+
<p>Settings panel content.</p>
|
|
51
|
+
</zn-sp>
|
|
52
|
+
</zn-tabs>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### With Caption and Description
|
|
56
|
+
|
|
57
|
+
Use the `caption` and `description` attributes to add a header to your tabs component.
|
|
58
|
+
|
|
59
|
+
```html:preview
|
|
60
|
+
<zn-tabs caption="User Profile" description="Manage user information and settings">
|
|
61
|
+
<zn-navbar slot="top">
|
|
62
|
+
<li tab="">Personal Info</li>
|
|
63
|
+
<li tab="preferences">Preferences</li>
|
|
64
|
+
</zn-navbar>
|
|
65
|
+
|
|
66
|
+
<zn-sp id="" padded>
|
|
67
|
+
<zn-inline-edit padded inline caption="Full Name" value="John Doe"></zn-inline-edit>
|
|
68
|
+
<zn-inline-edit padded inline caption="Email" value="john@example.com"></zn-inline-edit>
|
|
69
|
+
</zn-sp>
|
|
70
|
+
|
|
71
|
+
<zn-sp id="preferences" padded>
|
|
72
|
+
<zn-inline-edit padded inline caption="Theme" value="Light"></zn-inline-edit>
|
|
73
|
+
<zn-inline-edit padded inline caption="Language" value="English"></zn-inline-edit>
|
|
74
|
+
</zn-sp>
|
|
75
|
+
</zn-tabs>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Without Caption
|
|
79
|
+
|
|
80
|
+
Remove the `caption` attribute for a cleaner layout when a header is not needed.
|
|
81
|
+
|
|
82
|
+
```html:preview
|
|
35
83
|
<zn-tabs flush>
|
|
36
84
|
<zn-navbar slot="top">
|
|
37
|
-
<li tab>
|
|
38
|
-
<li tab="
|
|
85
|
+
<li tab="">Dashboard</li>
|
|
86
|
+
<li tab="reports">Reports</li>
|
|
87
|
+
<li tab="analytics">Analytics</li>
|
|
39
88
|
</zn-navbar>
|
|
40
89
|
|
|
41
|
-
<zn-sp id=""
|
|
42
|
-
<
|
|
43
|
-
<zn-inline-edit padded inline caption="Label 2" value="This is Awesome"></zn-inline-edit>
|
|
90
|
+
<zn-sp id="">
|
|
91
|
+
<p>Dashboard content.</p>
|
|
44
92
|
</zn-sp>
|
|
45
93
|
|
|
46
|
-
<zn-sp id="
|
|
47
|
-
<
|
|
48
|
-
|
|
94
|
+
<zn-sp id="reports">
|
|
95
|
+
<p>Reports content.</p>
|
|
96
|
+
</zn-sp>
|
|
97
|
+
|
|
98
|
+
<zn-sp id="analytics">
|
|
99
|
+
<p>Analytics content.</p>
|
|
100
|
+
</zn-sp>
|
|
101
|
+
</zn-tabs>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Dynamic Tabs with URI Loading
|
|
105
|
+
|
|
106
|
+
Use the `tab-uri` attribute to load content dynamically from a URL when a tab is clicked. The component will automatically fetch and display the content.
|
|
107
|
+
|
|
108
|
+
```html:preview
|
|
109
|
+
<zn-tabs flush no-prefetch>
|
|
110
|
+
<zn-navbar slot="top">
|
|
111
|
+
<li tab-uri="/api/content/overview">Overview</li>
|
|
112
|
+
<li tab-uri="/api/content/details">Details</li>
|
|
113
|
+
<li tab-uri="/api/content/settings">Settings</li>
|
|
114
|
+
</zn-navbar>
|
|
115
|
+
</zn-tabs>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Prefetching
|
|
119
|
+
|
|
120
|
+
By default, tabs with `tab-uri` will prefetch content on hover. Use the `no-prefetch` attribute to disable this behavior and only load content when clicked.
|
|
121
|
+
|
|
122
|
+
```html:preview
|
|
123
|
+
<zn-tabs flush no-prefetch>
|
|
124
|
+
<zn-navbar slot="top">
|
|
125
|
+
<li tab-uri="/api/data/tab1">Tab 1</li>
|
|
126
|
+
<li tab-uri="/api/data/tab2">Tab 2</li>
|
|
127
|
+
</zn-navbar>
|
|
128
|
+
</zn-tabs>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Default Active Tab
|
|
132
|
+
|
|
133
|
+
Use the `active` attribute to specify which tab should be active by default.
|
|
134
|
+
|
|
135
|
+
```html:preview
|
|
136
|
+
<zn-tabs flush active="settings">
|
|
137
|
+
<zn-navbar slot="top">
|
|
138
|
+
<li tab="">Home</li>
|
|
139
|
+
<li tab="settings">Settings</li>
|
|
140
|
+
<li tab="about">About</li>
|
|
141
|
+
</zn-navbar>
|
|
142
|
+
|
|
143
|
+
<zn-sp id="">
|
|
144
|
+
<p>Home panel.</p>
|
|
145
|
+
</zn-sp>
|
|
146
|
+
|
|
147
|
+
<zn-sp id="settings">
|
|
148
|
+
<p>Settings panel - this is active by default.</p>
|
|
149
|
+
</zn-sp>
|
|
150
|
+
|
|
151
|
+
<zn-sp id="about">
|
|
152
|
+
<p>About panel.</p>
|
|
153
|
+
</zn-sp>
|
|
154
|
+
</zn-tabs>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Storage Persistence
|
|
158
|
+
|
|
159
|
+
Use `store-key` to persist the active tab selection across page reloads. By default, uses session storage with a 5-minute TTL. Use `local-storage` for persistent storage beyond the session.
|
|
160
|
+
|
|
161
|
+
```html:preview
|
|
162
|
+
<zn-tabs flush store-key="my-tabs">
|
|
163
|
+
<zn-navbar slot="top">
|
|
164
|
+
<li tab="">Tab 1</li>
|
|
165
|
+
<li tab="tab2">Tab 2</li>
|
|
166
|
+
<li tab="tab3">Tab 3</li>
|
|
167
|
+
</zn-navbar>
|
|
168
|
+
|
|
169
|
+
<zn-sp id="">
|
|
170
|
+
<p>Tab 1 content. Switch tabs and reload the page to see persistence.</p>
|
|
171
|
+
</zn-sp>
|
|
172
|
+
|
|
173
|
+
<zn-sp id="tab2">
|
|
174
|
+
<p>Tab 2 content.</p>
|
|
175
|
+
</zn-sp>
|
|
176
|
+
|
|
177
|
+
<zn-sp id="tab3">
|
|
178
|
+
<p>Tab 3 content.</p>
|
|
179
|
+
</zn-sp>
|
|
180
|
+
</zn-tabs>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Local Storage
|
|
184
|
+
|
|
185
|
+
Use `local-storage` with `store-key` to persist tabs across browser sessions. Control expiration with `store-ttl` (in seconds).
|
|
186
|
+
|
|
187
|
+
```html:preview
|
|
188
|
+
<zn-tabs flush store-key="persistent-tabs" local-storage store-ttl="86400">
|
|
189
|
+
<zn-navbar slot="top">
|
|
190
|
+
<li tab="">Persistent Tab 1</li>
|
|
191
|
+
<li tab="persistent2">Persistent Tab 2</li>
|
|
192
|
+
</zn-navbar>
|
|
193
|
+
|
|
194
|
+
<zn-sp id="">
|
|
195
|
+
<p>This tab selection persists for 24 hours.</p>
|
|
196
|
+
</zn-sp>
|
|
197
|
+
|
|
198
|
+
<zn-sp id="persistent2">
|
|
199
|
+
<p>Tab 2 content.</p>
|
|
200
|
+
</zn-sp>
|
|
201
|
+
</zn-tabs>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Padding Options
|
|
205
|
+
|
|
206
|
+
Control content padding with the `padded` attribute for all sides, or use `padded-right` for specific padding.
|
|
207
|
+
|
|
208
|
+
```html:preview
|
|
209
|
+
<zn-tabs flush padded>
|
|
210
|
+
<zn-navbar slot="top">
|
|
211
|
+
<li tab="">Padded Content</li>
|
|
212
|
+
<li tab="normal">Normal</li>
|
|
213
|
+
</zn-navbar>
|
|
214
|
+
|
|
215
|
+
<zn-sp id="">
|
|
216
|
+
<p>This content has padding applied.</p>
|
|
217
|
+
</zn-sp>
|
|
218
|
+
|
|
219
|
+
<zn-sp id="normal">
|
|
220
|
+
<p>Normal content.</p>
|
|
221
|
+
</zn-sp>
|
|
222
|
+
</zn-tabs>
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Flush Layout
|
|
226
|
+
|
|
227
|
+
Use the `flush` attribute to remove all padding from the content area, useful for full-width content.
|
|
228
|
+
|
|
229
|
+
```html:preview
|
|
230
|
+
<zn-tabs flush>
|
|
231
|
+
<zn-navbar slot="top">
|
|
232
|
+
<li tab="">Flush Content</li>
|
|
233
|
+
<li tab="padded">Padded Content</li>
|
|
234
|
+
</zn-navbar>
|
|
235
|
+
|
|
236
|
+
<div id="">
|
|
237
|
+
<p style="margin: 0; padding: 20px; background: var(--zn-color-neutral-100);">
|
|
238
|
+
This content extends to the edges.
|
|
239
|
+
</p>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
<zn-sp id="padded">
|
|
243
|
+
<p>This has default spacing.</p>
|
|
244
|
+
</zn-sp>
|
|
245
|
+
</zn-tabs>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Full Width
|
|
249
|
+
|
|
250
|
+
Use the `full-width` attribute to make tab content expand to fill the available width.
|
|
251
|
+
|
|
252
|
+
```html:preview
|
|
253
|
+
<zn-tabs flush full-width>
|
|
254
|
+
<zn-navbar slot="top">
|
|
255
|
+
<li tab="">Full Width</li>
|
|
256
|
+
<li tab="normal">Normal</li>
|
|
257
|
+
</zn-navbar>
|
|
258
|
+
|
|
259
|
+
<zn-sp id="">
|
|
260
|
+
<p>Full width content.</p>
|
|
261
|
+
</zn-sp>
|
|
262
|
+
|
|
263
|
+
<zn-sp id="normal">
|
|
264
|
+
<p>Normal content.</p>
|
|
265
|
+
</zn-sp>
|
|
266
|
+
</zn-tabs>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Split Pane Layout
|
|
270
|
+
|
|
271
|
+
Use the `split` attribute with a pixel value to create a split pane layout with resizable sections. Control minimum and maximum sizes with `split-min` and `split-max`.
|
|
272
|
+
|
|
273
|
+
```html:preview
|
|
274
|
+
<zn-tabs split="300" split-min="200" split-max="600">
|
|
275
|
+
<zn-navbar slot="left">
|
|
276
|
+
<li tab="">Navigation</li>
|
|
277
|
+
<li tab="menu2">Menu 2</li>
|
|
278
|
+
</zn-navbar>
|
|
279
|
+
|
|
280
|
+
<div slot="right">
|
|
281
|
+
<zn-sp id="">
|
|
282
|
+
<p>Main content area on the right side.</p>
|
|
283
|
+
</zn-sp>
|
|
284
|
+
|
|
285
|
+
<zn-sp id="menu2">
|
|
286
|
+
<p>Alternate content.</p>
|
|
287
|
+
</zn-sp>
|
|
288
|
+
</div>
|
|
289
|
+
</zn-tabs>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Split Pane with Custom Captions
|
|
293
|
+
|
|
294
|
+
Customize the split pane labels with `primary-caption` and `secondary-caption`.
|
|
295
|
+
|
|
296
|
+
```html:preview
|
|
297
|
+
<zn-tabs split="250" primary-caption="Sidebar" secondary-caption="Main Area">
|
|
298
|
+
<div slot="left">
|
|
299
|
+
<p>Left sidebar content</p>
|
|
300
|
+
</div>
|
|
301
|
+
|
|
302
|
+
<div slot="right">
|
|
303
|
+
<p>Right main area content</p>
|
|
304
|
+
</div>
|
|
305
|
+
</zn-tabs>
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### Slots
|
|
309
|
+
|
|
310
|
+
The tabs component provides multiple slots for flexible layouts.
|
|
311
|
+
|
|
312
|
+
```html:preview
|
|
313
|
+
<zn-tabs caption="Slotted Content">
|
|
314
|
+
<zn-navbar slot="top">
|
|
315
|
+
<li tab="">Main</li>
|
|
316
|
+
<li tab="extra">Extra</li>
|
|
317
|
+
</zn-navbar>
|
|
318
|
+
|
|
319
|
+
<div slot="actions">
|
|
320
|
+
<zn-button size="small" icon="settings">Settings</zn-button>
|
|
321
|
+
</div>
|
|
322
|
+
|
|
323
|
+
<div slot="left">
|
|
324
|
+
<p>Left sidebar</p>
|
|
325
|
+
</div>
|
|
326
|
+
|
|
327
|
+
<zn-sp id="">
|
|
328
|
+
<p>Main content area.</p>
|
|
329
|
+
</zn-sp>
|
|
330
|
+
|
|
331
|
+
<zn-sp id="extra">
|
|
332
|
+
<p>Extra content.</p>
|
|
333
|
+
</zn-sp>
|
|
334
|
+
|
|
335
|
+
<div slot="right">
|
|
336
|
+
<p>Right sidebar</p>
|
|
337
|
+
</div>
|
|
338
|
+
|
|
339
|
+
<div slot="bottom">
|
|
340
|
+
<p>Footer content</p>
|
|
341
|
+
</div>
|
|
342
|
+
</zn-tabs>
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Actions Slot
|
|
346
|
+
|
|
347
|
+
Use the `actions` slot to add action buttons that appear in the header. Elements can be conditionally shown based on the active tab using `ref-tab`.
|
|
348
|
+
|
|
349
|
+
```html:preview
|
|
350
|
+
<zn-tabs caption="Document Editor">
|
|
351
|
+
<zn-navbar slot="top">
|
|
352
|
+
<li tab="">Edit</li>
|
|
353
|
+
<li tab="preview">Preview</li>
|
|
354
|
+
</zn-navbar>
|
|
355
|
+
|
|
356
|
+
<div slot="actions">
|
|
357
|
+
<zn-button ref-tab="" size="small" icon="save" color="success">Save</zn-button>
|
|
358
|
+
<zn-button ref-tab="preview" size="small" icon="print">Print</zn-button>
|
|
359
|
+
</div>
|
|
360
|
+
|
|
361
|
+
<zn-sp id="">
|
|
362
|
+
<p>Editing mode - Save button is visible.</p>
|
|
363
|
+
</zn-sp>
|
|
364
|
+
|
|
365
|
+
<zn-sp id="preview">
|
|
366
|
+
<p>Preview mode - Print button is visible.</p>
|
|
49
367
|
</zn-sp>
|
|
50
368
|
</zn-tabs>
|
|
51
369
|
```
|
|
52
370
|
|
|
53
|
-
###
|
|
371
|
+
### Programmatic Tab Control
|
|
372
|
+
|
|
373
|
+
Access tab methods programmatically to switch tabs, navigate, or refresh content.
|
|
374
|
+
|
|
375
|
+
```html:preview
|
|
376
|
+
<zn-tabs id="programmable-tabs" flush>
|
|
377
|
+
<zn-navbar slot="top">
|
|
378
|
+
<li tab="">Tab 1</li>
|
|
379
|
+
<li tab="tab2">Tab 2</li>
|
|
380
|
+
<li tab="tab3">Tab 3</li>
|
|
381
|
+
</zn-navbar>
|
|
382
|
+
|
|
383
|
+
<zn-sp id="">
|
|
384
|
+
<p>Tab 1 content.</p>
|
|
385
|
+
</zn-sp>
|
|
386
|
+
|
|
387
|
+
<zn-sp id="tab2">
|
|
388
|
+
<p>Tab 2 content.</p>
|
|
389
|
+
</zn-sp>
|
|
390
|
+
|
|
391
|
+
<zn-sp id="tab3">
|
|
392
|
+
<p>Tab 3 content.</p>
|
|
393
|
+
</zn-sp>
|
|
394
|
+
</zn-tabs>
|
|
54
395
|
|
|
55
|
-
|
|
396
|
+
<br />
|
|
56
397
|
|
|
398
|
+
<zn-button id="prev-tab">Previous Tab</zn-button>
|
|
399
|
+
<zn-button id="next-tab">Next Tab</zn-button>
|
|
400
|
+
<zn-button id="goto-tab2">Go to Tab 2</zn-button>
|
|
401
|
+
|
|
402
|
+
<script type="module">
|
|
403
|
+
const tabs = document.querySelector('#programmable-tabs');
|
|
404
|
+
|
|
405
|
+
document.querySelector('#prev-tab').addEventListener('click', () => {
|
|
406
|
+
tabs.previousTab();
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
document.querySelector('#next-tab').addEventListener('click', () => {
|
|
410
|
+
tabs.nextTab();
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
document.querySelector('#goto-tab2').addEventListener('click', () => {
|
|
414
|
+
tabs.setActiveTab('tab2', true, false);
|
|
415
|
+
});
|
|
416
|
+
</script>
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Tab Refresh
|
|
420
|
+
|
|
421
|
+
Triple-clicking an active tab or using the refresh parameter will reload dynamic content. Hold Alt while clicking to force a refresh.
|
|
422
|
+
|
|
423
|
+
```html:preview
|
|
424
|
+
<zn-tabs flush>
|
|
425
|
+
<zn-navbar slot="top">
|
|
426
|
+
<li tab-uri="/api/timestamp">Timestamp</li>
|
|
427
|
+
<li tab-uri="/api/random">Random Data</li>
|
|
428
|
+
</zn-navbar>
|
|
429
|
+
</zn-tabs>
|
|
430
|
+
<p><small>Triple-click a tab or Alt+click to refresh its content</small></p>
|
|
431
|
+
```
|
|
57
432
|
|
|
433
|
+
### No Scroll
|
|
434
|
+
|
|
435
|
+
Use the `no-scroll` attribute to prevent scrolling in the content area.
|
|
436
|
+
|
|
437
|
+
```html:preview
|
|
438
|
+
<zn-tabs flush no-scroll style="height: 300px;">
|
|
439
|
+
<zn-navbar slot="top">
|
|
440
|
+
<li tab="">No Scroll</li>
|
|
441
|
+
</zn-navbar>
|
|
442
|
+
|
|
443
|
+
<zn-sp id="">
|
|
444
|
+
<p>This content area doesn't scroll even if content overflows.</p>
|
|
445
|
+
<p>Additional content...</p>
|
|
446
|
+
<p>More content...</p>
|
|
447
|
+
</zn-sp>
|
|
448
|
+
</zn-tabs>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Flush X
|
|
452
|
+
|
|
453
|
+
Use `flush-x` to remove only horizontal padding while keeping vertical padding.
|
|
454
|
+
|
|
455
|
+
```html:preview
|
|
456
|
+
<zn-tabs flush-x>
|
|
457
|
+
<zn-navbar slot="top">
|
|
458
|
+
<li tab="">Horizontal Flush</li>
|
|
459
|
+
</zn-navbar>
|
|
460
|
+
|
|
461
|
+
<zn-sp id="">
|
|
462
|
+
<p>Content extends to horizontal edges but has vertical padding.</p>
|
|
463
|
+
</zn-sp>
|
|
464
|
+
</zn-tabs>
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Dynamic Tab Monitoring
|
|
468
|
+
|
|
469
|
+
Use the `monitor` attribute to watch for specific elements being added to the DOM and re-register tabs when they appear.
|
|
470
|
+
|
|
471
|
+
```html:preview
|
|
472
|
+
<zn-tabs flush monitor="dynamic-container">
|
|
473
|
+
<zn-navbar slot="top">
|
|
474
|
+
<li tab="">Static Tab</li>
|
|
475
|
+
</zn-navbar>
|
|
476
|
+
|
|
477
|
+
<div id="dynamic-container">
|
|
478
|
+
<zn-sp id="">
|
|
479
|
+
<p>Static content that's always here.</p>
|
|
480
|
+
</zn-sp>
|
|
481
|
+
</div>
|
|
482
|
+
</zn-tabs>
|
|
483
|
+
```
|