@loadsmart/miranda-wc
Version:
Miranda Web Components component library
54 lines (53 loc) • 1.41 kB
TypeScript
import type { AcceptedType, SelectionState } from '../../controllers/selection';
export type TabContentDirection = 'vertical' | 'horizontal';
export type TabChangeEventDetail = {
value: AcceptedType;
};
export interface TabsProps {
/**
* Controlled value of the selected tab.
*/
activeTab?: AcceptedType;
/**
* Direction of the tabs content.
* @default 'horizontal'
*/
tabContentDirection?: TabContentDirection;
/**
* Should the tabs be disabled.
*/
disabled?: boolean;
/**
* If set to true, the tab-panels content will only be rendered if the tab is selected.
* Otherwise it's just hidden.
*/
lazy?: boolean;
/**
* Event triggered on tab change.
*/
ontabchange?: (event: CustomEvent<TabChangeEventDetail>) => void;
}
export type TabProps = {
/**
* Name of the tab, raised with the event.
*/
name: string;
/**
* Should the tab be disabled.
*/
disabled?: boolean;
};
export type TabPanelProps = {
/**
* The name of the tab that controls this panel.
*/
forTab: string;
/**
* If set to true, the content will only be rendered if the tab is selected.
* Otherwise it's just hidden.
*/
lazy?: boolean;
};
export type TabsContext = Pick<TabsProps, 'tabContentDirection' | 'disabled' | 'lazy'> & {
selection: SelectionState;
};