Skip to main content

Crate u0ui

Crate u0ui 

Source
Expand description

Carbon UI for GPUI: IBM Carbon v11 visuals, shadcn/ui component API, Material Symbols Sharp icons. Kit owns behavior; this crate owns appearance.

Layers (each depends only on those above it):

ModuleRole
tokensGenerated by u0ui-codegen from the design reference tokens.json: ColorRole, TypeStyle, spacing/size/radius
themeActive CarbonTheme, theme::color, LayerLevel, Kit theme bridge
typographyBundled IBM Plex, TypeStyled::type_style
motionCarbon curves and durations, reduced motion, state-change animation helpers
clockLocal wall-clock time (new Date()): toast captions, today
iconsMaterial Symbols Sharp Icon, CarbonIcon, asset source, Kit icon mapping
densityDensity (compact desktop default / comfortable)
componentsCarbon components (components::button is the reference)
t3The T3 Code pattern library, composed from the components
u0The u0 pattern library (u0 · … cards: foundations, primitives, …)
patternsBuilding blocks of the Carbon pattern examples (Carbon · Patterns cards)
use gpui_kit::*;
use u0ui::prelude::*;

struct App;
impl Render for App {
    fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
        div()
            .bg(color(ColorRole::Background))
            .child(Button::new("go", "Create project").icon(CarbonIcon::Add))
    }
}

fn main() {
    gpui_kit::application().with_assets(u0ui::Assets::new()).run(|cx| {
        gpui_kit::init(cx);
        u0ui::init(cx);
        gpui_kit::open_window(WindowOptions::default(), cx, |_, cx| cx.new(|_| App)).unwrap();
    });
}

Re-exports§

pub use density::Density;
pub use icons::Assets;
pub use icons::CarbonIcon;
pub use icons::Icon;
pub use icons::IconSize;
pub use theme::LayerLevel;
pub use tokens::CarbonTheme;
pub use tokens::ColorRole;
pub use tokens::TypeStyle;
pub use typography::TypeStyled;

Modules§

clock
Local wall-clock time: what the reference’s new Date() reads (the machine’s time zone, not UTC). Shared by components and demos that show “now” or “today”: toast captions (toLocaleTimeString()), Calendar’s today.
components
Carbon components. One module per component; see docs/ARCHITECTURE.md for the recipe (button is the reference implementation).
density
Desktop density.
focus
:focus-visible input modality, tracked per window the way Chromium does.
icons
Material Symbols Sharp icons (the design system’s only icon set).
measure
Sizes measured while a frame is laid out, for layouts that depend on their own width (CSS container queries, auto-fill tracks, fits).
motion
Carbon motion: easing curves, duration tokens, reduced motion and helpers that animate a value when a state changes.
patterns
Building blocks of the Carbon pattern examples (Carbon · Patterns cards, src/patterns.css in the design reference). The pattern compositions themselves live in the gallery; only the reusable parts are here.
prelude
Everything a component or page usually needs.
t3
The T3 Code pattern library (src/t3/*.jsx and src/t3.css in the design reference), redrawn with Carbon tokens from the u0ui components.
theme
The active Carbon theme, role lookup, layering and the Kit theme bridge.
tokens
Carbon design tokens, generated by u0ui-codegen from the design reference’s tokens.json ($U0UI_DESIGN_DIR/tokens.json, outside this repository) into the committed generated/tokens.rs.
typography
IBM Plex fonts and Carbon type styles.
u0
The u0 pattern library (u0 · … cards): the desktop pieces u0 (a macOS coding-agent console) needed on top of Carbon UI. Each module mirrors one reference file, src/ghost/<name>.jsx.

Functions§

init
Initialize u0ui. Call once after gpui_kit::init(cx) and before opening a window: registers the IBM Plex fonts, installs the active theme (White unless theme::ActiveTheme was set) and projects it into Kit’s theme, and maps Kit’s default icons to Material Symbols Sharp.