Bevy UI Builders
Before using bevy-ui-builders
commands.spawn.with_children;
// Plus 30+ more lines for hover system...
After using bevy-ui-builders
use *;
new
.style
.build;
That's it! Hover effects, styling, and interaction handling included.
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 // Allow letters and numbers
.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, and bevy-test-suite.
Bottom Line
// From 45 lines to 3. That's the power of builders.
new
.style
.build;
Complete Project Structure
bevy-ui-builders/
├── .github/ # GitHub Actions workflows
│ └── workflows/
│ ├── ci.yml # CI pipeline (test, clippy, fmt)
│ └── release.yml # Automated release to crates.io
├── examples/ # Usage examples
│ ├── button_showcase.rs # Button styles and sizes demo
│ ├── dialog_examples.rs # Dialog types and interactions
│ ├── form_complete.rs # Form with validation
│ ├── kitchen_sink.rs # All builders combined
│ ├── labels_and_separators.rs # Label styles and dividers
│ ├── panel_layouts.rs # Panel configurations
│ ├── progress_bars.rs # Progress bar animations
│ ├── slider_demo.rs # Slider interactions
│ └── text_input_demo.rs # Text input with filters
├── src/
│ ├── 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.)
│ ├── 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
│ ├── form/ # FormBuilder module
│ │ ├── mod.rs # Gateway
│ │ ├── builder.rs # FormBuilder implementation
│ │ ├── field.rs # Form field implementations
│ │ └── types.rs # FieldType, ValidationRule
│ ├── 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
│ ├── progress/ # ProgressBarBuilder module
│ │ ├── mod.rs # Gateway
│ │ ├── builder.rs # ProgressBarBuilder implementation
│ │ ├── plugin.rs # ProgressBarPlugin
│ │ ├── systems.rs # Progress bar update systems
│ │ └── types.rs # ProgressBar, ProgressBarStyle
│ ├── relationships/ # Bevy 0.16 custom relationships
│ │ ├── mod.rs # Gateway (exports only)
│ │ ├── types.rs # All relationship component definitions
│ │ ├── systems.rs # Relationship systems (button groups, etc.)
│ │ └── plugin.rs # UIRelationshipsPlugin
│ ├── separator/ # SeparatorBuilder module
│ │ ├── mod.rs # Gateway
│ │ ├── builder.rs # SeparatorBuilder implementation
│ │ └── types.rs # Separator, SeparatorStyle, Orientation
│ ├── slider/ # SliderBuilder module
│ │ ├── mod.rs # Gateway
│ │ ├── builder.rs # SliderBuilder implementation
│ │ ├── plugin.rs # SliderPlugin
│ │ ├── systems.rs # Slider drag systems
│ │ └── types.rs # Slider, SliderHandle, SliderTrack
│ ├── styles/ # Centralized styling
│ │ ├── mod.rs # Gateway (exports colors & dimensions)
│ │ ├── button_styles.rs # ButtonStyle and ButtonSize enums
│ │ ├── 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
│ ├── text_input/ # TextInputBuilder module
│ │ ├── mod.rs # Gateway
│ │ ├── builder.rs # TextInputBuilder implementation
│ │ ├── plugin.rs # TextInputPlugin
│ │ ├── systems.rs # Focus management, validation
│ │ └── types.rs # InputFilter, TextInputFocus, etc.
│ ├── utils/ # Utilities
│ │ ├── mod.rs # Gateway
│ │ └── intrinsic.rs # Intrinsic sizing utilities
│ └── lib.rs # Main library entry point
├── Cargo.lock # Dependency lock file
├── Cargo.toml # Package manifest
├── CHANGELOG.md # Version history
├── CONTRIBUTING.md # Contribution guidelines
├── LICENSE-APACHE # Apache License 2.0
├── LICENSE-MIT # MIT License
└── README.md # This file
Total: 72 files
Modules: 14 (13 builders/utilities + relationships with 4 files)