Bevy_hui
Build bevy_ui design in pseudo Html. Keep your logic in bevy, while iterating fast on design
with hot reloading. Create reusable templates in the style of Web Components.
starting with bevy 0.15!
https://github.com/user-attachments/assets/4eb22305-7762-404e-9093-806b6a155ede
Features
- In build support for conditional styles and transitions. Hover animations by default!
- Any value can be a dynamic property and injected into a template at runtime. (recursive!)
- Simple but effective event system. Register any bevy system via function binding and use it
in your templates
on_press="start_game". - No widgets, no themes. Just bevy UI serialized with all the tools necessary to build anything in a reusable manor.
Example
Like most crates, don't forget to register the plugin!
app.add_plugins;
Getting Started (Bevy html syntax Cheatsheet)
Create your first component template with external properties!
<!-- /assets/my_button.html-->
greet
Press me
#123
#503
{text}
Register your component and make a custom binding
To use your new component in any other templates, we have to register it first.
You can either use the HuiAutoLoadPlugin feature (experimental), which
is great for simple components or register the component yourself in a startup system.
This also allows for custom spawning functions. With is great if you need to add custom components as well!
Putting it all together
Time to be creative. Include your component in the next template.
<!-- menu.html -->
My Game
...
...
Spawning your Template
Required components make it super simple.
Hot reload and advanced examples
Hot reload requires bevy file_watcher feature to be enabled.
Checkout the examples for advanced interactions, play with the assets. Keep in mind these are very crude proof of concepts.
# basic menu demo
# simple text inputs with a submit form
# simple sliders
Help wanted
I do not plan to offer any widgets on the templating side, but I would like to have common components and system for a general reusable widget toolkit like sliders, drop downs, draggable and so on.
Checkout the examples, if you come up with some really cool widgets, I would be happy to merge them into a
More examples
I am not the greatest designer. I am actively looking for some really fancy and cool examples, using this crate to include in the example crate.
Known limitations and Pitfalls
- Any manual changes to bevy's styling components will be overwritten
- Do not recursive import. [mem stonks, bug]
- One root node per component.