MiniToolbar.Avalonia
2.1.0.138
dotnet add package MiniToolbar.Avalonia --version 2.1.0.138
NuGet\Install-Package MiniToolbar.Avalonia -Version 2.1.0.138
<PackageReference Include="MiniToolbar.Avalonia" Version="2.1.0.138" />
<PackageVersion Include="MiniToolbar.Avalonia" Version="2.1.0.138" />
<PackageReference Include="MiniToolbar.Avalonia" />
paket add MiniToolbar.Avalonia --version 2.1.0.138
#r "nuget: MiniToolbar.Avalonia, 2.1.0.138"
#:package MiniToolbar.Avalonia@2.1.0.138
#addin nuget:?package=MiniToolbar.Avalonia&version=2.1.0.138
#tool nuget:?package=MiniToolbar.Avalonia&version=2.1.0.138
MiniToolbar.Avalonia
Toolbar controls for Avalonia 12.1.6+ / .NET 10 applications. Build horizontal or vertical toolbars with buttons, labels, separators, combo boxes, checkboxes, toggles, menus, text and numeric inputs, and sliders. Normal mode shows icons and labels; compact mode hides labels when an icon is present and preserves text-only actions.
Quick start
dotnet add package MiniToolbar.Avalonia
Register the styles after your application theme in App.axaml:
<Application xmlns="https://github.com/avaloniaui"
xmlns:toolbar="clr-namespace:MiniToolbar.Avalonia.Themes;assembly=MiniToolbar.Avalonia">
<Application.Styles>
<FluentTheme />
<toolbar:MiniToolbarStyles />
</Application.Styles>
</Application>
Basic usage
<toolbar:Toolbar xmlns="https://github.com/avaloniaui"
xmlns:toolbar="clr-namespace:MiniToolbar.Avalonia;assembly=MiniToolbar.Avalonia">
<toolbar:ToolbarButton Text="Open" Icon="avares://MyApp/Assets/Open.png"
ToolTip.Tip="Open a document" Command="{Binding OpenCommand}" />
<toolbar:ToolbarSeparator />
<toolbar:ToolbarLabel Content="View" />
<toolbar:ToolbarComboBox SelectedIndex="0">
<ComboBoxItem Content="Design" />
<ComboBoxItem Content="Preview" />
</toolbar:ToolbarComboBox>
<toolbar:ToolbarCheckBox Content="Snap" IsChecked="True" />
</toolbar:Toolbar>
Replace MyApp with your assembly name and bind OpenCommand to your view model. With compiled bindings enabled, declare the containing view's x:DataType. The standard Click event is also supported.
Include image files in your application project:
<ItemGroup>
<AvaloniaResource Include="Assets\Open.png" />
</ItemGroup>
Icons and layout
Toolbar.Orientation:Horizontal(default) orVertical.Toolbar.DisplayMode:Normal(default) orCompact.ToolbarButton.Icon: an absoluteavares://image path,Bitmap/IImage, or a control such asPathIcon. Bound string paths are supported.ToolbarButton.Text: the label and default accessible name. When empty, inheritedContent/ContentTemplatesupplies the button content.- Image sources use
ToolbarButtonImageSize(24 by default); size control icons yourself. - Commands, command parameters, click events, keyboard activation, disabled states, padding, and corner radius use standard button APIs. Add tooltips for compact actions.
Material Icons is optional and only used by the demo.
Additional controls
ToolbarToggleButton: nativeIsCheckedand command support for on/off actions.ToolbarDropDownButton: opens aFlyoutorMenuFlyout.ToolbarSplitButton: a primary command and a separate arrow that opens its flyout.ToolbarTextBox: editable search/filter text withPlaceholderText.ToolbarNumericUpDown: numeric values with minimum, maximum, and increment.ToolbarSlider: continuous values such as opacity or zoom.ToolbarItemHost: wraps arbitrary controls, including progress indicators or status badges.
These inherit the native Avalonia APIs and implement IToolbarItem. Toggle/dropdown/split buttons use Content for text or icons; their content stays visible in compact mode. Use ToolbarButton for the Icon/Text presentation that hides labels in compact mode.
<toolbar:Toolbar DisplayMode="Compact">
<toolbar:ToolbarToggleButton Content="B" FontWeight="Bold" IsChecked="True"
AutomationProperties.Name="Bold" />
<toolbar:ToolbarTextBox PlaceholderText="Search…" AutomationProperties.Name="Search" />
<toolbar:ToolbarNumericUpDown Minimum="1" Maximum="100" Value="12"
AutomationProperties.Name="Font size" />
<toolbar:ToolbarSlider Minimum="0" Maximum="100" Value="60"
AutomationProperties.Name="Opacity" />
</toolbar:Toolbar>
Text and numeric inputs use ToolbarInputNormalHeight / ToolbarInputCompactHeight (32 / 28). Width resources are ToolbarTextBoxMinWidth (140), ToolbarNumericUpDownMinWidth (90), and ToolbarSliderMinWidth (100). Vertical sliders use ToolbarSliderMinHeight (100). Set widths to fit the available space; the toolbar does not wrap or provide overflow.
Dynamic toolbars
using System.Collections.ObjectModel;
using MiniToolbar.Avalonia;
var items = new ObservableCollection<IToolbarItem>
{
new ToolbarButton { Text = "Open" },
new ToolbarSeparator(),
new ToolbarCheckBox { Content = "Snap" }
};
var toolbar = new Toolbar { ItemsSource = items };
items.Add(new ToolbarButton { Text = "Publish" });
Alternatively, add controls to Toolbar.Items directly. ItemsSource mirrors into Items; observable add/remove/replace/move/reset changes preserve unchanged controls. Mutate the source on the UI thread. Items are distinct control instances implementing IToolbarItem, not data models, and each control can belong to only one toolbar at a time.
Themes and sizing
Built-in styles support light and dark themes. Override resources in application or container scope: ToolbarBackgroundColor, ToolbarTextColor, ToolbarBackgroundHover, and ToolbarBackgroundPressed control colors. ToolbarNormalHeight / ToolbarCompactHeight default to 60 / 40; button heights default to 48 / 32. Increase these when using larger icons or content. Resource changes apply at runtime.
Custom themes
Register your Avalonia theme before MiniToolbarStyles. Native toolbar controls retain that theme's templates and behavior; the application must supply themes for the native controls it uses. MiniToolbar's dimensions and spacing are dynamic resources in Themes/MiniToolbarStyles.axaml; its light/dark brushes are in the merged Themes/Colors.axaml dictionary. Native template internals remain the responsibility of the host theme.
Override resources on a toolbar or enclosing container, for example:
<toolbar:Toolbar xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolbar="clr-namespace:MiniToolbar.Avalonia;assembly=MiniToolbar.Avalonia">
<toolbar:Toolbar.Resources>
<x:Double x:Key="ToolbarComboBoxMinWidth">160</x:Double>
<x:Double x:Key="ToolbarButtonNormalHeight">52</x:Double>
<Thickness x:Key="ToolbarActionPadding">12,4</Thickness>
<CornerRadius x:Key="ToolbarControlCornerRadius">6</CornerRadius>
</toolbar:Toolbar.Resources>
<toolbar:ToolbarToggleButton Content="Snap" />
</toolbar:Toolbar>
Spacing resources include ToolbarButtonPadding, ToolbarButtonTextPadding, ToolbarButtonSpacing, ToolbarActionPadding, ToolbarInputPadding, ToolbarComboBoxPadding, and ToolbarCheckBoxPadding. Margins use ToolbarButtonMargin, ToolbarItemMargin (combo boxes, check boxes, horizontal separators), ToolbarActionMargin, ToolbarInputMargin (inputs and content hosts), ToolbarHorizontalSpacing (horizontal panel and slider), ToolbarVerticalPanelMargin, ToolbarVerticalSeparatorMargin, and ToolbarVerticalSliderMargin. Labels share ToolbarButtonPadding.
Use ToolbarButtonCornerRadius / ToolbarControlCornerRadius for rounding and ToolbarHorizontalBorderThickness, ToolbarVerticalBorderThickness, ToolbarButtonBorderThickness, ToolbarButtonFocusBorderThickness, and ToolbarComboBoxItemBorderThickness for borders. ToolbarControlMinHeight defaults to zero so native action buttons and inputs can fit compact rows; ToolbarButtonDisabledOpacity controls disabled button opacity. All width and height defaults, including ToolbarComboBoxMinWidth, can be overridden without replacing a template. Explicit values on individual controls take precedence.
See the user guide and demo for all controls, examples, resource keys, and custom-template guidance.
Licensed under MIT.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Avalonia (>= 12.1.6)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.