| Crates.io | univis_ui |
| lib.rs | univis_ui |
| version | 0.1.1 |
| created_at | 2026-01-03 00:04:41.119211+00 |
| updated_at | 2026-01-03 00:32:12.898484+00 |
| description | A high-performance, SDF-based hybrid world-space UI framework for the Bevy game engine. |
| homepage | https://github.com/USERNAME/univis |
| repository | https://github.com/USERNAME/univis |
| max_upload_size | |
| id | 2019365 |
| size | 295,524 |
Univis is a "hybrid" (Hybrid) framework for user interfaces in the Bevy engine.

The library acts as a bridge between the ease of traditional 2D UI layouts and the power of 3D world objects. With Univis, you write standard ECS code using Flexbox and Grid layouts, but the result is drawn as meshes supported by SDF technology within the game world.
No pixelation. No separate drawing stages. Just pure Bevy ECS entities.
Univis is designed for developers looking for a development experience (DX) similar to UI libraries, with the visual quality of game meshes.
Layout is defined using familiar concepts like Padding, Margin, Flex, and Grid.
Behind the scenes, each element is a Mesh2d with a custom SDF shader. This means:
No "Shadow DOM" or complex external state:
UNode, UBorder, ULayout)&mut UNode just like TransformA solver system supporting multiple layout styles:
| Style | Description | Ideal Use Case |
|---|---|---|
| Flex | Flexible row/column layout | Lists, bars, traditional layouts |
| Grid | Grid with fixed columns | Image galleries, dashboards |
| Radial | Circular distribution | Weapon lists, sci-fi reactors |
| Masonry | Height-based tiling | Pinterest layouts |
| Stack | Stacking on top of each other | Nested layers |
// Example: Three-column Grid
ULayout {
display: UDisplay::Grid,
grid_columns: 3,
gap: 10.0,
..default()
}
Round corners, soft shadows, and mathematically calculated borders for each pixel with extreme precision:
UNode {
border_radius: UCornerRadius {
top_left: 20.0, // Independent corner radius
top_right: 0.0,
bottom_right: 20.0,
bottom_left: 0.0,
},
..default()
}
Precise picking with meshes:
commands.spawn((
UNode::default(),
Pickable::default(),
))
.observe(|_: On<Pointer<Click>>| {
println!("Clicked!");
});
Text and containers adapt dynamically to content:
UNode {
width: UVal::Content, // Sized based on content
height: UVal::Auto, // Fills available space
..default()
}
[dependencies]
bevy = "0.17"
univis = "0.1.0"
use bevy::prelude::*;
use univis::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(UnivisUiPlugin)
.add_systems(Startup, setup)
.run();
}
fn setup(mut commands: Commands) {
commands.spawn(Camera2d);
// Root interface
commands.spawn((
UScreenRoot,
UNode {
width: UVal::Percent(1.0),
height: UVal::Percent(1.0),
background_color: Color::srgb(0.1, 0.1, 0.1),
padding: USides::all(20.0),
..default()
},
ULayout {
display: UDisplay::Flex,
justify_content: UJustifyContent::Center,
align_items: UAlignItems::Center,
..default()
},
))
.with_children(|parent| {
// Square with rounded corners
parent.spawn(UNode {
width: UVal::Px(300.0),
height: UVal::Px(200.0),
background_color: Color::srgb(0.2, 0.5, 0.9),
border_radius: UCornerRadius::all(16.0),
..default()
});
});
}
The library includes a set of illustrative examples:
# Basic Example
cargo run --example minimal
# Dashboard with Grid
cargo run --example dashboard
# Sci-fi UI with Radial
cargo run --example sci_fi_hud
All examples are available in the examples/ folder in the repository.
| Feature | Bevy UI | Univis UI |
|---|---|---|
| Rendering Technology | Rasterized (blurs in 3D) | SDF Shaders (infinite precision) |
| Space | Screen Space / 2D layer | World Space / Screen Space |
| Lighting | Not lit | Responds to 2D lighting |
| Physics | No interaction | Compatible with Colliders |
| Layout | Flexbox only (Taffy) | Flex + Grid + Radial + Masonry |
| Corners | Uniform | Independent corners |
Univis is powerful but experimental right now. It's designed for specific use cases (HUDs, in-game screens) and not for building general-purpose complex applications.
| Feature | Status | Notes |
|---|---|---|
| Flex/Grid/Radial Layouts | ✅ Stable | Strong and fast |
| SDF Rendering | ✅ Stable | Infinite precision |
| Text Labels | ✅ Stable | Wrapper around Bevy Text2d |
| Clipping (Scroll Views) | 🚧 In Progress | Work in progress with shader clipping |
| Text Input | 🚧 In Progress | Planned for future updates |
Univis supports smart, flexible sizing modes:
// Fixed pixels
UVal::Px(200.0)
// Percentage of parent
UVal::Percent(0.5) // 50%
// Content-based sizing
UVal::Content // Based on children
// Auto - fills available space
UVal::Auto
// Flexible - takes a share of remaining space
UVal::Flex(1.0)
commands.spawn((ULayout::default(), UNode::default()))
.with_children(|parent| {
// 25% of space
parent.spawn(UNode {
width: UVal::Flex(1.0),
..default()
});
// 50% of space
parent.spawn(UNode {
width: UVal::Flex(2.0),
..default()
});
// 25% of space
parent.spawn(UNode {
width: UVal::Flex(1.0),
..default()
});
});
Now the interface:
UBorder {
color: Color::WHITE,
width: 2.0,
radius: UCornerRadius::all(12.0),
offset: 0.0,
}
USides::all(16.0) // All sides
USides::axes(20.0, 10.0) // Horizontal, Vertical
USides::row(15.0) // Left and right only
USides::column(15.0) // Top and bottom only
USelf {
position_type: UPositionType::Absolute,
left: UVal::Px(20.0),
top: UVal::Px(20.0),
..default()
}
Contributions are welcome! Especially in:
To contribute:
Licensed under MIT and Apache 2.0.