Skip to content

Commit 3290a23

Browse files
feat(tabs): DLT-3114 add vertical orientation variant (#1120)
1 parent 9efce93 commit 3290a23

File tree

11 files changed

+573
-229
lines changed

11 files changed

+573
-229
lines changed

apps/dialtone-documentation/docs/.vuepress/baseComponents/ClampedTableWrapper.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
</div>
5252
<div
5353
v-if="shouldShowButton"
54-
class="dialtone-doc-table-clamped__more d-ps-absolute d-bn16 d-l50p"
54+
class="dialtone-doc-table-clamped__more d-ps-absolute d-bn8 d-l50p"
5555
aria-hidden="true"
5656
>
5757
<dt-button
5858
class="dialtone-doc-table-clamped__more-btn d-bgc-secondary d-bs-sm"
5959
kind="muted"
6060
importance="outlined"
61-
size="sm"
61+
size="xs"
6262
@click="() => handleExpand(scrollRef)"
6363
>
6464
{{ buttonLabel }}

apps/dialtone-documentation/docs/.vuepress/baseComponents/CodeExampleTabs.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<dt-tab-group
33
class="code-example-tab-group"
44
activation-mode="auto"
5-
size="sm"
5+
size="xs"
66
@change="selectedPanelId = $event.selected"
77
>
88
<template #tabs>
@@ -38,7 +38,7 @@
3838
:id="vuePanelId"
3939
:tab-id="vueTabId"
4040
>
41-
<div ref="vuePanelRef" v-dt-scrollbar class="language-html d-hmx332" data-ext="html">
41+
<div ref="vuePanelRef" v-dt-scrollbar class="language-html d-hmx164" data-ext="html">
4242
<pre class="language-html" v-html="highlightedVue" />
4343
</div>
4444
</dt-tab-panel>
@@ -55,20 +55,20 @@
5555
>
5656
Raw HTML renders visuals only. You may need to add JS to replicate its functionality.
5757
</dt-banner>
58-
<div ref="htmlPanelRef" v-dt-scrollbar class="language-html d-hmx332" data-ext="html">
58+
<div ref="htmlPanelRef" v-dt-scrollbar class="language-html d-hmx164" data-ext="html">
5959
<pre class="language-html" v-html="highlightedHtml" />
6060
</div>
6161
</dt-tab-panel>
6262
<div
6363
v-if="shouldShowButton"
64-
class="code-example-tab-group__more d-ps-absolute d-bn16 d-l50p"
64+
class="code-example-tab-group__more d-ps-absolute d-bn8 d-l50p"
6565
aria-hidden="true"
6666
>
6767
<dt-button
6868
class="code-example-tab-group__more-btn d-bgc-secondary d-bs-sm"
6969
kind="muted"
7070
importance="outlined"
71-
size="sm"
71+
size="xs"
7272
@click="expandCodeBlocks"
7373
>
7474
Show all
@@ -148,7 +148,7 @@ const selectedPanelId = ref(vuePanelId);
148148
const vuePanelRef = ref(null);
149149
const htmlPanelRef = ref(null);
150150
const { shouldShowButton, handleExpand, initExpandable } = useDocExpandable({
151-
maxHeightClass: 'd-hmx332',
151+
maxHeightClass: 'd-hmx164',
152152
});
153153
154154
/**

apps/dialtone-documentation/docs/.vuepress/exampleComponents/ExampleTabs.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
:inverted="inverted"
77
:borderless="borderless"
88
:disabled="disabled"
9+
:orientation="orientation"
10+
:tab-list-class="orientation === 'vertical' ? 'd-w264' : undefined"
911
:activation-mode="activationMode"
1012
@before-change="confirmBeforeLeave"
1113
>
@@ -38,7 +40,7 @@
3840
</dt-tab>
3941
</template>
4042
<div
41-
class="d-ba d-bas-dashed d-mt16 d-bar4 d-bc-subtle"
43+
class="d-ba d-baw2 d-bas-dashed d-bc-subtle d-w100p d-plc-center d-py48"
4244
:class="{
4345
'd-fc-primary-inverted': inverted,
4446
}"
@@ -115,6 +117,11 @@ export default {
115117
type: String,
116118
default: 'manual',
117119
},
120+
121+
orientation: {
122+
type: String,
123+
default: 'horizontal',
124+
},
118125
},
119126
120127
methods: {

apps/dialtone-documentation/docs/components/tabs.md

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ keywords: ["tab panel", "tab navigation", "d-tabs", "DtTabs", "dt-tabs", "segmen
99
---
1010

1111
<code-well-header>
12-
<div class="d-w100p">
12+
<dt-stack class="d-w100p" gap="500">
1313
<example-tabs />
14-
</div>
14+
<example-tabs ref="verticalTabsExample" orientation="vertical" />
15+
</dt-stack>
1516
</code-well-header>
1617

1718
## Variants
@@ -282,7 +283,9 @@ vueCode='
282283
'
283284
showHtmlWarning />
284285

285-
## Icon Support
286+
## Slots
287+
288+
### Icon
286289

287290
Use the `#startIcon` or `#endIcon` slot on `dt-tab` to add an icon. The slot provides `iconSize` to match the tab's size.
288291

@@ -292,59 +295,72 @@ Use the `#startIcon` or `#endIcon` slot on `dt-tab` to add an icon. The slot pro
292295

293296
<code-well-header>
294297
<div class="d-w100p">
295-
<dt-tab-group>
298+
<dt-tab-group ref="iconTabsExample">
296299
<template #tabs>
297300
<dt-tab id="1" panel-id="2" selected>
301+
First
298302
<template #startIcon="{ iconSize }">
299303
<dt-icon name="box-select" :size="iconSize" />
300304
</template>
301-
First
302305
</dt-tab>
303306
<dt-tab id="3" panel-id="4">
304307
Second
308+
<template #startIcon="{ iconSize }">
309+
<dt-icon name="box-select" :size="iconSize" />
310+
</template>
311+
<template #endIcon="{ iconSize }">
312+
<dt-icon name="box-select" :size="iconSize" />
313+
</template>
305314
</dt-tab>
306315
<dt-tab id="5" panel-id="6">
316+
Third
307317
<template #endIcon="{ iconSize }">
308318
<dt-icon name="box-select" :size="iconSize" />
309319
</template>
310-
Third
311320
</dt-tab>
312321
</template>
313322
</dt-tab-group>
314323
</div>
315324
</code-well-header>
316325

317326
<code-example-tabs
327+
:htmlCode='() => $refs.iconTabsExample'
318328
vueCode='
319329
<dt-tab-group>
320330
<template #tabs>
321331
<dt-tab id="1" panel-id="2" selected>
332+
First
322333
<template #startIcon="{ iconSize }">
323334
<dt-icon name="box-select" :size="iconSize" />
324335
</template>
325-
First
326336
</dt-tab>
327337
<dt-tab id="3" panel-id="4">
328338
Second
339+
<template #startIcon="{ iconSize }">
340+
<dt-icon name="box-select" :size="iconSize" />
341+
</template>
342+
<template #endIcon="{ iconSize }">
343+
<dt-icon name="box-select" :size="iconSize" />
344+
</template>
329345
</dt-tab>
330346
<dt-tab id="5" panel-id="6">
347+
Third
331348
<template #endIcon="{ iconSize }">
332349
<dt-icon name="box-select" :size="iconSize" />
333350
</template>
334-
Third
335351
</dt-tab>
336352
</template>
337353
</dt-tab-group>
338354
'
339355
showHtmlWarning />
340356

341-
## Leading & Trailing
357+
### Leading & Trailing
342358

343359
Use the `#leading` and `#trailing` slots on `dt-tab` to render content like badges or count indicators alongside tab labels. Use `leading-class` and `trailing-class` to adjust padding.
344360

345361
<code-well-header>
346362
<div class="d-w100p">
347-
<dt-tab-group>
363+
<dt-tab-group ref="leadingTrailingTabsExample">
348364
<template #tabs>
349365
<dt-tab id="lt1" panel-id="lt2" selected trailing-class="d-pr8">
350366
Inbox
@@ -367,6 +383,7 @@ Use the `#leading` and `#trailing` slots on `dt-tab` to render content like badg
367383
</code-well-header>
368384

369385
<code-example-tabs
386+
:htmlCode='() => $refs.leadingTrailingTabsExample'
370387
vueCode='
371388
<dt-tab-group>
372389
<template #tabs>
@@ -390,6 +407,27 @@ vueCode='
390407
'
391408
showHtmlWarning />
392409

410+
## Orientation
411+
412+
Set `orientation="vertical"` to stack tabs vertically alongside the panel.
413+
414+
<code-well-header>
415+
<example-tabs ref="verticalTabsExample" orientation="vertical" />
416+
</code-well-header>
417+
418+
<code-example-tabs
419+
:htmlCode='() => $refs.verticalTabsExample'
420+
vueCode='
421+
<dt-tab-group orientation="vertical">
422+
<template #tabs>
423+
<dt-tab id="1" panel-id="2" selected>First</dt-tab>
424+
<dt-tab id="3" panel-id="4">Second</dt-tab>
425+
<dt-tab id="5" panel-id="6">Third</dt-tab>
426+
</template>
427+
</dt-tab-group>
428+
'
429+
showHtmlWarning />
430+
393431
## Advanced Usages
394432

395433
### Automatic Mode

0 commit comments

Comments
 (0)