> From the [Strife developer docs](https://strife.app/docs/reference/field-reference/fields.switch). Every page is listed in [llms.txt](https://strife.app/docs/llms.txt).

# fields.switch()

Boolean checkbox toggle. Never localizable.

Boolean toggle. Maps to editor `{ name: 'str-switch', type: 'checkbox' }`. Switches are never localizable — a flag is a flag in any language.

> [!NOTE]
> `switch` is a JavaScript reserved word, so the implementation is internally named `switchField` and re-exported as `fields.switch`. You'll only ever call it as `fields.switch(...)` — the internal name only shows up if you're reading the `@strifeapp/schema` source itself.

## Example

```ts
fields.switch({
  label: 'Featured',
  filterable: true,
})
```

## Options

| Option         | Type      | Required | Description                                                |
| -------------- | --------- | -------- | ---------------------------------------------------------- |
| `label`        | `string`  | Yes      | Label shown to editors in Strife Studio.                   |
| `description`  | `string`  | No       | Tooltip shown to editors.                                  |
| `searchable`   | `boolean` | No       | Include in the team's search index.                        |
| `filterable`   | `boolean` | No       | Allow filtering content lists by this value.               |
| `protected`    | `boolean` | No       | Restrict editing to users with the appropriate permission. |
| `propertyName` | `string`  | No       | Override the stored property name.                         |

No `localizable` option — booleans can't be localized.

## Output type

`boolean`.

## See also

* [Checkbox](https://strife.app/docs/reference/fields/checkbox.md) — the same editor, documented from the Strife Studio UI side.
* [`fields.toggle()`](https://strife.app/docs/reference/field-reference/fields.toggle.md) — same output shape, rendered as a sliding toggle instead of a checkbox.
