ui_layout

Crates.ioui_layout
lib.rsui_layout
version0.8.0
created_at2026-01-02 10:07:58.799761+00
updated_at2026-01-25 11:48:05.301286+00
descriptionA minimal Flexbox-inspired layout engine for Rust GUI
homepage
repositoryhttps://github.com/098orin/ui_layout-rs
max_upload_size
id2018268
size70,649
(098orin)

documentation

README

ui_layout

Crates.io Docs.rs

A minimal Flexbox-inspired layout engine for Rust GUI development.

This crate provides a small, predictable layout system designed for custom GUI frameworks, editors, and experimental UI engines.

[!NOTE] This crate is under active development; patch releases may be frequent.

Features

  • Flex layout (Row / Column)
  • flex_grow and flex_basis
  • Fixed, percentage, and viewport-relative sizing via Length
  • Min / max size constraints (Length-based)
  • Margin, padding, and gaps with CSS-like spacing semantics
  • Block layout
  • Recursive tree-based layout
  • Parent-relative positioning
  • Row and column gaps (row_gap / column_gap)
  • Justify content (justify_content) and align items (align_items)

Non-goals

  • Full CSS compatibility
  • Inline or text layout
  • Absolute / fixed positioning
  • Web rendering or HTML/CSS parsing

Design goals

  • Simple and explicit layout rules
  • Easy to reason about and debug
  • Suitable for custom renderers (wgpu, skia, etc.)
  • No dependency on web standards or DOM

Example

use layout::*;

LayoutEngine::layout(&mut root, 800.0, 600.0);

For more examples and to understand the behavior of gaps, alignment, and sizing, see the unit tests in the tests/ directory. They provide practical usage patterns and expected layouts.

Status

See CHANGELOG.md for a detailed list of changes.

  • Version: 0.8.0
  • API is evolving but now includes full Flexbox-like alignment and gaps

Future versions may add:

  • flex_shrink
  • grid
  • Additional flex sizing rules (wrap, fr units, etc.)
  • Absolute / fixed positioning

License

MIT

Commit count: 200

cargo fmt