Skip to content

Commit 1d62a7c

Browse files
committed
feat: VerticalTabs puts its tabs in a framed column instead of a divider line, so the active tab no longer runs into it AdminForth/2005
1 parent 9c5f57d commit 1d62a7c

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

‎adminforth/design/system.html‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@
312312
.vtab.is-on { background: var(--surface-3); color: var(--text); font-weight: 500; }
313313
.vtab.is-on .i { color: var(--text); }
314314
.vtab .trail { margin-left: auto; }
315+
.vtabs { display: flex; flex-direction: column; gap: 2px; align-self: flex-start; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
315316

316317
/* tooltip, toast, dialog */
317318
.tip { display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 6px 9px; border-radius: 6px; background: var(--ink); color: var(--on-ink); font-size: 12px; line-height: 16px; font-weight: 500; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .3); }
@@ -2352,17 +2353,17 @@ <h3 class="t-h3">Storage adapter</h3>
23522353
</section>
23532354

23542355
<section class="sec">
2355-
<div class="sec-head"><span class="sec-name">&lt;VerticalTabs&gt;</span><span class="t-sm t-muted">gray pill marks the active tab, same as the sidebar</span></div>
2356+
<div class="sec-head"><span class="sec-name">&lt;VerticalTabs&gt;</span><span class="t-sm t-muted">tabs sit in a framed column, gray pill marks the active tab, same as the sidebar</span></div>
23562357
<div class="grid3">
23572358
<div class="tile">
23582359
<div class="tile-stage top">
2359-
<div style="display: flex; gap: 16px">
2360-
<div role="tablist" aria-orientation="vertical" style="width: 140px; display: flex; flex-direction: column; gap: 2px">
2360+
<div style="display: flex; gap: 24px">
2361+
<div class="vtabs" role="tablist" aria-orientation="vertical" style="width: 140px">
23612362
<button class="vtab is-on" type="button" role="tab">General</button>
23622363
<button class="vtab" type="button" role="tab">Engine</button>
23632364
<button class="vtab" type="button" role="tab">Features</button>
23642365
</div>
2365-
<div style="flex: 1; display: flex; flex-direction: column; gap: 6px; padding-left: 16px; border-left: 1px solid var(--border)">
2366+
<div style="flex: 1; display: flex; flex-direction: column; gap: 6px">
23662367
<span class="label">Trim</span><label class="input input-sm"><input type="text" value="Base" aria-label="Trim"></label>
23672368
</div>
23682369
</div>
@@ -2371,7 +2372,7 @@ <h3 class="t-h3">Storage adapter</h3>
23712372
</div>
23722373
<div class="tile">
23732374
<div class="tile-stage top">
2374-
<div role="tablist" aria-orientation="vertical" style="width: 200px; display: flex; flex-direction: column; gap: 2px">
2375+
<div class="vtabs" role="tablist" aria-orientation="vertical" style="width: 200px">
23752376
<button class="vtab" type="button" role="tab"><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>Profile</button>
23762377
<button class="vtab is-on" type="button" role="tab"><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><rect width="18" height="11" x="3" y="11" rx="2" ry="2"></rect><path d="M7 11V7a5 5 0 0 1 10 0v4"></path></svg>Security</button>
23772378
<button class="vtab" type="button" role="tab"><svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M10.268 21a2 2 0 0 0 3.464 0"></path><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"></path></svg>Notifications</button>

‎adminforth/spa/src/afcl/VerticalTabs.vue‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div class="md:flex">
3-
<div :class="mergeClasses('md:me-4 mb-4 md:mb-0 mr-6 md:mr-0 md:min-w-[11rem]', tabsClass)">
2+
<div class="afcl-vertical-tabs md:flex">
3+
<div :class="mergeClasses('afcl-vertical-tabs-list mb-4 md:mb-0 md:me-6 md:self-start md:min-w-[11rem] p-1 rounded-lg border border-lightCardBorder bg-lightCardBackground dark:border-darkCardBorder dark:bg-darkCardBackground', tabsClass)">
44
<slot name="tabs-header"></slot>
55
<ul class="space-y-0.5 text-sm">
66
<li v-for="tab in tabs" :key="`${tab}-tab-controll`">
@@ -19,7 +19,7 @@
1919
</li>
2020
</ul>
2121
</div>
22-
<div :class="mergeClasses('w-full md:ps-6 md:border-s md:border-lightFormBorder dark:md:border-darkFormBorder text-sm text-lightVerticalTabsSlotText dark:text-darkVerticalTabsSlotText', contentClass)">
22+
<div :class="mergeClasses('afcl-vertical-tabs-content w-full text-sm text-lightVerticalTabsSlotText dark:text-darkVerticalTabsSlotText', contentClass)">
2323
<slot :name="activeTab"></slot>
2424
</div>
2525
</div>
@@ -35,7 +35,7 @@ import { mergeClasses } from './classMerge';
3535
const props = withDefaults(defineProps<{
3636
activeTab?: string;
3737
hideTabesWhenSingle?: boolean;
38-
// override the default classes of the tab list column and of the content, e.g. paddings or the divider
38+
// override the default classes of the tab list column and of the content, e.g. margins or the frame of the column
3939
tabsClass?: ClassNameValue;
4040
contentClass?: ClassNameValue;
4141
}>(), {

‎adminforth/spa/src/views/SettingsView.vue‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
ref="VerticalTabsRef"
1111
v-model:active-tab="activeTab"
1212
class="flex flex-col @4xl:flex-row @4xl:min-h-[40rem] overflow-hidden rounded-xl border border-lightCardBorder bg-lightCardBackground dark:border-darkCardBorder dark:bg-darkCardBackground"
13-
tabsClass="m-0 md:m-0 @4xl:w-64 shrink-0 px-3 py-4 @4xl:py-5 border-b @4xl:border-b-0 @4xl:border-e border-lightCardBorder dark:border-darkCardBorder bg-lightVerticalTabsBackground dark:bg-darkVerticalTabsBackground"
14-
contentClass="min-w-0 overflow-x-auto p-6 md:border-s-0"
13+
tabsClass="m-0 md:m-0 md:self-stretch @4xl:w-64 shrink-0 px-3 py-4 @4xl:py-5 rounded-none border-0 border-b @4xl:border-b-0 @4xl:border-e border-lightCardBorder dark:border-darkCardBorder bg-lightVerticalTabsBackground dark:bg-darkVerticalTabsBackground"
14+
contentClass="min-w-0 overflow-x-auto p-6"
1515
@update:active-tab="setURL({slug: $event, pageLabel: ''})"
1616
>
1717
<template #tabs-header>

‎documentation/docs/tutorial/03-Customization/15-afcl.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ import { IconCircleUser, IconLayoutGrid } from '@iconify-prerendered/vue-lucide'
487487

488488
### In a card
489489

490-
`tabsClass` and `contentClass` add classes to the column of tabs and to the content, they override the default ones (the margins of the column, the padding and the divider of the content). The `tabs-header` slot goes above the tabs. This is how the settings page puts its tabs on a tinted pane of a card:
490+
`tabsClass` and `contentClass` add classes to the column of tabs and to the content, they override the default ones (the margins and the frame of the column). The `tabs-header` slot goes above the tabs. This is how the settings page puts its tabs on a tinted pane of a card:
491491

492492
<AfclPreview id="vertical-tabs-card">
493493

@@ -499,8 +499,8 @@ import { IconLink, IconMonitorSmartphone } from '@iconify-prerendered/vue-lucide
499499
```html
500500
<VerticalTabs
501501
class="overflow-hidden rounded-xl border border-lightCardBorder bg-lightCardBackground dark:border-darkCardBorder dark:bg-darkCardBackground"
502-
tabsClass="m-0 md:m-0 md:w-64 px-3 py-4 border-b md:border-b-0 md:border-e border-lightCardBorder dark:border-darkCardBorder bg-lightVerticalTabsBackground dark:bg-darkVerticalTabsBackground"
503-
contentClass="p-5 md:ps-6 md:border-s-0"
502+
tabsClass="m-0 md:m-0 md:self-stretch md:w-64 shrink-0 px-3 py-4 rounded-none border-0 border-b md:border-b-0 md:border-e border-lightCardBorder dark:border-darkCardBorder bg-lightVerticalTabsBackground dark:bg-darkVerticalTabsBackground"
503+
contentClass="p-5 md:ps-6"
504504
>
505505
<template #tabs-header>
506506
<p class="px-2.5 pb-3 font-semibold text-lightCardTitle dark:text-darkCardTitle">Settings</p>

0 commit comments

Comments
 (0)