egui-material3
A Material Design component library for egui, providing Material Design 3 components with theme support.
Screenshots
Usage
Add this to your Cargo.toml:
Basic Example
use egui;
use ;
Theme Support
The library supports Material Design 3 themes with:
- Build-time theme inclusion: Themes are automatically included from JSON files during compilation
- Runtime theme loading: Load custom themes from files at runtime
- Multiple theme modes: Light, Dark, and Auto modes
- Contrast levels: Normal, Medium, and High contrast support
- Dynamic updates: Change themes and see updates immediately
Available Components
- MaterialButton - Material Design buttons with multiple variants
- MaterialCheckbox - Checkboxes with Material Design styling
- MaterialSlider - Sliders following Material Design guidelines
- MaterialSwitch - Toggle switches
- MaterialRadio - Radio buttons
- MaterialSelect - Dropdown selects
- MaterialChip - Filter and action chips
- MaterialCard - Material Design cards
- MaterialDialog - Modal dialogs
- MaterialFab - Floating Action Buttons
- MaterialProgress - Progress indicators
- MaterialIcon - Material Design icons
- MaterialTabs - Tab navigation
- MaterialDrawer - Navigation drawers
- MaterialTopAppBar - App bars
- MaterialDataTable - Data tables with sorting and selection
- MaterialImageList - Image lists with online/offline image support and smart caching
Image Lists with OnDemand Feature
The MaterialImageList component supports multiple image sources with smart caching:
use image_list;
// Local image files
ui.add;
// Online images (requires 'ondemand' feature)
ui.add;
// Embedded images from byte arrays
ui.add;
OnDemand Feature
Enable the ondemand feature for online image support:
[]
= { = "0.0.6", = ["ondemand"] }
Features:
- Smart caching: Downloaded images are cached locally with proper file extensions
- Format detection: Automatically detects PNG, JPEG, GIF, and WebP formats
- Efficient loading: Images are only downloaded once and reused from cache
- Performance optimized: UI repaints only when new images are available
- Error handling: Graceful fallback with visual indicators for failed loads
Examples
Look at the examples/ folder for complete examples:
main- Main Window for all storieswidget_gallery_example.rs- Showcase of all Material componentsnobel_prizes_example.rs- Real-world data table exampleondemand- Image list with online/offline images and caching demo