Skip to main content

Crate bevy_material_ui

Crate bevy_material_ui 

Source
Expand description

§Bevy Material UI

Material Design 3 UI components for the Bevy game engine.

This library provides a comprehensive set of UI components following Material Design 3 guidelines, implemented as Bevy ECS components and systems.

§Features

  • Theme System: Complete MD3 color scheme with light/dark mode support
  • Components: Button, Card, Checkbox, Dialog, Divider, FAB, List, Menu, Progress, Radio, Ripple, Select, Slider, Switch, Tabs, TextField
  • Accessibility: Built-in support for focus rings
  • Customization: Token-based styling system for easy theming

§Quick Start

use bevy::prelude::*;
use bevy_material_ui::prelude::*;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(MaterialUiPlugin)
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, theme: Res<MaterialTheme>) {
    commands.spawn(Camera2d);
     
    // Create a filled button
    commands.spawn(
        MaterialButtonBuilder::new("Click Me")
            .filled()
            .build(&theme)
    );
}

§Architecture

This library follows patterns from the official Material Design implementations:

Modules§

adaptive
Adaptive layout utilities (window size classes) Window Size Classes for Adaptive Layouts
app_bar
App bar components (top and bottom) Material Design 3 App Bar components
badge
Badge component for notifications Material Design 3 Badge component
button
Button components (filled, outlined, text, elevated, tonal) Material Design 3 Button component
button_group
Button groups / segmented buttons (toggle groups) Material button group / toggle group (segmented buttons)
card
Card components (elevated, filled, outlined) Material Design 3 Card component
checkbox
Checkbox component Material Design 3 Checkbox component
chip
Chip components for filters, actions, and tags Material Design 3 Chips component
color
HCT color space and dynamic color generation Material Design 3 Color System
date_picker
Date picker component (Material Design 3) Material Design 3 Date Picker Component
dialog
Dialog component Material Design 3 Dialog component
divider
Divider component Material Design 3 Divider component
elevation
Elevation and shadow utilities Elevation system for Material Design 3
fab
Floating Action Button (FAB) component Material Design 3 Floating Action Button (FAB) component
focus
Focus ring component for accessibility Focus ring system for Material Design 3
i18n
Runtime localization / translation (i18n) Runtime localization / translation (i18n)
icon_button
Icon button component Material Design 3 Icon Button component
icons
Embedded icon system Embedded icon system.
layout
Material layout components (e.g. Scaffold) Material Design 3 layout components.
list
List and list item components Material Design 3 List component
loading_indicator
Loading indicator component Material Design 3 Loading Indicator
locale
Locale configuration and locale-driven defaults Locale configuration for Material UI.
menu
Menu and menu item components Material Design 3 Menu component
motion
Motion and animation utilities Motion and animation utilities for Material Design 3
prelude
Prelude module for convenient imports
progress
Progress indicators (linear and circular) Material Design 3 Progress Indicators
radio
Radio button component Material Design 3 Radio Button component
ripple
Ripple effect component for touch feedback Ripple effect for Material Design 3
scroll
Scroll container for scrollable content Scrollable container component for Material Design 3
search
Search bar component Material Design 3 Search Bar and Search View
select
Select/dropdown component Material Design 3 Select (Dropdown) component
slider
Slider component Material Design 3 Slider component
snackbar
Snackbar component for brief messages Material Design 3 Snackbar component
switch
Switch/toggle component Material Design 3 Switch component
tabs
Tabs component Material Design 3 Tabs component
telemetry
Telemetry and test automation support Telemetry and test automation support
text_field
Text field components (filled, outlined) Material Design 3 Text Field component
theme
Theme and color system based on Material Design 3 Material Design 3 Theme System
time_picker
Time picker component (Material Design 3) Material Design 3 Time Picker Component
tokens
Spacing, corner radius, duration, and easing tokens Design tokens for spacing and corner radius
toolbar
Toolbar component Material Design 3 Toolbar component
tooltip
Tooltip component for contextual help Material Design 3 Tooltip component
typography
Typography scale definitions Typography scale based on Material Design 3

Structs§

MaterialUiCorePlugin
Core plugin that provides the shared foundations required by most components.
MaterialUiPlugin
Main plugin that adds all Material UI functionality to your Bevy app.
MaterialUiPlugins
A plugin group that adds Material UI plugins in stages. Use this if you want more control over which plugins are added.