Switch

Exports

Import these components from @mbsw/ui.

Switch

Props

The tables list common props for each component. See the full types for supported prop combinations and inherited HTML and Radix props.

Switch

Switch props
PropTypeRequirement
size'md' | 'sm'Optional

Type reference

Show full types

Full TypeScript definitions, including prop combinations and inherited props.

import { type ComponentPropsWithoutRef } from 'react';

import { Switch as SwitchPrimitive } from 'radix-ui';

export type SwitchSize = 'md' | 'sm';

type DataAttributes = {
    [key: `data-${string}`]: boolean | number | string | undefined;
};

type SwitchPrimitiveProps = ComponentPropsWithoutRef<typeof SwitchPrimitive.Root>;

export type SwitchProps = Omit<SwitchPrimitiveProps, 'asChild' | 'children' | 'color'> & DataAttributes & {
    size?: SwitchSize;
};

export declare const Switch: import("react").ForwardRefExoticComponent<Omit<Omit<SwitchPrimitive.SwitchProps & import("react").RefAttributes<HTMLButtonElement>, "ref">, "color" | "children" | "asChild"> & DataAttributes & {
    size?: SwitchSize;
} & import("react").RefAttributes<HTMLButtonElement>>;