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.
What's New
Major Additions
- ScrollViewBuilder (v0.1.4) - Responsive scrollable containers with viewport-based sizing
- Use
Val::Vh()andVal::Vw()for responsive layouts - Mouse wheel scrolling, visual scrollbars, auto-scroll to focused inputs
- Use
- Native Text Input (v0.1.4) - Full text editing implementation
- Cursor rendering, text selection, clipboard ops (Ctrl+C/V/X)
- Undo/Redo (Ctrl+Z/Shift+Z), password masking
- Dialog Custom Markers (v0.1.7) - Add your own components to dialog buttons
build_with_buttons()returns button entitiesbuild_and_mark()helper for single marker
- Enhanced Builder Methods (v0.1.5-v0.1.6)
- ButtonBuilder:
margin(),height(),enabled(),build_in() - SliderBuilder:
with_format(),with_marker(),build_in() - PanelBuilder:
border_color(),flex_grow(),flex_shrink()
- ButtonBuilder:
Upgrade Guide
All v0.1.x releases maintain full backward compatibility - just update to the latest version!
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 all options
new
.style // Primary, Secondary, Success, Danger, Warning, Ghost
.size // Small, Medium, Large, XLarge
.with_marker // Add your own marker component
.margin // Custom margins
.height // Custom height
.enabled // Enable/disable state
.build; // Or use .build_in(parent) alias
// Convenience functions
primary_button.build;
danger_button.build;
ghost_button.build;
2. DialogBuilder - Modal Dialogs with Overlays
// Basic dialog
new
.title
.body
.danger_button
.cancel_button
.dismissible // Can't click outside to close
.z_index // Layer above other UI
.build;
// NEW: Get button entities for custom markers (v0.1.7)
let = new
.title
.confirm_button
.cancel_button
.build_with_buttons;
// Add your own markers to dialog buttons
if let Some = buttons.get
// Helper for single marker
new
.danger_button
.build_and_mark;
// Preset dialogs - static methods
error;
unsaved_changes;
confirm;
3. TextInputBuilder - Native Text Editing with Full Features
// Full-featured text input with native implementation (v0.1.4+)
new
.with_placeholder
.with_filter // Allow letters and numbers
.with_max_length
.with_focus_group // Tab navigation
.with_clear_button // X button to clear
.with_marker
.build;
// Password input with masking
text_input
.with_placeholder
.password // Masks input with bullets
.build;
// Numeric input
text_input
.numeric_only // Only allows 0-9
.with_value
.build;
Native Features (v0.1.4+):
- Full cursor rendering with blinking
- Text selection (keyboard Shift+arrows & mouse drag)
- Clipboard operations (Ctrl+C/V/X)
- Undo/Redo support (Ctrl+Z/Shift+Z)
- Proper Tab navigation between inputs
- Auto-scroll when text overflows
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 with new methods
slider
.with_label
.with_format // Alternative to format() method
.with_marker // Add custom marker component
.build_in; // Or use build() alias
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. ScrollViewBuilder - Responsive Scrollable Containers
// Basic scrollable container with viewport-based sizing
new
.max_height // 80% of viewport height
.padding_vw // 2% viewport width padding
.gap // 2% viewport height gap between children
.auto_scroll // Auto-scroll to focused elements
.build_with_children;
// Horizontal scrolling
scroll_view
.direction
.max_width // 90% viewport width
.build;
Features:
- Viewport-relative sizing (Val::Vh/Vw) for responsive design
- Mouse wheel scrolling support
- Visual scrollbars with auto-hide
- Auto-scroll to focused text inputs
- Smooth scroll animations
8. PanelBuilder - Flexible Container Panels
// Card panel with all options
new
.style
.width
.padding
.border_color // Custom border
.flex_grow // Flexbox growth
.flex_shrink // Flexbox shrink
.with_title
.build_with_children;
// Transparent overlay panel
panel
.style
.position_type
.build;
9. 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;
10. 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- SeparatorBuildercleanup- Generic cleanup systems
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;