Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
egui-material3
A Material Design component library for egui, providing Material Design 3 components with theme support.
Screenshots
What's New
v0.0.9 (Latest)
- Optimized Package Size: SVG icon collections are now optional features, reducing default package size significantly
- Enable only the collections you need:
svg_solar,svg_noto,svg_twemoji - Or enable all with
svg_emojifeature
- Enable only the collections you need:
- Build Optimization: SVG resources excluded from default package, downloaded on-demand during build when features are enabled
v0.0.8
- New Components: ActionSheet, Badge, Breadcrumbs, Notification, Timeline, Toolbar, Tooltip, TreeView
- Enhanced Components: Button, Chip, and List now support small size variants
- Improved Carousel: Added mouse drag support for better interaction
- Better Mobile Support: Optimized DataTable padding for mobile UI
v0.0.7
- Spreadsheet Component: Full-featured spreadsheet with DuckDB backend
- Image Carousel: New MaterialCarousel component
- Small Controls: Added size variants for buttons, chips, and lists
v0.0.6
- Initial release with core Material Design 3 components
Installation
Add egui-material3 to your project:
# Basic installation
# With optional features
Or manually in Cargo.toml:
[]
= "0.0.9"
# With features
= { = "0.0.9", = ["ondemand", "svg_solar"] }
Usage
Quick Start Example
use egui;
use ;
Advanced Example
Here's a more comprehensive example showcasing recent additions:
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
Dynamically change theme appearance at runtime:
use ;
// Switch between light and dark modes
if let Ok = get_global_theme.lock
update_window_background;
// Or toggle mode with a button
if ui.add.clicked
Component Size Variants
Many components support size variants for different design needs:
use ;
// Small button for compact UIs
ui.add;
// Standard size (default)
ui.add;
// Small chips for tags
ui.add;
Available Components
Input & Selection
- MaterialButton - Material Design buttons with multiple variants (filled, outlined, text, elevated, tonal) and size options
- MaterialIconButton - Icon buttons (standard, filled, filled tonal, outlined, toggle)
- MaterialCheckbox - Checkboxes following Material Design guidelines
- MaterialSwitch - Toggle switches
- MaterialRadio / MaterialRadioGroup - Radio button groups with list tile support
- MaterialSlider / MaterialRangeSlider - Sliders with Material Design styling
- MaterialSelect - Dropdown selection components with menu alignment options
- MaterialChip - Filter, assist, input, and suggestion chips with size variants
Navigation & Layout
- MaterialTabs - Tab navigation (primary and secondary variants)
- MaterialDrawer - Navigation drawers (permanent, dismissible, modal, standard)
- MaterialTopAppBar - App bars and toolbars (standard, center-aligned, medium, large)
- MaterialToolbar - Flexible toolbar component with action items
- MaterialBreadcrumbs - Breadcrumb navigation for hierarchical paths
- MaterialMenu - Context menus and menu items with nested support
Feedback & Information
- MaterialDialog - Modal dialogs and alerts
- MaterialSnackbar - Toast notifications with optional actions
- MaterialNotification - Notification cards with actions and dismissal
- MaterialBadge - Badge indicators for counts and status
- MaterialProgress - Progress indicators (circular and linear)
- MaterialTooltip - Contextual tooltips with rich text support
- MaterialActionSheet - Bottom sheets for action selection
Data Display
- MaterialCard2 - Material Design cards (elevated, filled, outlined variants)
- MaterialList - Lists following Material Design patterns with visual density control
- MaterialDataTable - Data tables with sorting, selection, and custom cell content
- MaterialSpreadsheet - Full-featured spreadsheet with DuckDB backend (requires
spreadsheetfeature) - MaterialTimeline - Timeline component for chronological data
- MaterialTreeView - Hierarchical tree view with expand/collapse
Media & Content
- MaterialCarousel - Carousel for displaying items in a scrollable view with mouse drag support
- MaterialImageList - Image lists with online/offline support and smart caching (standard, masonry, woven variants)
- MaterialLayoutGrid - Grid layout with tile bars
- MaterialFab - Floating Action Buttons (primary, secondary, tertiary, surface, branded)
Icons & Symbols
- MaterialIcon - Material Design icons with font support
- MaterialSymbol - Material Symbols rendering (outlined, rounded, sharp variants)
Common Patterns
Building a Complete UI
Combine components to create rich user interfaces:
use *;
Form with Validation
Create forms with Material components:
ui.vertical;
Optional Icon & Emoji Collections
The library provides three comprehensive SVG collections as optional features. Each can be enabled independently:
- Solar Icons (
svg_solar) - ~1,200 UI/UX icons with variants - Noto Emoji (
svg_noto) - ~3,600 Google emojis with skin tone and gender variants - Twemoji (
svg_twemoji) - ~3,700 Twitter emoji
Feature Configuration
Choose the collections you need:
[]
# Enable individual collections (recommended - smaller binary size)
= { = "0.0.9", = ["svg_solar"] }
# Or enable specific combinations
= { = "0.0.9", = ["svg_solar", "svg_noto"] }
# Or enable all collections
= { = "0.0.9", = ["svg_emoji"] }
Usage
Icons and emojis are accessible through HashMaps with O(1) lookup:
use ;
// Access Solar icons (requires svg_solar feature)
if let Some = SOLAR_ICONS.get
// Access Noto emoji (requires svg_noto feature)
// Filename format: "emoji_u" + unicode codepoint
if let Some = NOTO_EMOJIS.get
// Access Twemoji (requires svg_twemoji feature)
// Filename format: unicode codepoint
if let Some = TWEMOJI.get
Note: SVG files are embedded at compile time when features are enabled. If building from crates.io (not git), files are automatically downloaded during build.
Features
OnDemand Feature
Enable online image support for MaterialImageList:
[]
= { = "0.0.9", = ["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.9", = ["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 demonstrating all components:
# Complete showcase of all Material components with theme switching
# Real-world data table implementation with Nobel Prize data
# Interactive component gallery (recommended for exploration)
# SVG icon demonstration (requires svg_solar feature)
Stories Example - Component Explorer
The stories example provides an interactive gallery with individual showcases for each component:
Input & Selection: actionsheet, button, checkbox, chips, iconbutton, radio, select, slider, switch Navigation: breadcrumbs, drawer, menu, tabs, toolbar, topappbar, treeview Feedback: badge, dialog, notification, progress, snackbar, tooltip Data Display: card2, datatable, list, spreadsheet, timeline Media: carousel, imagelist, layoutgrid, svgemoji, symbol
Each story window demonstrates component variants, states, and common usage patterns.
Standalone Examples
# OnDemand example - demonstrates online image loading
&&
# Package example - standalone deployable app with bundled resources
&&
Running with Features
# Run with spreadsheet support
# Run with all SVG icon collections
# Run with specific features
Documentation
Contributing
Contributions are welcome! Please check the issues for open tasks or create a new one.
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-Apache-2.0 or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Todos
- SVG sprite support
- Bump egui_extras to match resvg version (currently using patched 0.47)
- Additional component variants
- Performance optimizations for large datasets