OmniBox
Description
An omnibox search component
Omnibox provides a powerful input field for switching between a chat and a search interaction. For search, it also provides support for parsing and visual rendering of logical operators like AND, OR, NOT, parenthesis, and quotes.
API reference
public class OmniBox : IComponent, IHasBackgroundColor, ITabIndexA heavyweight omni-search / autocomplete component with inline filter chips, multiple search modes (search/chat) and async value providers.
- Namespace
- Tesserae
- Implements
- IComponent, IHasBackgroundColor, ITabIndex
Constructors
| Name | Description |
|---|---|
| OmniBox | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| InlineFilterChips | Gets or sets the inline filter chips. |
| SelectedModel | Gets or sets the selected model. |
| SelectedThinkingEffort | Gets or sets the selected thinking effort. |
| IsModelLocked | Returns a value indicating whether the component is model locked. |
| IsGenerating | Returns a value indicating whether the component is generating. |
| TabIndex | Sets the keyboard tab order of the component. |
| IsEnabled | Gets or sets a value indicating whether the component is interactive (enabled). |
| SearchText | Gets or sets the search text. |
| ChatText | Gets or sets the chat text. |
| SearchPlaceholder | Gets or sets the search placeholder. |
| ChatPlaceholder | Gets or sets the chat placeholder. |
| Background | Gets or sets the CSS background of the component. |
public ObservableList<InlineFilterChip> InlineFilterChips { get; }Gets or sets the inline filter chips.
public ThinkingEffort SelectedThinkingEffortGets or sets the selected thinking effort.
public bool IsModelLockedReturns a value indicating whether the component is model locked.
public bool IsGenerating { get ; set ; }Returns a value indicating whether the component is generating.
public bool IsEnabled { get ; set ; }Gets or sets a value indicating whether the component is interactive (enabled).
public string SearchPlaceholder { get ; set ; }Gets or sets the search placeholder.
public string ChatPlaceholder { get ; set ; }Gets or sets the chat placeholder.
Methods
| Name | Description |
|---|---|
| ParseQuery | Parses the query. |
| RegisterSnap | Registers a snap-handler that can convert recognized input into an inline filter chip. |
| RegisterSnaps | Registers multiple snap-handlers in one call. |
| RegisterFilterSnap | Registers a filter snap handler that creates an inline filter chip. |
| RegisterFilterSnaps | Registers multiple filter snap handlers in one call. |
| OnSearch | Registers a callback invoked when the search event fires. |
| OnChat | Registers a callback invoked when the chat event fires. |
| OnStop | Registers a callback invoked when the stop event fires. |
| OnModelChanged | Registers a callback invoked when the model changed event fires. |
| SetModels | Sets the models of the component. |
| LockModel | Locks the OmniBox to the given model option so users cannot pick another. |
| SetThinkingEffort | Sets the thinking effort of the component. |
| OnInput | Registers a callback invoked when the input event fires. |
| OnKeyDown | Registers a callback invoked when the key down event fires. |
| OnKeyUp | Registers a callback invoked when the key up event fires. |
| OnKeyPress | Registers a callback invoked when the key press event fires. |
| OnFocus | Registers a callback invoked when the focus event fires. |
| OnBlur | Registers a callback invoked when the blur event fires. |
| WithHistory | Returns the component configured with the given history. |
| Render | Renders the component's root HTML element. |
| SetKeyboardShortcut | Registers a global keyboard shortcut that focuses the OmniBox search input when pressed, and renders a visual chip showing the shortcut on the right side of the search box. In SearchAndChat mode, pressing the shortcut also switches the active mode to Search. Modifier names are case-insensitive ("Ctrl", "Cmd", "Meta", "Alt", "Shift"). Example: SetKeyboardShortcut("Ctrl", "K"). |
| SetSearchRightText | Sets the search right text of the component. |
| SetSearchText | Sets the search text of the component. |
| SetSearchPlaceholder | Sets the search placeholder of the component. |
| SetChatText | Sets the chat text of the component. |
| SetChatPlaceholder | Sets the chat placeholder of the component. |
| Disabled | Disables the component. |
| Focus | Moves keyboard focus to the component. |
| Height | Gets or sets the CSS height of the component. |
| H | Shortcut for setting the height in pixels. |
public static SearchQuery ParseQuery(string input, bool tokenIgnoreCase = false)Parses the query.
public OmniBox RegisterSnap(SnapHandler snap)Registers a snap-handler that can convert recognized input into an inline filter chip.
public OmniBox RegisterSnaps(params SnapHandler[] snaps)Registers multiple snap-handlers in one call.
public OmniBox RegisterFilterSnap(FilterSnapHandler filter)Registers a filter snap handler that creates an inline filter chip.
public OmniBox RegisterFilterSnaps(params FilterSnapHandler[] filters)Registers multiple filter snap handlers in one call.
public OmniBox OnSearch(SearchEventHandler onSearch)Registers a callback invoked when the search event fires.
public OmniBox OnChat(ChatEventHandler onChat)Registers a callback invoked when the chat event fires.
public OmniBox OnStop(StopEventHandler onStop)Registers a callback invoked when the stop event fires.
public OmniBox OnModelChanged(ModelChangedEventHandler onModelChanged)Registers a callback invoked when the model changed event fires.
| Overload | |
|---|---|
| SetModels(ModelOption[]) | Sets the models of the component. |
| SetModels(IEnumerable<ModelOption>) | Sets the models of the component. |
public OmniBox LockModel(ModelOption model)Locks the OmniBox to the given model option so users cannot pick another.
public OmniBox SetThinkingEffort(ThinkingEffort effort)Sets the thinking effort of the component.
public OmniBox OnInput(ComponentEventHandler<OmniBox, Event> onInput)Registers a callback invoked when the input event fires.
public OmniBox OnKeyDown(ComponentEventHandler<OmniBox, KeyboardEvent> onKeyDown)Registers a callback invoked when the key down event fires.
public OmniBox OnKeyUp(ComponentEventHandler<OmniBox, KeyboardEvent> onKeyUp)Registers a callback invoked when the key up event fires.
public OmniBox OnKeyPress(ComponentEventHandler<OmniBox, KeyboardEvent> onKeyPress)Registers a callback invoked when the key press event fires.
public OmniBox OnFocus(ComponentEventHandler<OmniBox, Event> onFocus)Registers a callback invoked when the focus event fires.
public OmniBox OnBlur(ComponentEventHandler<OmniBox, Event> onBlur)Registers a callback invoked when the blur event fires.
public OmniBox WithHistory(Func<Task<SearchQuery[]>> historyFetcher)Returns the component configured with the given history.
public OmniBox SetKeyboardShortcut(params string[] keys)Registers a global keyboard shortcut that focuses the OmniBox search input when pressed, and renders a visual chip showing the shortcut on the right side of the search box. In SearchAndChat mode, pressing the shortcut also switches the active mode to Search. Modifier names are case-insensitive ("Ctrl", "Cmd", "Meta", "Alt", "Shift"). Example: SetKeyboardShortcut("Ctrl", "K").
public OmniBox SetSearchRightText(string text)Sets the search right text of the component.
public OmniBox SetSearchText(string text)Sets the search text of the component.
public OmniBox SetSearchPlaceholder(string text)Sets the search placeholder of the component.
public OmniBox SetChatText(string text)Sets the chat text of the component.
public OmniBox SetChatPlaceholder(string text)Sets the chat placeholder of the component.
public OmniBox Height(UnitSize unitSize)Gets or sets the CSS height of the component.
Events
| Name | Description |
|---|---|
| Stopped | Raised when stopped occurs. |
| Input | Raised when input occurs. |
| KeyDown | Raised when key down occurs. |
| KeyUp | Raised when key up occurs. |
| KeyPress | Raised when key press occurs. |
| ReceivedFocus | Raised when received focus occurs. |
| LostFocus | Raised when lost focus occurs. |
public event ComponentEventHandler<OmniBox, KeyboardEvent> KeyDownRaised when key down occurs.
public event ComponentEventHandler<OmniBox, KeyboardEvent> KeyUpRaised when key up occurs.
public event ComponentEventHandler<OmniBox, KeyboardEvent> KeyPressRaised when key press occurs.
public event ComponentEventHandler<OmniBox, Event> ReceivedFocusRaised when received focus occurs.