Bevy UI Builders
Before using bevy-ui-builders
commands.spawn.with_children;
// Plus 30+ more lines for hover system...
After using bevy-ui-builders
// AFTER: With bevy-ui-builders (3 lines!)
use *;
new
.style
.build;
That's it! Hover effects, styling, and interaction handling included.
Production Use
These builders are used in Living Worlds, a Steam game.
- 336+ uses across 72 files
- Reduces repetitive UI code
- Familiar Rust builder pattern
Quick Start
Add to your Cargo.toml:
[]
= "0.16"
= "0.1"
Add the plugin:
use *;
use UiBuilderPlugin;
Complete Builder Catalog
1. ButtonBuilder - Styled Interactive Buttons
// Simple button
new.build;
// Styled button with size
new
.style // Primary, Secondary, Success, Danger, Warning, Ghost
.size // Small, Medium, Large, XLarge
.with_marker // Add your own marker component
.build;
// Convenience functions
primary_button.build;
danger_button.build;
ghost_button.build;
2. DialogBuilder - Modal Dialogs with Overlays
// Confirmation dialog
new
.title
.body
.danger_button
.cancel_button
.dismissible // Can't click outside to close
.z_index // Layer above other UI
.build;
// Preset dialogs
use presets;
error;
unsaved_changes;
3. TextInputBuilder - Advanced Text Inputs
// Text input with validation
new
.with_placeholder
.with_filter // Email validation
.with_max_length
.with_focus_group // Focus management
.with_clear_button // X button to clear
.with_marker
.build;
// Numeric input
text_input
.numeric_only // Only allows 0-9
.with_value
.build;
4. FormBuilder - Complete Forms with Validation
new
.title
.field
.field
.field
.field
.validation
.validation
.validation
.validation
.submit_button
.cancel_button
.build;
5. SliderBuilder - Value Sliders with Formatting
// Percentage slider
new
.width
.with_label // Shows "50%"
.with_marker
.build;
// Custom format
slider
.with_label
.build;
6. ProgressBarBuilder - Progress Indicators
// Basic progress bar
new // 75% complete
.style
.with_label // Shows "75%"
.animated // Smooth transitions
.build;
// Custom styled
progress
.fill_color
.track_color
.with_label_text
.build;
7. PanelBuilder - Flexible Container Panels
// Card panel with title
new
.style
.width
.padding
.with_title
.build_with_children;
// Transparent overlay panel
panel
.style
.position_type
.build;
8. LabelBuilder - Consistent Text Labels
// Styled labels
new
.style // Title, Heading, Body, Caption
.text_align
.margin
.build;
// Status labels
label
.style // Error, Success, Warning, Muted
.build;
9. SeparatorBuilder - Visual Dividers
// Horizontal separator
new
.style
.margin
.build;
// Vertical divider
separator_vertical
.style
.length
.build;
Cleanup
Generic cleanup system:
// Before: 15 lines of cleanup per UI system
// After: One line, works for ANY component!
app.add_systems;
Complete Example
use *;
use *;
;
;
Feature Flags
Control which builders are included:
# Include everything (default)
= "0.1"
# Or pick specific builders
= { = "0.1", = false, = ["button", "dialog"] }
Available features:
button- ButtonBuilderdialog- DialogBuildertext_input- TextInputBuilderform- FormBuilderslider- SliderBuilderprogress- ProgressBarBuilderpanel- PanelBuilderlabel- LabelBuilderseparator- SeparatorBuilder
Why Choose bevy-ui-builders?
We Fill The Gap
| Crate | Problem |
|---|---|
bevy_ui_builder |
Too basic, no text inputs or forms |
sickle_ui |
Complex macro system, steep learning curve |
bevy_dioxus |
Requires React/web knowledge |
bevy_egui |
Immediate mode, not native Bevy |
| bevy-ui-builders | Just right! Simple, powerful, pure Bevy |
Unique Features
- Automatic cleanup system - Generic
despawn_ui_entities<T> - Consistent styling - Centralized colors and dimensions
- Rich text inputs - Filtering, validation, focus management
- Type-safe markers - Add your own components to any builder
- Gateway architecture - Clean module boundaries
Bevy Version Support
| bevy-ui-builders | Bevy |
|---|---|
| 0.1 | 0.16 |
License
Dual-licensed under either:
- MIT license (LICENSE-MIT)
- Apache License, Version 2.0 (LICENSE-APACHE)
at your option.
Contributing
Contributions welcome! Please check CONTRIBUTING.md for development setup, coding standards, and how to submit pull requests.
Credits
Created by Noah Sabaj, the creator of bevy-plugin-builder.
The Bottom Line
// From 45 lines to 3. That's the power of builders.
new
.style
.build;
Complete Project Structure
bevy-ui-builders/
├── Cargo.toml # Package manifest
├── README.md # Public documentation
├── CLAUDE.md # THIS FILE - AI assistant instructions
├── examples/ # Coming soon!
│ └── (examples will be added in v0.2.0)
└── src/
├── lib.rs # Main library entry point
│
├── button/ # ButtonBuilder module
│ ├── mod.rs # Gateway (exports only)
│ ├── builder.rs # ButtonBuilder implementation
│ ├── plugin.rs # ButtonPlugin
│ ├── systems.rs # Button interaction systems
│ └── types.rs # Component types (StyledButton, etc.)
│
├── slider/ # SliderBuilder module
│ ├── mod.rs # Gateway
│ ├── builder.rs # SliderBuilder implementation
│ ├── plugin.rs # SliderPlugin
│ ├── systems.rs # Slider drag systems
│ └── types.rs # Slider, SliderHandle, SliderTrack
│
├── form/ # FormBuilder module
│ ├── mod.rs # Gateway
│ ├── builder.rs # FormBuilder implementation
│ ├── field.rs # Form field implementations
│ └── types.rs # FieldType, ValidationRule
│
├── dialog/ # DialogBuilder module
│ ├── mod.rs # Gateway
│ ├── builder.rs # DialogBuilder implementation
│ ├── plugin.rs # DialogPlugin
│ ├── systems.rs # Dialog interaction (ESC, overlay clicks)
│ └── types.rs # DialogOverlay, DialogType, button markers
│
├── text_input/ # TextInputBuilder module
│ ├── mod.rs # Gateway
│ ├── builder.rs # TextInputBuilder implementation
│ ├── plugin.rs # TextInputPlugin
│ ├── systems.rs # Focus management, validation
│ └── types.rs # InputFilter, TextInputFocus, etc.
│
├── progress/ # ProgressBarBuilder module
│ ├── mod.rs # Gateway
│ ├── builder.rs # ProgressBarBuilder implementation
│ ├── plugin.rs # ProgressBarPlugin
│ ├── systems.rs # Progress bar update systems
│ └── types.rs # ProgressBar, ProgressBarStyle
│
├── label/ # LabelBuilder module
│ ├── mod.rs # Gateway
│ ├── builder.rs # LabelBuilder implementation
│ └── types.rs # Label, LabelStyle
│
├── panel/ # PanelBuilder module
│ ├── mod.rs # Gateway
│ ├── builder.rs # PanelBuilder implementation
│ └── types.rs # Panel, PanelStyle
│
├── separator/ # SeparatorBuilder module
│ ├── mod.rs # Gateway
│ ├── builder.rs # SeparatorBuilder implementation
│ └── types.rs # Separator, SeparatorStyle, Orientation
│
├── styles/ # Centralized styling
│ ├── mod.rs # Gateway (exports colors & dimensions)
│ ├── colors.rs # Color constants (PRIMARY, SECONDARY, etc.)
│ └── dimensions.rs # Size constants (FONT_SIZE_*, PADDING_*, etc.)
│
├── systems/ # Shared systems
│ ├── mod.rs # Gateway
│ ├── cleanup.rs # Generic despawn_entities<T> system
│ ├── hover.rs # HoverPlugin for button effects
│ └── interaction.rs # Generic interaction handling
│
└── utils/ # Utilities
├── mod.rs # Gateway
└── intrinsic.rs # Intrinsic sizing utilities
Total: 48 Rust files across 13 modules