egui-material3-0.0.8 has been yanked.
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 System
The library provides comprehensive Material Design 3 theming capabilities:
Build-time Theme Inclusion
Themes are automatically included from JSON files during compilation:
use ;
// Uses themes from resources/ and examples/ directories automatically
setup_local_theme;
load_themes;
Runtime Theme Loading
Load custom themes dynamically:
use ;
// Load specific theme file
setup_local_theme;
load_themes;
Theme Modes and Contrast Levels
Change theme appearance at runtime:
use ;
// Change theme mode at runtime
if let Ok = get_global_theme.lock
// Apply changes
update_window_background;
Available Components
Basic Components
- MaterialButton - Material Design buttons with multiple variants (filled, outlined, text, elevated, tonal)
- MaterialCheckbox - Checkboxes following Material Design guidelines
- MaterialSlider / MaterialRangeSlider - Sliders with Material Design styling
- MaterialSwitch - Toggle switches
- MaterialRadio / MaterialRadioGroup - Radio button groups with list tile support
- MaterialSelect - Dropdown selection components with menu alignment options
Advanced Components
- MaterialChip - Filter, assist, input, and suggestion chips
- MaterialCard2 - Material Design cards (elevated, filled, outlined variants)
- MaterialDialog - Modal dialogs and alerts
- MaterialFab - Floating Action Buttons (primary, secondary, tertiary, surface, branded)
- MaterialProgress - Progress indicators (circular and linear)
- MaterialDataTable - Data tables with sorting, selection, and custom cell content
- MaterialCarousel - Carousel for displaying items in a scrollable view
- MaterialSnackbar - Toast notifications with optional actions
Navigation Components
- MaterialTabs - Tab navigation (primary and secondary variants)
- MaterialDrawer - Navigation drawers (permanent, dismissible, modal, standard)
- MaterialTopAppBar - App bars and toolbars (standard, center-aligned, medium, large)
Visual Elements
- MaterialIcon - Material Design icons with font support
- MaterialSymbol - Material Symbols rendering
- MaterialList - Lists following Material Design patterns with visual density control
- MaterialImageList - Image lists with online/offline support and smart caching (standard, masonry, woven variants)
- MaterialLayoutGrid - Grid layout with tile bars
- MaterialIconButton - Icon buttons (standard, filled, filled tonal, outlined, toggle)
- MaterialMenu - Context menus and menu items
Emoji Collections (svg_emoji feature)
When the svg_emoji feature is enabled, you get access to comprehensive SVG emoji and icon collections:
- Solar Icons (~1200 icons): UI/UX icon set with variants
- Noto Emoji (~3600 emoji): Google's emoji collection with skin tone and gender variants
- Twemoji (~3700 emoji): Twitter's emoji collection
[]
= { = "0.0.7", = ["svg_emoji"] }
use ;
// Get a Solar icon
if let Some = SOLAR_ICONS.get
// Get a Noto emoji (filename without .svg suffix)
if let Some = NOTO_EMOJIS.get
// Get a Twemoji (Unicode codepoint)
if let Some = TWEMOJI.get
Features
OnDemand Feature
Enable online image support for MaterialImageList:
[]
= { = "0.0.7", = ["ondemand"] }
The MaterialImageList component supports multiple image sources:
use image_list;
// Local image files
ui.add;
// Online images (requires 'ondemand' feature)
ui.add;
// Embedded images from byte arrays
ui.add;
Key capabilities:
- Smart caching: Downloaded images cached locally with correct file extensions
- Format detection: Automatically detects PNG, JPEG, GIF, and WebP formats
- Efficient loading: Images downloaded once and reused from cache
- Performance optimized: UI repaints only when new images available
- Error handling: Graceful fallback with visual indicators for failed loads
Spreadsheet Feature
Enable spreadsheet components with DuckDB backend:
[]
= { = "0.0.7", = ["spreadsheet"] }
The spreadsheet feature provides:
- MaterialSpreadsheet - Full-featured spreadsheet widget with DuckDB backend
- Column types: Text, Integer, Real, Boolean
- File formats: Import/export CSV, Excel (xls/xlsx), Parquet formats
- Async loading: Background data loading with progress indicators
- Data manipulation: Full SQL query support via DuckDB
use ;
// Create spreadsheet with column definitions
let columns = vec!;
let mut model = new?;
// Import data from CSV/Excel/Parquet
model.import_file?;
// Display in UI
ui.add;
Examples
The crate includes comprehensive examples:
# Showcase of all Material components with theme switching
# Real-world data table implementation
# Individual component showcase windows
# SVG icon demonstration (shows Solar icons embedded in FAB)
# OnDemand example with online image support
&&
# Standalone package example with bundled resources
&&
Example structure:
widget_gallery_example.rs- Complete showcase with theme controlsnobel_prizes_example.rs- Data table with real Nobel Prize datastories/- Individual component demos (button, card, dialog, drawer, fab, etc.)ondemand/- Standalone crate demonstrating online image loadingpackage/- Standalone deployable example with all resources
Todos
- svg sprite
- bump with egui_extras for it to having resvg 0.45.1. we are using 0.47 faked version due to some error.