# Balette (Component) `Bit.Balette.Balette` - inherits `ComponentBase` - implements `IAsyncDisposable`, `IComponent`, `IHandleAfterRender`, `IHandleEvent` The command palette dialog. Place it once in your layout. Commands come from IBaletteService, from declarative BaletteItem children, and from async sources. ## Parameter - **AdditionalAttributes** : `IReadOnlyDictionary` - Any other attribute, rendered on the element. - **ChildContent** : `RenderFragment` - Declarative BaletteGroup / BaletteItem children. - **Class** : `string` - Extra CSS class on the dialog element. - **Commands** : `IEnumerable` - Commands supplied directly to this instance (in addition to the service registry). - **Density** : `string` - Override of BaletteOptions.Density: comfortable or compact. - **DetailTemplate** : `RenderFragment` - Renders a detail/preview pane for the active command (Raycast style). - **DisablePointerSelection** : `bool` = `false` - Ignore mouse hover for selecting the active item (keyboard only). - **EmptyTemplate** : `RenderFragment` - Replaces the "no results" state; receives the query that found nothing. - **EnableHistory** : `bool?` - Override of BaletteOptions.EnableHistory: recents, pins and frecency. - **FooterTemplate** : `RenderFragment` - Replaces the footer with its keyboard hints and toasts, with a snapshot of the palette's state. - **GroupHeaderTemplate** : `RenderFragment` - Replaces the content of a group heading; receives the heading text. - **GroupWhenSearching** : `bool?` - Override of BaletteOptions.GroupWhenSearching: keep group headings while a query is typed. - **HeaderTemplate** : `RenderFragment` - Content rendered above the search box, with a snapshot of the palette's state. - **HighlightMatches** : `bool?` - Override of BaletteOptions.HighlightMatches: mark the matched characters. - **IconTemplate** : `RenderFragment` - Custom icon renderer. Receives the command; return nothing for no icon. - **IncludeRegisteredCommands** : `bool` = `true` - Whether the commands, sources and modes registered through IBaletteService are part of this palette (default true). Set false for a palette that lists only its own - the ones declared in its markup and passed to Balette.Commands - such as an inline search of one page's settings. - **Inline** : `bool` = `false` - Renders the palette in the page instead of in a modal dialog - a settings search, a docs search page, a command list in a side panel. It is always open, Esc goes back a page or clears the query rather than closing, and a command that would close the palette resets it to its root page. It leaves the dialog's part to the modal palette a layout usually has as well: it neither opens on the toggle shortcut nor answers IBaletteService.OpenAsync, IBaletteService.CloseAsync or IBaletteService.ExecuteAsync, and claims no global shortcuts - so nothing runs twice. Set before the first render; changing it later is not supported. - **ItemTemplate** : `RenderFragment` - Replaces the content of every row. The row element itself - its role, ARIA state, data attributes and click handling - stays the palette's. - **LoadingTemplate** : `RenderFragment` - Replaces the loading state shown while a lazily loaded page or an async source has nothing to show yet. - **Loop** : `bool?` - Override BaletteOptions.Loop. - **OnClosed** : `EventCallback` = `new EventCallback()` - Raised after the palette closed. - **OnCommandExecuted** : `EventCallback` = `new EventCallback()` - Raised after a command of this palette ran, with its result and how long the handler took. - **OnOpened** : `EventCallback` = `new EventCallback()` - Raised after the palette opened. - **OnQueryChanged** : `EventCallback` = `new EventCallback()` - Raised after every change of the query, with the raw text (a mode prefix included). - **Open** : `bool` = `false` - Controlled open state (two-way bindable). - **OpenChanged** : `EventCallback` = `new EventCallback()` - Raised when the palette opens or closes, for @bind-Open. - **Placeholder** : `string` - Placeholder override for the root page. - **SearchNestedCommands** : `bool?` - Override of BaletteOptions.SearchNestedCommands: find nested commands from the root page. - **ShowFooter** : `bool?` - Override of BaletteOptions.ShowFooter. - **ShowShortcuts** : `bool?` - Override of BaletteOptions.ShowShortcuts: show each command's shortcut on its row. - **Strings** : `BaletteStrings` - Strings override (defaults to BaletteOptions.Strings). - **Style** : `string` - Inline style on the dialog element (e.g. --bit-balette-width: 720px). - **Theme** : `string` - Theme override: auto, light or dark. - **ToggleShortcut** : `string` - Toggle shortcut override (e.g. Ctrl+Shift+P). - **TypoTolerance** : `bool?` - Override of BaletteOptions.TypoTolerance: retry a query that found nothing allowing a typo per term. - **Unstyled** : `bool` = `false` - Render no built-in styles/classes beyond structural data attributes. - **VimBindings** : `bool?` - Override of BaletteOptions.VimBindings: Ctrl+J/Ctrl+K move the selection. - **Virtualize** : `bool?` - Override of BaletteOptions.Virtualize: render the list through . ## Property - **ActiveCommand** : `BaletteCommand` - Currently highlighted command, if any. - **IsOpen** : `bool` = `false` - Whether the dialog is open. - **Query** : `string` = `""` - Current raw query (including a mode prefix). ## Method - **CloseAsync**() : `Task` - Closes the palette. - **DisposeAsync**() : `ValueTask` - **OpenAsync**(string query = null, string pageCommandId = null) : `Task` - Opens the palette, optionally with a query (a mode prefix is honoured) or directly on a command's page. - **SetQueryAsync**(string query) : `Task` - Sets the query programmatically, as if typed, and renders the results. Safe to call from any thread. - **ToggleAsync**() : `Task` - Opens the palette when it is closed and closes it when it is open.