8 releases
Uses new Rust 2024
| 0.1.8 | Jun 24, 2025 |
|---|---|
| 0.1.7 | Jun 20, 2025 |
#671 in Game dev
353 downloads per month
53KB
941 lines
🧱 Swoop UI
I found that impl Bundle is the best way, right?
Most methods implement Bundle and can be generated directly. However, some packaging requires multiple levels, so ViewToBundle is implemented and the pack() method is called to convert it into impl Bundle.
Swoop UI is a modular, ergonomic layout toolkit built on top of Bevy UI. It introduces expressive layout containers like HStack, VStack, HGrid, and VGrid, supporting fluent syntax for padding, spacing, border, and background styling.
Now only some packaged candies are generated, no additional functions, maybe they will be added later, a plugin is reserved, but it has not been used yet
| Type | Flex container | Grid container | Button |
|---|---|---|---|
| Horizontal | HStack | HGrid | HButton |
| Vertical | VStack | VGrid | VButton |
Trait function support
| Type | StackView | GridView | BorderView | BackgroundView | BoxShadowView | PositionView | TextView | TextShadowView |
|---|---|---|---|---|---|---|---|---|
| HStack | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||
| VStack | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||
| HGrid | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||
| VGrid | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||
| HButton | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||
| VButton | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||
| Text | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ||
| TextButton | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
✨ Features
- ✅ Chainable builder-style API (e.g.
.frame().padding().background_color()) - ✅ Grid and Stack layout containers with uniform interface
- ✅ Modular traits like
View,StackView,GridView,BorderView,BackgroundView,ShadowView, etc.
📦 Example
use swoop_ui::prelude::*;
fn setup_ui(mut commands: Commands) {
commands.spawn(
HStack::new()
.name("MainHeader1")
.frame(Val::Percent(100.0), Val::Px(64.0))
.padding(UiRect::horizontal(Val::Px(16.0)))
.background_color(Color::rgb(0.1, 0.1, 0.2))
.border_color(Color::WHITE)
.border_radius(BorderRadius::all(Val::Px(8.0)))
);
}
Bevy Engine version compatibility
| bevy | swoop-ui |
|---|---|
| 0.16 | 0.1 |
Dependencies
~64–100MB
~1.5M SLoC