status_badge
Status icon-plus-label molecule used in task rows and detail views.
struct Component
pub struct Component<'a>Renders a status icon + label for a given status string.
| Field | Type | Description |
|---|---|---|
show_text |
bool | Whether to show the label after the icon; only tests turn it off. |
status |
&'a str | Status string: open, in-progress, done, cancelled or blocked. |
Implements Display.
Component::new
pub fn new(status: &'a str) -> SelfCreate a status badge for the given status string (e.g. "open", "in-progress").
| Parameter | Type | Description |
|---|---|---|
status |
&'a str | the status; an unknown one is shown with the open icon and style |
| returns | Self | The badge, showing the icon and the label. |
Component::icon
fn icon(&self) -> IconPick the icon: ⊗ for blocked, otherwise the Icon::status glyph.
| Parameter | Type | Description |
|---|---|---|
| returns | Icon | The icon for the status. |
Component::label
fn label(&self) -> &strPick the label text, which spells in-progress as in progress.
| Parameter | Type | Description |
|---|---|---|
| returns | &str | The label, borrowed from the status or a static string. |
Component::style
fn style(&self) -> StylePick the label style from the theme’s status tokens.
| Parameter | Type | Description |
|---|---|---|
| returns | Style | The status.* style for the status; indicator.blocked for blocked; status.open for anything else. |