AsterUIDocsv1.0.2

Docs / Component reference

Tabs

Switch between related panels without leaving the page. Arrow keys move between their tabs.

Tabs example

Install

sh
npx @fierst/ui@1.0.2 add tabs

Registry dependencies: theme.

Exports from ./ui/tabs: TabItem, Tabs.

Download the registry source for tabs 1.0.2.

API contracts

ts
export interface TabItem {
  id: string;
  label: string;
  content: View | (() => View);
}

export function* Tabs(
  props: {
    items: readonly TabItem[];
    variant?: 'segmented' | 'underline';
    value?: string;
    defaultValue?: string;
    label?: string;
    onChange?: (id: string) => void;
    class?: string;
  },
  ctx: Ctx,
)