tabs: separate controls for header and content padding
This commit is contained in:
@@ -23,12 +23,22 @@
|
||||
activeIndex?: number;
|
||||
/** Callback fired when the active tab changes */
|
||||
onchange?: (event: { index: number; tab: TabPage }) => void;
|
||||
/** Applies layout padding to the tab header & content areas (default: false) */
|
||||
padded?: boolean;
|
||||
/** Applies layout padding to the tab header (default: false) */
|
||||
padHeader?: boolean;
|
||||
/** Applies layout padding to the content areas (default: false) */
|
||||
padContent?: boolean;
|
||||
/** Additional classes applied to the outer container */
|
||||
class?: ClassValue | null;
|
||||
}
|
||||
|
||||
let { pages, activeIndex = 0, onchange, padded = false, class: classValue }: Props = $props();
|
||||
let {
|
||||
pages,
|
||||
activeIndex = 0,
|
||||
onchange,
|
||||
padHeader = false,
|
||||
padContent = false,
|
||||
class: classValue
|
||||
}: Props = $props();
|
||||
|
||||
let primaryContainerEl: HTMLDivElement;
|
||||
let tabContainerEl: HTMLDivElement;
|
||||
@@ -99,7 +109,7 @@
|
||||
bind:this={tabContainerEl}
|
||||
class={[
|
||||
'border-sui-text/15 relative mb-4 flex items-center gap-5 border-b-2',
|
||||
padded && 'px-layout'
|
||||
padHeader && 'px-layout'
|
||||
]}
|
||||
>
|
||||
{#each pages as page, i (page.title)}
|
||||
@@ -134,7 +144,7 @@
|
||||
|
||||
{#key activeIndex}
|
||||
<div
|
||||
class={[padded && 'px-layout']}
|
||||
class={[padContent && 'px-layout']}
|
||||
in:flyX={{ direction: activeIndex > prevIndex ? 1 : -1, duration: 180, delay: 181 }}
|
||||
out:flyX={{ direction: activeIndex > prevIndex ? -1 : 1, duration: 180 }}
|
||||
onoutrostart={lockHeight}
|
||||
|
||||
Reference in New Issue
Block a user