# @salmonui/inputs/switch API reference

> 4 exported symbols of @salmonui/inputs/switch: 1 component, 1 interface and 2 types.

Canonical: https://salmonui.dev/docs/reference/inputs/switch

```ts
import { … } from '@salmonui/inputs/switch';
```

## Components

### Switch

Kind: component

Page: https://salmonui.dev/docs/reference/inputs/switch/Switch

```ts
function Switch(props: SwitchProps): ReactNode;
```

Switch: a native
`<input type="checkbox" role="switch">` drawn as a track and thumb,
labelled by its children. Space toggles; the checked state is the
native one. `ref` is the input; unknown props go to the input,
`className` / `style` to the root.

Props: [`SwitchProps`](https://salmonui.dev/docs/reference/inputs/switch/SwitchProps) (its members are the props)

## Interfaces

### SwitchProps

Kind: interface

Page: https://salmonui.dev/docs/reference/inputs/switch/SwitchProps

```ts
interface SwitchProps extends ToggleFieldProps {
    readonly thumbIcon?: ReactNode;
}
```

Members (18):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `thumbIcon` | `readonly thumbIcon?: ReactNode;` | optional | Icon drawn inside the thumb; decorative. |
| `description` | `description?: ReactNode;` | optional, inherited |  |
| `errorMessage` | `errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) \| ReactNode;` | optional, inherited | Error text (or a function of the errors) shown while the field is invalid. |
| `invalid` | `invalid?: boolean;` | optional, inherited | Forces the error state. |
| `validation` | `validation?: FieldValidation;` | optional, inherited | Rules in the Data Grid vocabulary. |
| `validateOn` | `validateOn?: ValidateOn;` | optional, inherited | When errors appear; default the `Form`'s, else `'blur'`. |
| `size` | `size?: FieldSize;` | optional, inherited | Metric set. Default `'md'`. |
| `checked` | `checked?: boolean;` | optional, inherited |  |
| `defaultChecked` | `defaultChecked?: boolean;` | optional, inherited |  |
| `onCheckedChange` | `onCheckedChange?: ((checked: boolean, details: CheckedChangeDetails) => void);` | optional, inherited |  |
| `value` | `value?: string;` | optional, inherited | Submitted value when checked (native, default `'on'`). |
| `children` | `children?: ReactNode;` | optional, inherited | Label text (rendered in a real `<label for>`). |
| `labelPlacement` | `labelPlacement?: LabelPlacement;` | optional, inherited | Label before (`'start'`) or after (`'end'`, default) the control. |
| `localeText` | `localeText?: FieldValidationText;` | optional, inherited |  |
| `className` | `className?: string;` | optional, inherited |  |
| `style` | `style?: CSSProperties;` | optional, inherited |  |
| `classNames` | `classNames?: { readonly input?: string; readonly label?: string; readonly description?: string; readonly error?: string; };` | optional, inherited | Part classes: `root` is `className`; `input`, `label`, `description`, `error`. |
| `ref` | `ref?: Ref<HTMLInputElement>;` | optional, inherited | The native `<input type="checkbox">`. |

## Re-exported entry points

- [@salmonui/inputs/checkbox](https://salmonui.dev/docs/reference/inputs/checkbox.md): 2 symbols: 2 types
  `CheckedChangeDetails`, `LabelPlacement`
