Overview

API overview

The entry points, handles and conventions shared by every CrownUI API.

Everything in this reference is exported from crownui::prelude. Import it once at the top of each file.

use crownui::prelude::*;

Conventions

  • Builders are lowercase nouns such as vstack, text and button, and return an element you chain modifiers on.
  • Modifiers are Tailwind names with literal values in logical pixels.
  • Listeners use DOM names and receive (&mut Cx, &mut Event<T>). Events bubble, and handlers can call stop_propagation() or prevent_default().
  • State is reached through &mut Cx, which derefs to the reactive runtime.

Reference

Stability

CrownUI is pre-1.0. Following Cargo's semver rules, a minor release such as 0.2 may change these APIs. Check the changelog before you upgrade.

Errors

Entry points return Result<(), RunError>.

RunError::GraphicsGraphicsError

The graphics backend failed to initialize.

RunError::PlatformString

The platform failed, for example when no Wayland compositor is reachable.

RunError::Threadstd::io::Error

A thread could not be spawned.