Skip to content
Strife Docs

Reference Field Reference

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

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

Options

OptionTypeRequiredDescription
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 — the same editor, documented from the Strife Studio UI side.
  • fields.toggle() — same output shape, rendered as a sliding toggle instead of a checkbox.