Foundation / tool

KatanA UI Core

A Rust UI foundation independent of a specific UI framework, defining component state, events, themes, and rendering contracts with selectable integration layers.

Rust developers building reusable UI components and application display foundations

01

Implemented capabilities

Basic components and compound components such as SplitPane, Toolbar, and StatusBar

Evidence

Framework-neutral APIs for themes, events, rendering models, and windows

Evidence

Optional egui integration and text/SVG rasterization

Evidence

02

Getting started

  1. Prepare Rust and just, then get the repository.
  2. Try components with just storybook and enable only the features needed for integration.

Prepare Rust and the required development tools, then check the linked README for environment requirements before installing. Examples show an entry point and do not guarantee operation in every environment.

Evidence
sh
git clone https://github.com/HiroyukiFuruno/katana-ui-core.git
cd katana-ui-core
just storybook

01 / KUC

Where it fits

Compose screens from neutral UI parts

KUC is a Rust foundation for combining atoms, molecules, layout, state, events, and render models; it is not a finished application screen. The host selects components such as SplitPane or Toolbar and remains responsible for its own screen composition and framework integration.

Enable only the needed rendering layer

The default core remains framework-neutral, while egui, text-raster, svg-raster, and raster-host can be enabled independently as Cargo features. This preserves the common contracts while letting the host choose the UI input, text/SVG raster, or UI-tree rendering layers it needs.

02 / KUC

Input to output

  1. Configure a component

    The host creates SplitPane and configures axis, ratio_percent, min_percent, max_percent, handle_width_px, resize_mode, and child nodes through chained builder methods. Each component also retains its own state ID for later actions.

  2. Apply interaction contracts

    Translate pointer or keyboard resize, ratio changes, reset, and clamp operations into UiAction values. SplitPane clamps requested ratios into its configured range and converts the operation into callback-log and interaction-state results.

  3. Produce a render model

    Convert components to UiNode render models containing axis, ratio, handle, resize mode, and common interaction state. The latest raster-host contracts can connect this model to Canvas, TextRenderer, or UI-tree rendering, but windowing and the application shell remain host responsibilities.

03 / KUC

Key APIs and CLI

SplitPaneAxis
Horizontal and Vertical define the split direction and are converted into the axis field of the layout render model. This is a layout contract, not merely a display label.
SplitPaneResizeMode
PointerOnly, KeyboardOnly, PointerAndKeyboard, and Disabled constrain which host input routes may resize the pane. Disabled also prevents the handle from being focusable, making the permitted interaction path explicit.
Ratio and clamp settings
ratio_percent is the current ratio, min_percent and max_percent define its allowed range, and reset_percent is the value used for reset. Incoming values are clamped to that range rather than being rendered unchanged when they are out of bounds.
raster-host contract
The raster-host feature exposes Canvas, TextRenderer, UiTreeCanvasRenderer, and UiTreeInteractionSurface so one host boundary can combine rendering with hit and interaction handling. Core-only users that do not enable the feature do not take on those extra dependencies.

04 / KUC

Concrete example

Apply a SplitPane interaction contract

Build a horizontal SplitPane at 50%, clamp it between 20% and 80%, apply a UiAction that changes it to 64%, then apply keyboard resize and reset actions. Because the example uses the public component actions, a host converts framework events into UiAction values and feeds the resulting callback log into its own state management.

rust
use katana_ui_core::component::ComponentAction;
use katana_ui_core::interaction::UiAction;
use katana_ui_core::layout::{SplitPane, SplitPaneAxis, SplitPaneResizeSource, SplitPaneResizeMode};

fn main() {
    let mut split = SplitPane::new()
        .axis(SplitPaneAxis::Horizontal)
        .ratio_percent(50)
        .min_percent(20)
        .max_percent(80)
        .resize_mode(SplitPaneResizeMode::PointerAndKeyboard);
    let target = split.state_id().clone();
    let _ = split.apply_action(&UiAction::split_pane_set_ratio(target.clone(), 64));
    let _ = split.apply_action(&UiAction::split_pane_resize_by(
        target.clone(),
        4,
        SplitPaneResizeSource::Keyboard,
    ));
    let _ = split.apply_action(&UiAction::split_pane_reset_ratio(target));
    println!("ratio={}", split.ratio_percent_value());
}

05 / KUC

Integration boundaries

Prepare Rust and features

Add katana-ui-core and begin with its framework-neutral default Cargo features. Enable egui or raster-host only when the application needs those feature-specific dependencies, keeping the extra integration surface out of a core-only host.

Keep shell and verification in the host

KUC does not provide AppShell, page templates, or a complete application screen. Even when egui or raster-host adapters are connected, the host assembles application-specific screens and window management and performs validation outside the Storybook development environment.

Evidence

This overview is based on the public repositories at the time of review. Verify implementation and usage in the linked pinned commits.

RepositoryREADMEc3e80cb9098c
Evidence · KUC
All products