Skip to content

RustUse/use-ui

RustUse/use-ui

use-ui is a RustUse facade workspace for portable, framework-neutral user interface primitives. It models stable UI vocabulary such as design tokens, themes, layout, spacing, breakpoints, viewports, component metadata, interaction states, focus metadata, affordances, motion semantics, and layer ordering.

RustUse is a collection of composable sets of primitive Rust utility crates. This workspace follows that shape: focused crates stay small and dependency-light, and the top-level use-ui crate primarily re-exports the focused crates behind feature flags.

What it is not

use-ui is not:

  • a rendering framework
  • a component framework
  • a CSS framework
  • a web-only crate
  • a wrapper around React, Vue, Yew, Leptos, Dioxus, egui, Iced, Tauri, or another UI runtime
  • a design-token parser
  • an accessibility audit engine
  • an animation runtime

Why framework-neutral primitives help

Framework-neutral UI primitives are useful when the same UI vocabulary needs to move across boundaries. A design-system tool, docs generator, schema format, Rust web framework, desktop tool, TUI, code generator, test utility, or AI-generated UI planner can share names and metadata without taking a dependency on a renderer.

The crates in this workspace describe UI intent and structure. They do not render pixels, generate CSS, bind to a DOM, or implement keyboard behavior.

Workspace crates

Crate Purpose Status
use-ui Feature-gated facade over focused UI primitive crates initial
use-design-token Design-token names, paths, categories, values, references initial
use-theme Theme modes, names, variants, and semantic roles initial
use-layout Layout direction, axis, alignment, justification, and flow initial
use-spacing Spacing scale, named spacing, insets, gaps, margins initial
use-breakpoint Breakpoint names, ranges, and breakpoint sets initial
use-viewport Viewport size, orientation, density, class, and scale initial
use-ui-component Component identity, parts, slots, variants, sizes, roles initial
use-interaction Interaction state, kind, intent, and helper methods initial
use-focus Focus state, target, order, visibility, index, scope initial
use-affordance Affordance vocabulary and affordance-set membership initial
use-ui-motion Motion duration, curve, preference, transition semantics initial
use-layer UI layer roles, z-index values, stacks, and ordering initial

Basic usage

# #[cfg(feature = "full")]
# {
use use_ui::{
    affordance::Affordance,
    interaction::InteractionState,
    layer::LayerRole,
    layout::{Alignment, Direction},
    theme::ThemeMode,
};

let state = InteractionState::Focused;
let direction = Direction::Vertical;
let alignment = Alignment::Center;
let layer = LayerRole::Modal;
let theme = ThemeMode::Dark;
let affordance = Affordance::Clickable;

assert!(state.is_focus_visible_candidate());
assert_eq!(direction, Direction::Vertical);
assert_eq!(alignment, Alignment::Center);
assert!(layer.sits_above(LayerRole::Popover));
assert_eq!(theme, ThemeMode::Dark);
assert_eq!(affordance, Affordance::Clickable);
# }

Feature model

The facade crate enables all focused crates by default through full. Disable default features when you want a narrow facade surface.

[dependencies]
use-ui = { version = "0.1.0", default-features = false, features = ["theme", "layout", "interaction"] }

Experimental status

This is an experimental v0.1.0 workspace. APIs are intentionally small, explicit, and primitive while the RustUse UI vocabulary settles. The release line should stay below 0.3.0 until production readiness is intentional.

Development

cargo fmt --all -- --check
cargo check --workspace --all-features
cargo check --workspace --all-features --examples
cargo clippy --workspace --all-targets --all-features -- -D warnings
cargo test --workspace --all-features
cargo test --workspace --no-default-features
cargo doc --workspace --all-features --no-deps

License

Licensed under either of the following, at your option:

  • Apache License, Version 2.0
  • MIT license

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors