Crate swoop_ui

Source
Expand description

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

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.

§UI Layout Overview

This crate defines a menu bar container using a horizontal stack layout:

use bevy::prelude::*;
use swoop_ui::prelude::*;

fn setup(mut commands: Commands) {
    commands.spawn((
        HStack::new(AlignItems::Start, Val::Auto)
            .background_color(Srgba::WHITE.into())
            .justify_content(JustifyContent::Start)
            .pack(),
    ));
}
  • HStack creates a horizontal layout with children aligned at the top.
  • The background color is set using the impl Into value.
  • Contents are left-aligned using JustifyContent::Start.

Because the impl Bundle is implemented, it can be directly generated using commands.spawn

Modules§

background
border
button
Button
container
Layouts and containers
position
prelude
shadow
text
Text

Structs§

SwoopUiPlugin
Reserved for future addition of system functions

Traits§

View
Provides a builder-style trait for configuring UI elements using a fluent interface.
ViewToBundle