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
Not shown in Studio's editor panel.
searchable
boolean
No
Stored on the template; nothing uses it today.
filterable
boolean
No
Stored on the template; nothing uses it today.
protected
boolean
No
Stops the field from being edited or removed in Studio's template designer. No effect in the editor panel.
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.