AsterUIDocsv1.0.2

Docs / Component reference

Switch

Turn one setting on or off. The component can own its current state or receive the value from its caller.

Switch example

Install

sh
npx @fierst/ui@1.0.2 add switch

Registry dependencies: theme.

Exports from ./ui/switch: Switch.

Download the registry source for switch 1.0.2.

API contracts

ts
export function* Switch(
  props: {
    checked?: boolean;
    defaultChecked?: boolean;
    label?: string;
    description?: string;
    disabled?: boolean;
    onChange?: (checked: boolean) => void;
    class?: string;
  },
  ctx: Ctx,
)