Toggle column
ToggleColumn renders an inline switch for boolean fields, so operators can flip a value straight from the index without opening the edit form:
from almasix.orbit.tables import ToggleColumn
ToggleColumn.make("enabled")Like SelectColumn, TextInputColumn, and CheckboxColumn, it’s an editable column: it renders data-orbit-column-edit="toggle", and orbit.js persists changes through ListRecordsHost.update_column_state.
Disabling the column
Section titled “Disabling the column”Prevent specific rows from being changed with .disabled():
ToggleColumn.make("public").disabled( lambda record=None, **_: record.get("locked"),)Reacting to updates
Section titled “Reacting to updates”.before_state_updated() and .after_state_updated() run around the persisted change — each receives (record, state, old):
ToggleColumn.make("featured").after_state_updated( lambda record=None, state=None, old=None, **_: log_feature_toggle(record, state),)Choosing icons vs. text vs. toggles
Section titled “Choosing icons vs. text vs. toggles”Toggles are for values operators should be able to change from the index. If the value is read-only, prefer BooleanColumn or IconColumn.boolean() instead — they render check/X icons without implying the cell is interactive.
Full example
Section titled “Full example”from almasix.orbit.tables import Table, TextColumn, ToggleColumn
Table.make("flags").columns([ TextColumn.make("name").searchable(), ToggleColumn.make("enabled").label("On").align_center(), ToggleColumn.make("public") .align_center() .disabled(lambda record=None, **_: record.get("locked")),]).records([ {"id": 1, "name": "Dark mode", "enabled": True, "public": True, "locked": False}, {"id": 2, "name": "Beta banner", "enabled": False, "public": False, "locked": True},])Key methods
Section titled “Key methods”| Method | Effect |
|---|---|
.disabled(bool | callable) |
Prevent edits for a row |
.before_state_updated(callback) / .after_state_updated(callback) |
Hooks around persistence |
.label(...) / .align_center() / .sortable() |
Inherited shared helpers |
| Markup | data-orbit-column-edit="toggle", data-record-id, data-column |
Preview
Section titled “Preview”

