avalonia-pro-max/SKILL.md
name: avalonia-pro-max
description: "Use when designing or polishing the visual quality of an Avalonia app — choosing themes, building a design system, crafting beautiful screens, improving accessibility, motion, layout, or before shipping a UI. Routes to focused sub-skills for tokens, themes, components, motion, accessibility, layout patterns, icons, and pre-delivery review."
Avalonia Pro Max — Beautiful Avalonia UIs
Purpose
avalonia skills teach you the framework. avalonia-pro-max teaches you to make it look and feel professional: design tokens, theme selection, component recipes, motion, accessibility, responsive layout, icons, and final QA.
This skill is the desktop/cross-platform counterpart to ui-ux-pro-max. Same priorities, but every rule is mapped to Avalonia 12.x (XAML, FluentTheme, ControlThemes, pseudoclasses, AutomationProperties, etc.).
Avalonia Versions
Supports Avalonia 11.3, 12.0 and 12.1 (latest 12.1.4). Detect the project's version first and use the avalonia-versions skill (version matrix, renamed APIs, label convention). In these sub-skills: (12.0+) / (12.1+) = needs that version or newer, (11.x) = 11.x only (removed/obsolete in 12), no label = works in 11.3, 12.0 and 12.1. Never mix 11.x and 12.x APIs. No project yet → 12.1.x on net10.0.
When to Use
Must use
- Building a new screen, window, or page
- Restyling an existing app or replacing the default look
- Choosing a theme library (FluentAvalonia, SukiUI, Semi, Material, ShadUI, Ursa…)
- Defining colors, typography, spacing, radius, elevation tokens
- Adding animations, transitions, hover/press states
- Implementing dark/light theme variants
- Reviewing UI before shipping or PR
- The user says "make this beautiful", "modernize", "polish", "looks bland"
Recommended
- Migrating WPF visuals to Avalonia and wanting modern feel (combine with
avalonia-wpf-migration) - Cross-platform polish (desktop + mobile + web)
- Building a reusable component library
Skip
- Pure data binding, MVVM plumbing, services, deployment — use base
avaloniasubskills
Routing Table
| Task | Load sub-subskill |
|---|---|
| Design tokens, palettes, typography scale, spacing, theme variants, semantic color system | avalonia-pro-max/design-system |
| Picking and configuring a theme library (FluentAvalonia, SukiUI, Semi, Material, ShadUI, Ursa, Material.Avalonia) | avalonia-pro-max/themes |
| Production-ready XAML recipes: cards, dialogs, command bar, sidebar nav, settings page, forms, empty states | avalonia-pro-max/components |
| Transitions, keyframe animations, easing, hover/press feedback, page transitions, reduced-motion | avalonia-pro-max/motion |
| Contrast, focus rings, keyboard navigation, AutomationProperties, screen readers, dynamic font scaling | avalonia-pro-max/accessibility |
| Responsive design, breakpoints, AdaptiveLayout, NavigationView vs sidebar vs bottom nav, dashboards | avalonia-pro-max/layout-patterns |
| Icon libraries (Lucide, Material, FontAwesome, Heroicons), SVG (Svg.Skia), brand assets, image optimization | avalonia-pro-max/icons-imagery |
| Final QA before merge / release — checklist of every must-pass item | avalonia-pro-max/review-checklist |
| Show the user 2–3 design alternatives as rendered Avalonia screens in a browser gallery before implementation; user picks one in chat | avalonia-pro-max/preview-server |
Workflow for "Build a beautiful Avalonia app/screen"
Establish the design system →
design-system
Choose palette (semantic tokens), typography scale, spacing rhythm, radius scale, elevation. Persist asResources/Tokens.axaml+ theme-variant dictionaries.Pick a theme base →
themes
FluentTheme + community theme (or pure custom). The themes sub-skill has a recommendation matrix by app type.Build screens with recipes →
components
Use the recipe library — never hand-roll a card / dialog / nav from zero when a vetted pattern exists.Apply motion →
motion
AddTransitionsto interactive controls, page transitions for navigation, respectprefers-reduced-motion.Verify accessibility →
accessibility
AutomationProperties, focus order, contrast 4.5:1, keyboard parity.Check responsive behavior →
layout-patterns
Test at 800/1280/1920 widths; mobile/tablet via Avalonia.Mobile.Run the review checklist →
review-checklist
Pre-merge audit. If anything fails, loop back.
Optional: Show the user options first
If the user wants to see and pick between alternatives before you commit to a direction (e.g., "show me a few options", "what would this look like"), insert this before step 3:
→ preview-server — generate 3 variant .axaml files, render each via Avalonia.Headless to PNG (light/dark × wide/compact), serve a side-by-side HTML gallery. The user reviews in their browser and tells you which to build.
Priority of Concerns
Same global priority as ui-ux-pro-max, mapped to Avalonia:
| # | Category | Avalonia Mechanism | Sub-skill |
|---|---|---|---|
| 1 | Accessibility | AutomationProperties.*, focus pseudoclasses, contrast | accessibility |
| 2 | Touch & interaction | Min hit-target via Padding/MinHeight, :pointerover / :pressed styles | components, motion |
| 3 | Performance | CompiledBinding (default in 12.0+, opt-in in 11.x), virtualization (VirtualizingStackPanel), RenderOptions.BitmapInterpolationMode | components, layout-patterns |
| 4 | Style selection | Theme library + ControlTheme + Style classes | themes, design-system |
| 5 | Layout & responsive | Grid * / Auto, AdaptiveLayout, NavigationView.PaneDisplayMode | layout-patterns |
| 6 | Typography & color | Theme-variant dictionaries, DynamicResource, type ramp | design-system |
| 7 | Animation | Transitions, Animation, KeyFrame, IterationCount | motion |
| 8 | Forms & feedback | Validation (DataAnnotations / INotifyDataErrorInfo), Flyout, error pseudoclasses | components |
| 9 | Navigation | TabControl, SplitView, FluentAvalonia NavigationView | layout-patterns, components |
| 10 | Charts & data | LiveCharts2, ScottPlot, OxyPlot | components |
Recommended Stack for "Beautiful by Default"
A pragmatic starter pack that yields a polished app with minimal effort:
<!-- App.axaml --> <Application.Styles> <FluentTheme/> <StyleInclude Source="avares://MyApp/Resources/Tokens.axaml"/> <StyleInclude Source="avares://MyApp/Resources/ComponentStyles.axaml"/> </Application.Styles> NuGet:
-
Avalonia12.1.x (or the project's version) -
Avalonia.Themes.Fluent(orSukiUI/Semi.Avalonia) -
FluentAvaloniaUI(3.x for Avalonia 12, 2.5.x for 11.3) — NavigationView, InfoBar, TeachingTip -
Lucide.AvaloniaorMaterial.Icons.Avalonia— icons -
Svg.Skia— vector assets -
Avalonia.Xaml.Behaviors— declarative event triggers
The themes sub-skill explains alternatives by product type.
Anti-Patterns (See Each Sub-skill for Detail)
- Hard-coded hex colors scattered across views — use
DynamicResource+ theme dictionaries - Emoji as icons — use a vector icon library
- Removing focus rings to look cleaner — breaks keyboard a11y
- Same
Margin="10"everywhere — use a 4/8 spacing scale - Animating
Width/Heightinstead ofRenderTransformScale — janky -
StaticResourcefor theme-variant brushes — won't update on variant change - Forgetting
AutomationProperties.Nameon icon-only buttons - Mixing FluentTheme + Material.Avalonia in the same app — visual inconsistency
- Custom controls without
:pointerover/:pressed/:disabled/:focusstyles - One giant
Windowwith noUserControldecomposition
avalonia-pro-max/accessibility/SKILL.md
name: avalonia-pro-max/accessibility
description: Use when adding or auditing accessibility in an Avalonia app — AutomationProperties, focus order, keyboard navigation, contrast, screen reader (Narrator/NVDA/VoiceOver/Orca) support, dynamic text scaling, reduced motion. Maps WCAG 2.2 AA to Avalonia APIs.
Accessibility in Avalonia
Avalonia exposes accessibility through:
| API | Purpose |
|---|---|
AutomationProperties.* attached props | Names, descriptions, roles, item status |
Focusable / IsTabStop / TabIndex | Keyboard traversal |
Focus pseudoclasses (:focus, :focus-visible, :focus-within) | Visible focus indication |
KeyBindings, HotKey, KeyGesture | Shortcuts |
RequestedThemeVariant, platform settings (TopLevel.PlatformSettings (11.x), visual.GetPlatformSettings() (12.0+)) | High-contrast / dark mode / reduced motion |
AccessKey (_File) | Mnemonic underline shortcuts |
ToolTip.Tip | Hover and screen-reader hints |
Targets: WCAG 2.2 AA, plus Windows UI Automation, macOS NSAccessibility, Linux AT-SPI.
Version notes:
- (12.0+) Linux AT-SPI2 accessibility backend (Orca). In 11.x there is no AT-SPI2 backend, so Linux screen-reader support is not available.
- (12.0+) Validation errors are exposed through automation, and
TextBox.PlaceholderTextis accessible to screen readers. - (12.0+)
TopLevel.PlatformSettingsis removed. Usevisual.GetPlatformSettings()(VisualExtensions). In 11.x useTopLevel.GetTopLevel(this)?.PlatformSettings.
AutomationProperties (Required)
<Button Command="{Binding DeleteCommand}" AutomationProperties.Name="Delete project" AutomationProperties.HelpText="Permanently removes the current project and all its files"> <PathIcon Data="{StaticResource TrashIconGeometry}"/> </Button> Common properties:
| Property | When | Example |
|---|---|---|
AutomationProperties.Name | Always for icon-only / image-only / unlabeled controls | "Search" |
AutomationProperties.HelpText | Long-form explanation | "Searches across all projects" |
AutomationProperties.AcceleratorKey | Display the keyboard shortcut | "Ctrl+K" |
AutomationProperties.AccessibilityView | Content / Control / Raw — control visibility to AT | Raw for purely decorative |
AutomationProperties.IsRequiredForForm | Required form fields | True |
AutomationProperties.LabeledBy | When a TextBlock labels another control | {Binding ElementName=EmailLabel} |
AutomationProperties.LiveSetting | Polite/Assertive live regions | Polite for toasts |
AutomationProperties.ItemStatus | Dynamic state (e.g., "Saving…") | "3 of 5 selected" |
AutomationProperties.AutomationId | Stable test id (for UI tests, also used by AT) | "login.submit" |
Hide decorative elements
<PathIcon Data="{StaticResource ChevronGeometry}" AutomationProperties.AccessibilityView="Raw"/> Label association
<TextBlock x:Name="EmailLabel" Text="Email"/> <TextBox AutomationProperties.LabeledBy="{Binding ElementName=EmailLabel}"/> Focus Indication (Never Remove)
FluentTheme ships a focus ring. If you replace a ControlTheme, re-add it:
<Style Selector="Button:focus-visible /template/ ContentPresenter"> <Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}"/> <Setter Property="BorderThickness" Value="2"/> </Style> :focus-visible activates only when focus arrived from keyboard — preferred over :focus so mouse clicks don't show the ring. Always provide some visible cue on :focus too in case :focus-visible is not detected.
Minimum: 2px ring, contrast ≥3:1 against the surface.
Keyboard Navigation
Tab order
- Tab order follows logical tree by default.
- Override via
TabIndex="N"(lower = earlier). -
IsTabStop="False"on labels and decorative containers. - Group containers: set
KeyboardNavigation.TabNavigation="Local"on a panel to scope Tab within it.
Modes
<StackPanel KeyboardNavigation.TabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained"> … </StackPanel> | Mode | Effect |
|---|---|
Continue (default) | Tab traverses normally |
Local | Tab cycles within the container |
Cycle | Cycles within and stops |
Once | Container as a whole gets one tab stop |
None | Skipped |
Focus Traversal API (12.0+)
Avalonia 12 adds a Focus Traversal API: public IFocusManager (FindNextElement, TryMoveFocus, FindFirstFocusableElement, replacing KeyboardNavigationHandler.GetNext), cancellable focus changes, and FocusChangedEventArgs on GotFocus/LostFocus (replaces GotFocusEventArgs). Use it for programmatic focus moves (e.g. after closing a dialog or on a validation failure) instead of walking the visual tree. In 11.x use KeyboardNavigationHandler and GotFocusEventArgs.
Arrow-key navigation
Set KeyboardNavigation.DirectionalNavigation for Lists/grids to allow arrow keys.
Mnemonics
<MenuItem Header="_File"/> <!-- Alt+F --> <Button Content="_Save" Command="{Binding SaveCommand}"/> Shortcuts
<Window> <Window.KeyBindings> <KeyBinding Gesture="Ctrl+S" Command="{Binding SaveCommand}"/> <KeyBinding Gesture="Ctrl+K" Command="{Binding OpenSearchCommand}"/> <KeyBinding Gesture="Cmd+S" Command="{Binding SaveCommand}"/> <!-- macOS --> </Window.KeyBindings> </Window> Also expose as HotKey on a Button:
<Button Content="Save" HotKey="Ctrl+S" Command="{Binding SaveCommand}"/> Color Contrast
| Element | Min ratio | Tool |
|---|---|---|
| Body text on background | 4.5 : 1 | WCAG AA |
| Large text (≥18px / ≥14px bold) | 3 : 1 | WCAG AA |
| UI components (icon, focus ring, border) | 3 : 1 | WCAG 2.2 |
| Disabled text | exempt (but make it clearly disabled) | — |
Validate every brush pair light and dark. Common pitfalls:
-
TextMutedBrushoverSurfaceBrushoften fails — use Slate 600+ on light, Slate 400+ on dark. - Accent text on white usually needs Blue 600+, not Blue 500.
- Disabled buttons at 50% opacity may fail 3:1 against accent.
Don't Convey by Color Alone
Bad: Status as a single colored dot.
Good: Color + icon + text:
<StackPanel Orientation="Horizontal" Spacing="6"> <Ellipse Width="8" Height="8" Fill="{DynamicResource SuccessBrush}" AutomationProperties.AccessibilityView="Raw"/> <PathIcon Data="{StaticResource CheckGeometry}" Width="14" Height="14" Foreground="{DynamicResource SuccessBrush}" AutomationProperties.AccessibilityView="Raw"/> <TextBlock Text="Active" Foreground="{DynamicResource TextPrimaryBrush}"/> </StackPanel> Forms — Accessible Validation
<StackPanel Spacing="4"> <TextBlock x:Name="LblEmail" Text="Email"/> <TextBox Text="{Binding Email}" AutomationProperties.LabeledBy="{Binding ElementName=LblEmail}" AutomationProperties.IsRequiredForForm="True"/> <TextBlock Text="{Binding EmailError}" IsVisible="{Binding HasEmailError}" Foreground="{DynamicResource DangerBrush}" AutomationProperties.LiveSetting="Polite"/> </StackPanel> (12.0+) Validation errors surface to assistive tech through automation automatically; keep the visible inline error and the LiveSetting line anyway so 11.x apps and custom error text behave the same. PlaceholderText (12.0+; Watermark in 11.x) is accessible, but never use it as the only label (see LabeledBy).
Move focus to first invalid field on submit:
if (!IsValid && firstInvalid is Control c) c.Focus(NavigationMethod.Tab); Screen Reader Live Regions (Toasts)
<TextBlock x:Name="StatusLine" Text="{Binding Status}" AutomationProperties.LiveSetting="Polite" AutomationProperties.Name="Status"/> Polite waits until idle; Assertive interrupts. Use Assertive only for errors and important blocks.
Dynamic Text Scaling
Avoid fixed FontSize literals in views — drive everything from your FontSize* resources. Bind a global scale factor when needed:
<TextBlock FontSize="{Binding FontSize, Source={x:Static app:UserPrefs.Instance}, Converter={StaticResource ScaleConverter}}"/> Avoid:
- Fixed
Heighton text containers — text gets clipped at 200% scale. -
MaxLines="1"withoutTextTrimming="CharacterEllipsis"and a tooltip.
Test at 100%, 150%, 200% OS DPI scaling.
High-Contrast Mode
Windows high-contrast: FluentTheme adapts most colors. For custom controls:
<Style Selector="Border.card"> <Setter Property="BorderBrush" Value="{DynamicResource SystemControlForegroundBaseHighBrush}"/> <Setter Property="BorderThickness" Value="1"/> </Style> Or supply a third theme dictionary keyed HighContrast (Avalonia respects custom variants when registered).
Touch Targets
Even on desktop, touch users exist (Surface, tablet, kiosk). Min visible size or padded hit-area: 36×36 px (desktop), 44×44 px (touch/mobile).
Expand hit area without enlarging visual:
<Button Padding="10" MinWidth="36" MinHeight="36"> <PathIcon Data="…" Width="16" Height="16"/> </Button> Keep ≥8 px between adjacent tap targets.
Reduced Motion
See avalonia-pro-max/motion — every animation must have a zero-duration fallback.
Testing
- Tab through every screen — can you reach and operate every control?
- Activate Windows Narrator / macOS VoiceOver / Orca — read each major screen. Orca (Linux) requires Avalonia 12.0+ (AT-SPI2).
- Run the app at OS DPI 200%.
- Toggle high contrast.
- Use the Avalonia DevTools
Visual Tree→ look for unnamed actionable controls. - For UI tests, set
AutomationProperties.AutomationIdon every control under test.
Common Mistakes
- Icon-only button without
AutomationProperties.Name— invisible to screen readers. - Removed focus ring "for cleanliness" — keyboard users are blocked.
-
TextBlockused as a clickable header — not focusable, no role; useButton.ghostinstead. - Color-only error indication — colorblind users miss it.
-
MaxLinestruncation without tooltip — text scaled to 200% gets clipped silently. -
KeyBindingonWindowonly — won't fire if focus is in a TextBox that swallows the key. UseRoutedCommandor also bind on the TextBox. - Different shortcuts on Win vs macOS not provided — provide both
Ctrl+andCmd+. -
AutomationProperties.AccessibilityView="Raw"on a meaningful control — hides it entirely. - Missing
AutomationProperties.LabeledBybetween visible label and input.
avalonia-pro-max/components/SKILL.md
name: avalonia-pro-max/components
description: Use when building production-quality Avalonia screens — copy-paste XAML recipes for cards, primary/secondary/icon buttons, dialogs, sidebar nav, command bar, settings page, forms with validation, empty states, toasts, badges, skeletons. All recipes use semantic tokens from the design-system sub-skill.
Component Recipes
All recipes assume the design tokens from avalonia-pro-max/design-system are loaded (SurfaceBrush, AccentBrush, TextPrimaryBrush, RadiusLg, Space*, etc.).
Buttons
Reusable Button Styles
<!-- Styles/Buttons.axaml --> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <!-- Base: applies to all Button --> <Style Selector="Button"> <Setter Property="MinHeight" Value="36"/> <Setter Property="Padding" Value="14,8"/> <Setter Property="CornerRadius" Value="{StaticResource RadiusMd}"/> <Setter Property="FontWeight" Value="Medium"/> <Setter Property="Cursor" Value="Hand"/> <Setter Property="Transitions"> <Transitions> <BrushTransition Property="Background" Duration="0:0:0.15"/> <BrushTransition Property="Foreground" Duration="0:0:0.15"/> <TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.10"/> </Transitions> </Setter> <Setter Property="RenderTransform" Value="none"/> </Style> <Style Selector="Button:pressed"> <Setter Property="RenderTransform" Value="scale(0.98)"/> </Style> <!-- Primary --> <Style Selector="Button.primary"> <Setter Property="Background" Value="{DynamicResource AccentBrush}"/> <Setter Property="Foreground" Value="{DynamicResource TextOnAccentBrush}"/> </Style> <Style Selector="Button.primary:pointerover /template/ ContentPresenter"> <Setter Property="Background" Value="{DynamicResource AccentBrush}"/> <Setter Property="Opacity" Value="0.9"/> </Style> <!-- Secondary (outline) --> <Style Selector="Button.secondary"> <Setter Property="Background" Value="Transparent"/> <Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/> <Setter Property="BorderThickness" Value="1"/> </Style> <Style Selector="Button.secondary:pointerover /template/ ContentPresenter"> <Setter Property="Background" Value="{DynamicResource SurfaceMutedBrush}"/> </Style> <!-- Ghost --> <Style Selector="Button.ghost"> <Setter Property="Background" Value="Transparent"/> <Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/> </Style> <Style Selector="Button.ghost:pointerover /template/ ContentPresenter"> <Setter Property="Background" Value="{DynamicResource SurfaceMutedBrush}"/> </Style> <!-- Danger --> <Style Selector="Button.danger"> <Setter Property="Background" Value="{DynamicResource DangerBrush}"/> <Setter Property="Foreground" Value="White"/> </Style> <!-- Icon-only (square) --> <Style Selector="Button.icon"> <Setter Property="Padding" Value="8"/> <Setter Property="MinHeight" Value="36"/> <Setter Property="MinWidth" Value="36"/> </Style> <!-- Sizes --> <Style Selector="Button.sm"> <Setter Property="MinHeight" Value="28"/> <Setter Property="Padding" Value="10,4"/> <Setter Property="FontSize" Value="13"/> </Style> <Style Selector="Button.lg"> <Setter Property="MinHeight" Value="44"/> <Setter Property="Padding" Value="20,12"/> <Setter Property="FontSize" Value="15"/> </Style> <!-- Disabled override --> <Style Selector="Button:disabled"> <Setter Property="Opacity" Value="0.5"/> <Setter Property="Cursor" Value="Arrow"/> </Style> </Styles> Usage:
<Button Classes="primary" Content="Save"/> <Button Classes="secondary" Content="Cancel"/> <Button Classes="ghost icon" ToolTip.Tip="Settings" AutomationProperties.Name="Settings"> <PathIcon Data="{StaticResource SettingsIconGeometry}"/> </Button> <Button Classes="danger" Content="Delete account"/> <Button Classes="primary lg" Content="Get started"/> Card
<Border Classes="card"> <StackPanel Spacing="{StaticResource Space2}"> <TextBlock Classes="h3" Text="Total revenue"/> <TextBlock FontSize="{StaticResource FontSize2xl}" FontWeight="SemiBold" Text="$48,294"/> <TextBlock Classes="muted" Text="+12.4% vs last mont...