ToolAgentSelector
Description
ToolAgentSelector is a trigger button that opens a searchable popup of checkbox rows for enabling agents and tools, listed under "Agents" and "Tools" headers with an icon, a title and an optional description per row. The trigger shows a badge with the number of selected items, and Compact() hides the descriptions. The popup can also be shown at an explicit viewport position with ShowInlineAt, which is how OmniBox.EnableChatMentions turns typing @ into the same picker.
Usage
Create the selector with ToolAgentSelector(label, icon), fill the two sections with Agents(...) and Tools(...), and read SelectedItems or SelectedCount in OnChange.
In a chat composer, put the selector in the OmniBox footer and wire EnableChatMentions to it so @ opens the popup at the caret. Typing filters the list, Arrow Up/Down moves the highlight, and Enter toggles the highlighted item.
API reference
public sealed class ToolAgentSelector : Layer<ToolAgentSelector>A trigger button with a searchable popup for enabling agents and tools, shown grouped under "Agents" and "Tools" sections. Selecting items updates a count badge on the trigger. Designed to be dropped into one of FooterItems's slots, and can also be driven inline (see ShowInlineAt) to back an "@mention" style picker inside a chat input.
- Namespace
- Tesserae
- Inheritance
- Layer<ToolAgentSelector> → ToolAgentSelector
Constructors
| Name | Description |
|---|---|
| ToolAgentSelector | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| SelectedItems | Gets every currently selected item, agents first, then tools. |
| SelectedCount | Gets the number of currently selected items. |
public Item[] SelectedItemsGets every currently selected item, agents first, then tools.
Methods
| Name | Description |
|---|---|
| Render | Renders the component's root HTML element. |
| Agents | Sets the items shown under the "Agents" section (replaces any previously set). |
| Tools | Sets the items shown under the "Tools" section (replaces any previously set). |
| Compact | Hides item descriptions, rendering a denser list of icon + title rows only. |
| OnChange | Registers a callback invoked whenever the selection changes. |
| Show | Shows the popup anchored below the trigger button. |
| ShowInlineAt | Shows the popup anchored at an explicit viewport position (for example, next to a text caret), without moving focus or toggling the trigger button's pressed state. Used to back an "@mention" style picker. |
| Hide | Hides the popup. |
| Filter | Filters the visible items by the given free-text query (matches title or description). Used both by the built-in search box and externally, to drive the popup from an inline "@" mention as the user types. |
| MoveHighlight | Moves the keyboard-navigation highlight forward (positive) or backward (negative) among the currently visible items, wrapping around at either end. |
| ActivateHighlighted | Toggles the selection of the currently highlighted item (defaulting to the first visible item if none is highlighted yet). Returns true if an item was toggled. |
public override HTMLElement Render()Renders the component's root HTML element.
public ToolAgentSelector Agents(params Item[] items)Sets the items shown under the "Agents" section (replaces any previously set).
public ToolAgentSelector Tools(params Item[] items)Sets the items shown under the "Tools" section (replaces any previously set).
public ToolAgentSelector Compact(bool value = true)Hides item descriptions, rendering a denser list of icon + title rows only.
public ToolAgentSelector OnChange(Action<ToolAgentSelector> handler)Registers a callback invoked whenever the selection changes.
public override ToolAgentSelector Show()Shows the popup anchored below the trigger button.
public ToolAgentSelector ShowInlineAt(double clientX, double clientY)Shows the popup anchored at an explicit viewport position (for example, next to a text caret), without moving focus or toggling the trigger button's pressed state. Used to back an "@mention" style picker.
public ToolAgentSelector Filter(string text)Filters the visible items by the given free-text query (matches title or description). Used both by the built-in search box and externally, to drive the popup from an inline "@" mention as the user types.
public void MoveHighlight(int direction)Moves the keyboard-navigation highlight forward (positive) or backward (negative) among the currently visible items, wrapping around at either end.
Events
| Name | Description |
|---|---|
| SelectionChanged | Raised whenever an item's selected state changes. |