Skip to main content

Content

Trait Content 

Source
pub trait Content: ThemeExt {
    // Provided methods
    fn badge(&self, label: impl Into<SharedString>) -> Div { ... }
    fn badge_active(&self, label: impl Into<SharedString>) -> Div { ... }
    fn avatar(&self, initials: impl Into<SharedString>) -> Div { ... }
    fn icon_deck(&self, front: impl Into<Icon>, behind: usize) -> Div { ... }
    fn tag(&self, label: impl Into<SharedString>) -> Div { ... }
    fn chip(&self, label: impl Into<SharedString>, tint: Hsla) -> Div { ... }
    fn breadcrumb(&self) -> Div { ... }
    fn breadcrumb_item(
        &self,
        label: impl Into<SharedString>,
        current: bool,
    ) -> Div { ... }
    fn breadcrumb_separator(&self) -> Svg { ... }
    fn empty_state(
        &self,
        icon: impl Into<Icon>,
        title: impl Into<SharedString>,
        hint: impl Into<SharedString>,
    ) -> Div { ... }
}

Provided Methods§

Source

fn badge(&self, label: impl Into<SharedString>) -> Div

Right-anchored badge pill: rounded-full border px-2 py-0.5.

Source

fn badge_active(&self, label: impl Into<SharedString>) -> Div

Emerald status pill (the Accounts “Active” badge: bg-emerald-400/[0.12] text-emerald-300/90).

Source

fn avatar(&self, initials: impl Into<SharedString>) -> Div

Circular avatar holding one or two initials — the fallback every avatar needs, and often the whole thing on a monochrome surface. Initials only: there is no image variant.

Source

fn icon_deck(&self, front: impl Into<Icon>, behind: usize) -> Div

A stack shown as a deck of cards: front on a square card, with the edge of one more card peeking out past it for each of behind, up to two, each shorter than the one before. More than two behind draws as two. Always as wide as a full deck, so a row holding one does not shift as the stack grows or shrinks.

The cards behind are drawn only where they show, so the deck needs no knowledge of what is painted under it.

Source

fn tag(&self, label: impl Into<SharedString>) -> Div

A removable chip — a token in a filter bar or a recipient field. The caller adds the click handler for the ✕.

Source

fn chip(&self, label: impl Into<SharedString>, tint: Hsla) -> Div

A name in a colour — a label on an entry, an option of a multi-select. tint is the hue it is told apart by, painted as a wash under the theme’s text; crate::multi_select::tint derives one from the name. A long name ends in …; the caller caps the width.

Source

fn breadcrumb(&self) -> Div

Breadcrumb trail. Items are added by the caller with Self::breadcrumb_item, separated by Self::breadcrumb_separator.

Source

fn breadcrumb_item(&self, label: impl Into<SharedString>, current: bool) -> Div

One crumb. The last one is current and stops looking clickable.

Source

fn breadcrumb_separator(&self) -> Svg

The chevron between crumbs.

Source

fn empty_state( &self, icon: impl Into<Icon>, title: impl Into<SharedString>, hint: impl Into<SharedString>, ) -> Div

The centered “nothing here yet” panel: icon, headline, one line of hint.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Content for Theme

Implementors§