Skip to main content

SwitchProps

Props for Switch.

This is an interface exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import type { SwitchProps } from "@mapcairn/map";

interface SwitchProps

Properties​

"data-testid"​

readonly "data-testid"?: string;

Applied to the control. The row gets the same id with a -row suffix.

checked​

readonly checked: boolean;

Whether the switch is on. The component is controlled.

className​

readonly className?: string;

Applied to the row element.

description​

readonly description?: string;

Optional supporting text, announced as the control's description.

disabled​

readonly disabled?: boolean;

Stops the switch from being toggled and dims it.

label​

readonly label: string;

The visible label. Required: a switch is never unnamed or named only by an icon.

onCheckedChange​

readonly onCheckedChange: (checked: boolean) => void;

Called with the next state when the user toggles the switch.

Source: packages/map/src/ui/Switch/Switch.tsx:10