<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# MenuCheckboxItem

An on/off setting in a `Menu`, with a check mark when it is on. Toggling it keeps the menu open, so several settings can change in one go.

```tsx
import { MenuCheckboxItem } from "@/components/ouro/menu/menu";
```

## Example

```tsx
<MenuCheckboxItem checked={showNotes} onCheckedChange={setShowNotes}>Show notes</MenuCheckboxItem>
```

## Use instead when

- Use `MenuRadioItem` instead for one choice of several, and `Switch` for a setting on the page.

## Props

Type: `MenuCheckboxItemProps`.

| Prop | Type | Description |
| --- | --- | --- |
| `checked` | `boolean` | Whether it is on, to control it; pass `onCheckedChange` with it. |
| `children` (required) | `ReactNode` | The setting's text. |
| `defaultChecked` | `boolean` | Whether it starts on, uncontrolled. |
| `disabled` | `boolean` | Shown, but cannot be toggled. |
| `onCheckedChange` | `((checked: boolean) => void)` | Called with the new state when it is toggled. |
| `shortcut` | `MenuShortcut` | The keys of its shortcut, shown at its end: `["mod", "b"]`. |

## Types

### `MenuShortcut`

Keys for a shortcut, as `Kbd` takes them: `["mod", "e"]` shows ⌘E on Apple platforms and Ctrl+E elsewhere.

```ts
type MenuShortcut = readonly string[] | (string & { 'Use an array: shortcut={["mod", "k"]}': never });
```
