egui-macview
Native-style macOS AppKit controls, layouts, and smooth spring animations for egui on Windows, macOS, Linux, and Web.
Why egui-macview?
Standard egui is great for quick tools and game overlays, but building a desktop application that feels like a native macOS app (such as Xcode, Final Cut Pro, Finder, or System Settings) requires predictable widget dimensions, crisp 1px borders, keyboard navigation, and smooth animations.
egui-macview gives you a ready-to-use library of 35+ macOS AppKit and AVKit controls built directly on egui 0.37:
- Measured on real macOS hardware: Control heights, padding insets, corner radii, and colors are measured directly from macOS Sonoma (
AppKitandAVKit) so your UI looks right out of the box. - Light, Dark, and Anthracite themes: Switch seamlessly between
MacAppearance::Aqua(Light),MacAppearance::DarkAqua(Dark), andMacAppearance::Anthracite, with automatic WCAG contrast handling for custom accent colors. - Battery-friendly by design: Zero background repaints when idle, automatic animation pausing when the window is unfocused or minimized, and 2D viewport culling for large tables and grids.
- Cross-platform vector icons: Includes an embedded
CupertinoIconsTrueType font so symbols look identical on Windows, macOS, Linux, and Web without relying on OS emojis.
Installation
Add egui-macview to your Cargo.toml:
[]
= "0.37.0"
= "0.6.1"
To run the interactive showcase gallery included in this repository:
Quick Start & Copy-Paste Examples
Every control in egui-macview works with standard egui::Ui and optionally accepts a [MacTheme]. If you call theme.apply_to_egui(ctx) once when your app starts (or when the theme changes), widgets will automatically pick up your active theme even if you omit .theme(&theme).
1. Theme Setup, Buttons, Toggles & Segmented Controls
use ;
# let ctx = default;
// Call once at startup to register the monochrome Cupertino vector icon font:
let mut fonts = default;
setup_symbols_font;
ctx.set_fonts;
// Create a macOS theme (Aqua for Light mode, DarkAqua for Dark mode)
let theme = new;
theme.apply_to_egui;
# let mut output = ctx.run_ui;
# output.textures_delta.clear;
2. Forms, Text Inputs, Search Fields, Sliders & Steppers
Use [MacForm] for clean two-column macOS preference panes with right-aligned labels and left-aligned controls:
use ;
# let ctx = default;
# let mut output = ctx.run_ui;
# output.textures_delta.clear;
3. Dropdowns & Searchable Combo Boxes (MacComboBox & MacPopUpButton)
Use [MacPopUpButton] when the user picks from a fixed list, or [MacComboBox] when they can both type to filter and pick from a dropdown list:
use ;
# let ctx = default;
# let mut output = ctx.run_ui;
# output.textures_delta.clear;
4. Date & Time Picker (MacDatePicker)
[MacDatePicker] supports both a compact text field with an integrated stepper (TextFieldAndStepper, where users can click year/month/day segments and use arrow keys) and a visual month calendar grid with an analog clock (ClockAndCalendar):
use ;
# let ctx = default;
# let mut output = ctx.run_ui;
# output.textures_delta.clear;
5. Layout Containers: Tabs, Collapsible Disclosure Groups, Boxes & Split Views
Organize complex inspector panels and multi-pane windows with [MacTabView], [MacDisclosureGroup], [MacBox], and [MacSplitView]:
use ;
# let ctx = default;
# let mut output = ctx.run_ui;
# output.textures_delta.clear;
6. Data Views: Multi-Column Tables, 2D Grids, Breadcrumb Path Bars & Rule Editors
Render large datasets smoothly with [MacTableView] and [MacCollectionView] (both use viewport culling so off-screen rows/tiles cost zero CPU time):
use BTreeSet;
use ;
# let ctx = default;
# let mut output = ctx.run_ui;
# output.textures_delta.clear;
7. Media Player Overlay, Timeline Scrubber, Audio Meters & Rotary Dials
Build audio/video players and studio interfaces with [MacPlayerView], [MacTrimScrubber], [MacLevelIndicator], [MacCircularSlider], and [MacRatingIndicator]:
use ;
# let ctx = default;
# let mut output = ctx.run_ui;
# output.textures_delta.clear;
Component Reference
Layout Containers (src/layout/ & src/controls/)
| Component | macOS AppKit Equivalent | What It Does |
|---|---|---|
MacSplitView |
NSSplitView |
Resizable two-pane split container with min/max size constraints. |
MacStackView |
NSStackView |
Horizontal or vertical linear stack with consistent spacing and optional dividers. |
MacScrollView |
NSScrollView |
Scroll container with overlay scrollbars that fade out when idle. |
MacForm |
NSGridView / Form |
Two-column form layout with right-aligned labels and left-aligned controls. |
MacRow |
Auto-Layout Row | Single-line horizontal row that distributes width cleanly across child cells. |
MacFixedView |
Retained Frame | Fixed-size coordinate container that prevents child widgets from overflowing. |
MacBox |
NSBox |
Grouped border box with an optional title and standard horizontal separator. |
MacTabView |
NSTabView |
Tabbed container supporting top segmented tabs (TopTabsBezelBorder) or borderless pages. |
MacDisclosureGroup |
NSButton Disclosure |
Collapsible section with an animated rotating disclosure triangle (CASpring). |
Controls & Data Views (src/controls/)
| Component | macOS AppKit Equivalent | What It Does |
|---|---|---|
MacButton / MacButtonCell |
NSButton |
Push buttons, default action blue buttons, checkboxes, radio buttons, and icon buttons. |
MacToggle |
NSSwitch |
Animated pill switch with system green active fill. |
MacSegmentedControl |
NSSegmentedControl |
Multi-segment pill switcher with a sliding selection thumb. |
MacInputCell |
NSTextField |
Single-line text and numeric input with focus ring, Tab cycling, Enter commit, and Escape cancel. |
MacSearchField |
NSSearchField |
Search input with leading magnifying glass icon and trailing clear (×) button. |
MacComboBox |
NSComboBox |
Editable text field combined with a filterable dropdown list (Alt+Down, arrow keys, Enter). |
MacPopUpButton |
NSPopUpButton |
Dropdown menu button with double-chevron indicator and screen-clamped popover. |
MacSlider |
NSSlider (Linear) |
Horizontal slider with optional tick marks and keyboard arrow stepping. |
MacCircularSlider |
NSSlider (Circular) |
Rotary dial knob with drag tracking, angle indicator, and spring feedback. |
MacStepper |
NSStepper |
Up/down numeric increment buttons with range clamping. |
MacDatePicker |
NSDatePicker |
Date and time selector supporting both inline stepper fields and a month calendar + analog clock. |
MacColorWell |
NSColorWell |
Color swatch button with alpha checkerboard preview and popover color picker. |
MacProgressIndicator |
NSProgressIndicator |
Determinate/indeterminate progress bars and 12-spoke spinning activity indicators. |
MacLevelIndicator |
NSLevelIndicator |
Continuous or discrete audio/capacity meter with green/yellow/red thresholds and peak hold. |
MacRatingIndicator |
NSLevelIndicator (Rating) |
Interactive 5-star rating widget with optional half-star precision. |
MacTokenField |
NSTokenField |
Tag input that turns comma- or Enter-separated words into removable capsule pills. |
MacPathControl |
NSPathControl |
Interactive folder/file breadcrumb bar with clickable segments. |
MacOutlineView |
NSOutlineView |
Collapsible tree view for sidebars and hierarchical lists. |
MacTableView |
NSTableView |
Multi-column sortable table with alternating row fills, multi-selection, and viewport culling. |
MacCollectionView |
NSCollectionView |
2D grid view with flow layout, rubber-band marquee selection, arrow-key navigation, and viewport culling. |
MacRuleEditor |
NSRuleEditor |
Multi-row predicate filter builder with criterion pills and [+] / [-] row buttons. |
MacPlayerView |
AVPlayerView |
Media player transport overlay supporting Floating HUD pod, Inline bar, and Minimal styles. |
MacTrimScrubber |
AVPlayerView Trim Bar |
QuickTime-style timeline scrubber with waveform preview, yellow In/Out trim handles, and timecode badge. |
Navigation, Surfaces & State (src/navigation/, src/surfaces/, src/state/)
| Component | macOS AppKit Equivalent | What It Does |
|---|---|---|
MacToolbar |
NSToolbar |
Window titlebar with traffic light buttons (or Windows caption buttons), drag-to-move, and double-click maximize. |
MacMenuBar |
NSMenu |
Top menu bar with cascading submenus and keyboard shortcut handling. |
MacCommandPalette |
Spotlight Overlay | ⌘K / Ctrl+K modal command search bar with fuzzy matching. |
MacCanvasFooter |
Status Bar | 24 pt bottom status bar with breadcrumbs, cursor coordinates, and zoom presets. |
MacContextMenu |
Context Menu | Right-click popup menu clamped to the window bounds. |
MacToastManager |
HUD Notification | Non-blocking toast banners with spring entry/exit animations. |
MacPanel / MacPopover |
NSPanel / NSPopover |
Floating translucent utility panels, inspector cards (MacCard), and compact HUD boxes (MacFloatingInfoBox). |
NSUndoManager |
NSUndoManager |
Bounded undo/redo history stack with duplicate-state filtering. |
Quality & Testing
Run the full test suite and linter with:
- 22 integration test suites and 30+ documentation tests verify widget layout, keyboard navigation, undo/redo roundtrips, WCAG contrast ratios, and zero idle CPU usage.
- Design token architecture: All dimensions, spacing, corner radii, and semantic colors live in
tokens/design_tokens.jsonand are resolved through [MacTheme].
License
Dual-licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.