Skip to main content

Scaffolding

Trait Scaffolding 

Source
pub trait Scaffolding: ThemeExt {
    // Provided methods
    fn page_column(&self) -> Div { ... }
    fn page_header(
        &self,
        title: impl Into<SharedString>,
        count: Option<usize>,
    ) -> Div { ... }
    fn page_subtitle(&self, copy: impl Into<SharedString>) -> Div { ... }
    fn field_label(&self, label: impl Into<SharedString>) -> Div { ... }
    fn option_card_row(&self) -> Div { ... }
    fn option_card(
        &self,
        label: impl Into<SharedString>,
        selected: bool,
        preview: AnyElement,
    ) -> Div { ... }
    fn group_box(&self) -> Div { ... }
    fn card_row(&self, first: bool) -> Div { ... }
    fn row_icon(&self, icon: impl Into<Icon>) -> Div { ... }
    fn row_title(&self, title: impl Into<SharedString>) -> Div { ... }
    fn meta_line(&self, fragments: Vec<AnyElement>) -> Div { ... }
}

Provided Methods§

Source

fn page_column(&self) -> Div

Centered page column: mx-auto w-full max-w-3xl px-6 pb-16 pt-8.

Source

fn page_header( &self, title: impl Into<SharedString>, count: Option<usize>, ) -> Div

Page headline row: flex items-baseline gap-2.5 — title and count sharing a baseline (the reference settings.devices.tsx).

Source

fn page_subtitle(&self, copy: impl Into<SharedString>) -> Div

Subtitle under the headline: mt-1 text-muted-foreground.

Source

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

Small label above a group of controls (font-medium) — the “Theme” caption over a picker, not a page headline.

Source

fn option_card_row(&self) -> Div

A row of equally-sized preview cards for picking one of N visual options.

Deliberately knows nothing about themes: the caller supplies each preview as an arbitrary element and picks however many cards it wants, so the same control works for a density picker, a layout picker or anything else where the choice is easier to show than to describe. Pair with Self::option_card.

Source

fn option_card( &self, label: impl Into<SharedString>, selected: bool, preview: AnyElement, ) -> Div

One card in an Self::option_card_row: a fixed-height preview frame that carries the selection ring, with a caption underneath.

preview fills the frame and must round its own corners to OPTION_CARD_RADIUS if it paints a background — see that constant.

Returns a plain Div like the rest of this module — the caller adds .id(..) and .on_click(..), so selection behaviour stays with the page that owns the state.

Source

fn group_box(&self) -> Div

Section card: a rounded plate at Theme::card_glass_bg, its own tone carrying the edge the way a SwiftUI grouped Form section does.

Source

fn card_row(&self, first: bool) -> Div

One card row, split from the row above by a full-width hairline. Hover is caller-owned — gpui panics on a second hover, so the wash to chain is Theme::element_hover.

Source

fn row_icon(&self, icon: impl Into<Icon>) -> Div

The leading symbol on a row: a bare glyph, sized to the text beside it, the way the macOS General pane carries one.

Source

fn row_title(&self, title: impl Into<SharedString>) -> Div

Row title. Clipped rather than ellipsised: an ellipsis sets text_overflow, which opts the label out of gpui’s measure cache, and a list of them re-measures every row on every frame it scrolls.

Source

fn meta_line(&self, fragments: Vec<AnyElement>) -> Div

The quiet meta line under a row title: text-muted-foreground/65 fragments joined by dots.

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 Scaffolding for Theme

Implementors§