Skip to main content

token

Function token 

Source
pub fn token(
    ui: &mut Ui,
    label: &str,
    kind: Token,
    tone: Tone,
    latched: bool,
    palette: &Palette,
    style: &WidgetStyle,
) -> Response
Expand description

A badge or a chip.

Round for a badge, square for a chip, which is makeover-tui’s reading and makeover-webview’s before it. The shape carries the difference because colour is already spent on the tone.

A chip answers a click and a badge does not, which is Token::interactive and is the whole difference between the members. The Response comes back either way, so a caller that presses a badge is pressing something this function said was not interactive; the sense is what makes egui agree.

latched is a chip that is switched on, and it fills rather than outlines. A terminal has to collide latched with focus because it has one spare axis for two facts; egui does not, so it does not.

A chip’s removable half is not drawn, on makeover-tui’s reasoning: a second control inside a token is a question for whoever owns the interaction rather than for a drawing.