Skip to content

Badge column

BadgeColumn is a thin subclass of TextColumn with .badge() already applied. Use it when a column is always a status, tier, or label — you get every TextColumn helper (color, icon, format, sort, search) without having to remember .badge():

from almasix.orbit.tables import BadgeColumn
BadgeColumn.make("status").color(
lambda state=None, **_: {"open": "warning", "closed": "success", "blocked": "danger"}.get(
state, "gray",
),
)

Both produce identical markup:

TextColumn.make("status").badge().color("primary")
# renders the same as:
BadgeColumn.make("status").color("primary")

Prefer BadgeColumn when the column is always a badge — it documents intent at a glance. Prefer TextColumn.badge() (with a boolean or callable condition) when the same column sometimes renders as plain text, e.g. only badging non-default states.

BadgeColumn supports every TextColumn helper, including icons:

BadgeColumn.make("priority").icon("heroicon-o-exclamation-triangle").color("danger")
from almasix.orbit.tables import Table, TextColumn, BadgeColumn
Table.make("tickets").columns([
TextColumn.make("subject").searchable(),
BadgeColumn.make("status").sortable().color(
lambda state=None, **_: {"open": "warning", "closed": "success"}.get(state, "gray"),
),
BadgeColumn.make("priority").color("primary"),
]).records([
{"id": 1, "subject": "Payments down", "status": "open", "priority": "urgent"},
{"id": 2, "subject": "Typo on homepage", "status": "closed", "priority": "low"},
])
Method Effect
.color(str | callable) Badge background color
.icon(...) / .icon_position(...) Icon inside the badge
.format_state_using(callback) Map raw values → labels
.sortable() / .searchable() / .toggleable(...) Inherited shared helpers
.align_center() Center the badge
Inherited from TextColumn .limit(...), .copyable(), .weight(...), …

Badge column (light) Badge column (dark)

Text features (light) Text features (dark)