Omni Result

Description

A search-result row: icon tile, title, excerpt, footer and the full view behind it

OmniResult<T> is one object that describes a result wherever it is drawn: in a list of search hits, in a picker, in a table, and as the modal that opens when it is clicked. It carries the item it stands for as Result, so a click, selection or command handler shared by a whole list can act on the right one without a closure per row.

A row is made of slots rather than one custom component, which is what keeps rows lined up with each other:

Slot Set with What it is
Icon tile SetIcon A glyph on an accent background, an image, or any component.
Icon badge SetIconBadge A marker pinned to a corner of the tile (OmniResultBadgeCorner).
Identifier SetId A short key before the title, with a chevron between them.
Title SetTitle The row's heading, highlighted against the search query.
Badge SetBadge A quiet pill beside the title.
Excerpt SetText Plain text, clamped to TextLines, highlighted.
Content SetContent A rich component under the excerpt, capped with ContentMaxHeight.
Footer SetFooterEntries / AddFooterEntry A line of InlineLabels, separated by dots.
Source SetSource Where the result came from, with OnSourceClick to open it there.
Page rail SetPages A PagesStack pinned to the right.
Contribution bar SetContributionBar A ContributionBar showing how the score breaks down.

Selection, commands and highlighting are the row's own. Selectable(OmniResultSelectionMode) adds a checkbox that can sit beside or over the icon; OnContextMenu(…, OmniResultCommandsMode) wires right-click and an optional [...] button; InlineCommands(…) puts a few buttons before it. Highlight / HighlightWords mark the query in the title and the excerpt structurally, without walking the rendered DOM.

SetModalContent hangs the full view on the row, and ToModal() turns it into the sheet that shows it, with ModalSize, ModalTitle, SetModalHeader, ModalNavigation, ModalShortcutsBar and ModalFullScreen shaping it. GetModalContentAsync() returns that content on its own when you want it without a modal around it.

Samples

A result row

Identifier, badge and inline commands

A selectable list of results

API reference

enum

OmniResultBadgeCorner

public enum OmniResultBadgeCorner

Which corner of an OmniResult{T} icon tile a badge is pinned to.

Namespace
Tesserae

Values

NameDescription
TopLeftThe top-left corner - where a "pinned" marker usually goes.
TopRightThe top-right corner.
BottomLeftThe bottom-left corner.
BottomRightThe bottom-right corner - where a "where it came from" marker usually goes.
Value
OmniResultBadgeCorner.TopLeft
TopLeft

The top-left corner - where a "pinned" marker usually goes.

Value
OmniResultBadgeCorner.TopRight
TopRight

The top-right corner.

Value
OmniResultBadgeCorner.BottomLeft
BottomLeft

The bottom-left corner.

Value
OmniResultBadgeCorner.BottomRight
BottomRight

The bottom-right corner - where a "where it came from" marker usually goes.

enum

OmniResultSelectionMode

public enum OmniResultSelectionMode

Where the selection checkbox of an OmniResult{T} lives, and when it shows. A selected result always shows its checkbox, whatever the mode.

Namespace
Tesserae

Values

NameDescription
OnHoverBeforeIconA checkbox in its own column before the icon, revealed while the result is hovered.
OnHoverOverIconA checkbox over the icon tile, revealed - and covering the icon - while the result is hovered.
AlwaysBeforeIconA checkbox in its own column before the icon, always visible.
ReplacingIconA checkbox in place of the icon tile, which is not drawn at all.
Value
OmniResultSelectionMode.OnHoverBeforeIcon
OnHoverBeforeIcon

A checkbox in its own column before the icon, revealed while the result is hovered.

Value
OmniResultSelectionMode.OnHoverOverIcon
OnHoverOverIcon

A checkbox over the icon tile, revealed - and covering the icon - while the result is hovered.

Value
OmniResultSelectionMode.AlwaysBeforeIcon
AlwaysBeforeIcon

A checkbox in its own column before the icon, always visible.

Value
OmniResultSelectionMode.ReplacingIcon
ReplacingIcon

A checkbox in place of the icon tile, which is not drawn at all.

enum

OmniResultCommandsMode

public enum OmniResultCommandsMode

How the commands of an OmniResult{T} are reached.

Namespace
Tesserae

Values

NameDescription
RightClickOnlyRight-clicking the result, and nothing else - no button is drawn.
ButtonOnHoverRight-clicking the result, or a [...] button revealed while it is hovered.
ButtonAlwaysVisibleRight-clicking the result, or a [...] button that is always visible.
Value
OmniResultCommandsMode.RightClickOnly
RightClickOnly

Right-clicking the result, and nothing else - no button is drawn.

Value
OmniResultCommandsMode.ButtonOnHover
ButtonOnHover

Right-clicking the result, or a [...] button revealed while it is hovered.

Value
OmniResultCommandsMode.ButtonAlwaysVisible
ButtonAlwaysVisible

Right-clicking the result, or a [...] button that is always visible.

enum

OmniResultCommandsVisibility

public enum OmniResultCommandsVisibility

When the inline commands of an OmniResult{T} show.

Namespace
Tesserae

Values

NameDescription
OnHoverRevealed while the result is hovered (or focused).
AlwaysVisibleAlways visible.
Value
OmniResultCommandsVisibility.OnHover
OnHover

Revealed while the result is hovered (or focused).

Value
OmniResultCommandsVisibility.AlwaysVisible
AlwaysVisible

Always visible.

class

OmniResult<T>

public sealed class OmniResult<T> : ComponentBase<OmniResult<T>, HTMLElement>

A search-result card: an icon tile, a title with an optional badge, an optional excerpt with the matched terms highlighted, an optional footer naming the source and whatever metadata the host wants beside it, and an optional PagesStack preview pinned to its right. The result it stands for is carried as Result, so a click, selection or command handler shared by a whole list of results can act on the right one without a closure per card. Rows are selectable (Selectable) with a checkbox that can sit beside or over the icon; commands are reached by right-click and, optionally, a [...] button (OnContextMenu), with room for a few inline commands before it (InlineCommands).

Namespace
Tesserae
Inheritance
ComponentBase<OmniResult<T>, HTMLElement> → OmniResult<T>

Constructors

NameDescription
OmniResultInitializes a new instance of this class standing for the given result.
Constructor
OmniResult
public OmniResult(T result, string title = null)

Initializes a new instance of this class standing for the given result.

Properties

NameDescription
ResultGets the result this card stands for - the search hit, document, record or row it was built from.
TitleGets or sets the title of the result.
IdGets or sets the identifier shown before the title - an issue number, a ticket key, a row number - followed by a chevron pointing at the title. A null or empty value drops both.
TextGets or sets the excerpt shown under the title, or null when the result has none. Plain text: the only markup it gets is the highlighting of Highlight.
IsSelectionEnabledReturns a value indicating whether the result can be selected.
IsSelectedGets or sets whether the result is selected. Setting it runs the OnSelectionChanged handlers, so a host list can keep its own selection in step whether the change came from the user or from code.
IsActiveGets or sets whether the result is the active one - the row a keyboard-driven list has moved to. It is styled like a hovered row, and reveals whatever the row reveals on hover.
PagesGets the PagesStack preview shown at the end of the row, or null when it has none.
ContributionGets the ContributionBar shown under the footer, or null when it has none.
CommandsEventGets the pointer event that last asked for this result's commands - the right-click, or the click on the [...] button - or null when they were asked for from the keyboard. A host that shows its own command surface (rather than a ContextMenu through ShowMenu) reads this to place it where the user asked.
HasModalContentGets a value indicating whether the result has content to open as a modal (see ToModal).
OpenActionsGets the ways this result can be opened where it actually lives, in the order they were added - the first one is the primary, and the rest hang off the arrow beside it.
CanOpenInSourceGets a value indicating whether the result can be opened at its source.
HasModalHeaderGets a value indicating whether a header of the host's own was set with SetModalHeader - so a caller applying a default one can tell whether anyone got there first.
CurrentModalGets the modal ToModal last built for this result, or null when it has not built one yet - what a host reaches for to close, resize or otherwise get at the surface it opened.
Property
OmniResult.Result
public T Result { get; }

Gets the result this card stands for - the search hit, document, record or row it was built from.

Property
OmniResult.Title
public string Title { get ; set ; }

Gets or sets the title of the result.

Property
OmniResult.Id
public string Id { get ; set ; }

Gets or sets the identifier shown before the title - an issue number, a ticket key, a row number - followed by a chevron pointing at the title. A null or empty value drops both.

Property
OmniResult.Text
public string Text { get ; set ; }

Gets or sets the excerpt shown under the title, or null when the result has none. Plain text: the only markup it gets is the highlighting of Highlight.

Property
OmniResult.IsSelectionEnabled
public bool IsSelectionEnabled

Returns a value indicating whether the result can be selected.

Property
OmniResult.IsSelected
public bool IsSelected { get ; set ; }

Gets or sets whether the result is selected. Setting it runs the OnSelectionChanged handlers, so a host list can keep its own selection in step whether the change came from the user or from code.

Property
OmniResult.IsActive
public bool IsActive { get ; set ; }

Gets or sets whether the result is the active one - the row a keyboard-driven list has moved to. It is styled like a hovered row, and reveals whatever the row reveals on hover.

Property
OmniResult.Pages
public PagesStack Pages

Gets the PagesStack preview shown at the end of the row, or null when it has none.

Property
OmniResult.Contribution
public ContributionBar Contribution

Gets the ContributionBar shown under the footer, or null when it has none.

Property
OmniResult.CommandsEvent
public MouseEvent CommandsEvent

Gets the pointer event that last asked for this result's commands - the right-click, or the click on the [...] button - or null when they were asked for from the keyboard. A host that shows its own command surface (rather than a ContextMenu through ShowMenu) reads this to place it where the user asked.

Property
OmniResult.HasModalContent
public bool HasModalContent

Gets a value indicating whether the result has content to open as a modal (see ToModal).

Property
OmniResult.OpenActions
public IReadOnlyList<OmniResultOpenAction<T>> OpenActions

Gets the ways this result can be opened where it actually lives, in the order they were added - the first one is the primary, and the rest hang off the arrow beside it.

Property
OmniResult.CanOpenInSource
public bool CanOpenInSource

Gets a value indicating whether the result can be opened at its source.

Property
OmniResult.HasModalHeader
public bool HasModalHeader

Gets a value indicating whether a header of the host's own was set with SetModalHeader - so a caller applying a default one can tell whether anyone got there first.

Property
OmniResult.CurrentModal
public Modal CurrentModal

Gets the modal ToModal last built for this result, or null when it has not built one yet - what a host reaches for to close, resize or otherwise get at the surface it opened.

Methods

NameDescription
RenderRenders the component's root HTML element.
SetTitleSets the title of the result. The title is ellipsized to one line, carries the full text as its native tooltip, and has the terms of Highlight marked in it.
SetIdSets the identifier shown before the title - an issue number, a ticket key, a row number - drawn in the quiet way an identifier reads and followed by a chevron pointing at the title. A null or empty value drops the identifier and the chevron with it.
SetIconPuts the given icon on the tile, in the given color, over a paler wash of that same color. Pass the full-strength color the glyph should be - the background is computed from it (and cached), a light tint of it under a light theme and a deep one under a dark theme.
SetBadgePuts a badge next to the title - what matched, how many times, how the result was found. A null or empty value hides it.
SetTextSets the excerpt shown under the title. It is plain text, not a component: whatever the search returned as the matching passage, ellipsized to the two lines the row gives it, with the terms of Highlight marked in it. A null or empty value drops the line entirely.
TextLinesCaps how many lines of the excerpt are shown before it is ellipsized. Two by default.
SetContentPuts a component under the excerpt, in the text column: the rich preview a result has of its own - a thumbnail, a quoted message, a table of the fields that matched - for everything a plain excerpt can't say. Pass null to take it away. Cap how tall it is allowed to be with ContentMaxHeight, which fades the overflow out rather than cutting it off.
ContentMaxHeightCaps how tall the SetContent preview is allowed to grow, fading whatever runs past it out instead of cutting it off. Pass null to un-cap it.
SetIconBadgePins a badge to a corner of the icon tile - where a result came from, that it is pinned - drawn over the tile's corner and outside its clipping. Pass null to clear that corner.
HighlightMarks every match of the given expression in the title and the excerpt - the same pattern a search backend hands back for highlighting. Matching is done against the text itself and the matches are wrapped in their own elements, so neither is ever treated as markup.
HighlightWordsMarks every occurrence of the given words in the excerpt, case-insensitively - the convenience form of Highlight for a host that has the query terms rather than a pattern.
SetSourceNames where the result came from: a small rounded square in the given color, followed by the text, at the start of the footer. A null or empty text hides it. Passing a handler makes the source itself clickable - scoping a search to that source is the usual thing to do with it - without the click counting as opening the result. It takes a tab stop of its own and answers Enter and Space, and the result is handed to the handler so one shared handler can read Result.
OnSourceClickRegisters what clicking the source in the footer does - scope the search to it, open it, filter by it - and marks the source as clickable. Clicking it does not also count as opening the result. Pass null to make the source plain text again.
SetFooterEntriesSets the metadata shown after the source in the footer - a path, a size, an owner, a date - as InlineLabels, each separated from the next by a dot. Each one can carry a mark (a glyph, an image, a square of colour), be pressable, or be a real link, and they are all drawn at one size so the line reads as one row of facts. Replaces whatever entries were there.
AddFooterEntryAdds one more entry to the end of the footer line, as a component of the host's own rather than an InlineLabel - a badge, a chip, a small control a label cannot be. It gets the same box and the same separating dot as every other entry.
SelectableMakes the result selectable, with its checkbox shown as the given mode says. The checkbox toggles the selection on click; ctrl-clicking the row does the same, and shift-clicking it asks for a range (see OnRangeSelectionRequested).
NotSelectableTakes the checkbox away again, unselecting the result if it was selected.
SelectedSelects (or unselects) the result. Does nothing on a result that isn't selectable.
OnSelectionChangedRegisters a callback invoked whenever the result is selected or unselected, by the user or by code, with the new state.
OnRangeSelectionRequestedRegisters a callback invoked when the user shift-clicks the result, i.e. asks for everything between the last result they selected and this one. A single card knows nothing about its siblings, so the host list owns what "between" means - and selects them itself.
OnContextMenuRegisters the handler that opens the commands of this result, and says how it is reached: by right-click alone, or also by a [...] button at the top-right of the row - shown always, or only while the row is hovered. The handler is given the result, so it can build a menu from Result and show it with ShowMenu.
CommandsModeChanges how the commands registered with OnContextMenu are reached, without touching the handler itself.
InlineCommandsPuts the given components in the row's command area, before the [...] button - the one or two actions worth reaching without opening a menu. They show only while the row is hovered by default; the space they take is reserved either way, so revealing them never shifts the row.
SetContributionBarPuts a ContributionBar under the footer, spanning the text column: what the result's score is made of - a title match, a content match, recency, popularity - as one stacked bar. Pass null to take it away. A bar with many segments is worth collapsing (Collapsable), so a list of results reads as one line each until the breakdown is asked for.
SetPagesPins the given PagesStack preview to the end of the row, in a rail wide enough for it to fan into. Pass null to take it away.
PagesFanOnHoverConfigures whether the PagesStack fans while the row is hovered, rather than only while the pointer is over the pages themselves. On by default.
OpenInSourceAdds a way to open the result where it actually lives - "Open in Dropbox", "Open in Outlook", "Reveal in folder" - as a named button in the modal's header. The handler is told whether the user asked for a new tab (they shift-clicked the button, or pressed Shift+Enter). Call it more than once to offer several: the first one stays the button, and the rest are reached through an arrow beside it.
NoOpenInSourceTakes every way of opening the result at its source away again.
OpenOpens the result at its source the way the primary action says to, as pressing the button (or Ctrl+Enter in the modal) would. Does nothing on a result that has no such action.
ModalCommandsRegisters what the [...] button in the modal's header opens - the same commands the row's own [...] opens, usually. Read CommandsEvent in the handler to place a command surface of the host's own where the user clicked. Pass null to leave the button out.
ModalFullScreenRegisters what the full-screen button in the modal's header does - open the result on a page of its own, usually. Without one the button is still there and simply grows the modal to fill the window (and back), which is what "full screen" means to a modal that has nowhere else to go.
NoModalFullScreenLeaves the full-screen button out of the modal's header.
ModalNavigationPuts the previous/next arrows in the modal's header, so a result opened out of a list can be stepped through without going back to it. A null handler greys its arrow out - that is how the first and the last result say so. Passing a position and a count (both 1-based, the count being how many results there are) draws "3 of 27" between the arrows.
ModalShortcutsConfigures whether the modal shows the keyboard shortcuts it answers along its bottom edge - what closes it, what steps through the results, what opens the result at its source. On by default.
SetModalContentSets what ToModal puts inside the modal for this result - the full view of the thing the row stands for. Pass null to make the result modal-less again.
GetModalContentAsyncBuilds the modal content on its own, for a host that shows it somewhere other than in a modal - a side panel, a page, a pane of its own. Returns null when the result has no modal content.
SetModalHeaderReplaces the modal's header - by default the same identifier, title and badge the row shows - with one built from the result. Pass null to go back to the default header.
ModalSizeSets the size the modal of ToModal opens at. Auto by default, which lets the modal size itself to its content (and to whatever bounds the caller sets on it afterwards).
ModalKeepsIconKeeps the icon tile in the modal's header, before the identifier and the title - so an opened result still shows what kind of thing it is, and the row and the modal read as one thing rather than two. Whatever the tile carries comes with it: the glyph or the thumbnail, the color it is tinted with, and any corner badges. Off by default.
ModalKeepsFooterKeeps the footer - the source and the metadata beside it - as a second line under the title in the modal's header, so where a result came from is still said once it is open. The source stays clickable when the row's is. Off by default.
ToModalBuilds a Modal showing this result: the row's identifier, title and badge as the header, and whatever SetModalContent was given as the body, at the size ModalSize asked for. Everything else - commands, dismissal, bounds, how it is shown - is left to the caller to chain on the returned modal. Returns null when the result has no modal content, so a caller can treat "this result has no preview" as one check.
ModalHeaderCommandsThe commands ToModal puts at the end of the modal's header: the way to open the result at its source, the arrows stepping through the results, the [...] commands, the full-screen button and the close button - whichever of them this result was configured for. Useful to a caller building a header of its own around them.
ModalShortcutsBarThe keyboard shortcuts ToModal lists along the bottom of the modal - only the ones this result actually answers, so a modal that can't be stepped through never says it can.
ModalTitleThe header ToModal uses by default: the identifier and the title, drawn the way the row draws them, plus whatever ModalKeepsIcon and ModalKeepsFooter asked to keep. Useful to a caller building its own header around it.
ShowMenuShows the given menu where the commands were asked for: at the pointer when the row was right-clicked, and under the [...] button when it was pressed. This is what a OnContextMenu handler uses to put its menu in the right place without tracking the event itself.
Method
OmniResult.Render
public override HTMLElement Render()

Renders the component's root HTML element.

Method
OmniResult.SetTitle
Overload
SetTitle(string)Sets the title of the result. The title is ellipsized to one line, carries the full text as its native tooltip, and has the terms of Highlight marked in it.
SetTitle(IComponent, string)Puts a component in the title slot in place of the plain title - the escape hatch for a result whose title genuinely isn't text, such as one built from fields an administrator configured. The text passed alongside it stays the row's Title, so the tooltip, the modal header and anything else reading the title still have something to say. Pass null to go back to plain text. A component title is drawn as it was given: Highlight does not reach inside it.
SetTitle(string)
public OmniResult<T> SetTitle(string title)

Sets the title of the result. The title is ellipsized to one line, carries the full text as its native tooltip, and has the terms of Highlight marked in it.

Parameters

title string
SetTitle(IComponent, string)
public OmniResult<T> SetTitle(IComponent title, string text = null)

Puts a component in the title slot in place of the plain title - the escape hatch for a result whose title genuinely isn't text, such as one built from fields an administrator configured. The text passed alongside it stays the row's Title, so the tooltip, the modal header and anything else reading the title still have something to say. Pass null to go back to plain text. A component title is drawn as it was given: Highlight does not reach inside it.

Parameters

title IComponent
text string
Method
OmniResult.SetId
public OmniResult<T> SetId(string id)

Sets the identifier shown before the title - an issue number, a ticket key, a row number - drawn in the quiet way an identifier reads and followed by a chevron pointing at the title. A null or empty value drops the identifier and the chevron with it.

Method
OmniResult.SetIcon
Overload
SetIcon(UIcons, string, UIconsWeight)Puts the given icon on the tile, in the given color, over a paler wash of that same color. Pass the full-strength color the glyph should be - the background is computed from it (and cached), a light tint of it under a light theme and a deep one under a dark theme.
SetIcon(string, string)Puts the given short text on the tile in place of an icon - a file type, "PPTX" or "CSV", where no glyph says it as plainly - in the given color, over a paler wash of that same color.
SetIcon(IComponent, string)Puts the given component on the tile - an Image thumbnail, an Avatar, an emoji - optionally tinting the tile with the given color.
SetIcon(UIcons, string, UIconsWeight)
public OmniResult<T> SetIcon(UIcons icon, string color = null, UIconsWeight weight = UIconsWeight.Regular)

Puts the given icon on the tile, in the given color, over a paler wash of that same color. Pass the full-strength color the glyph should be - the background is computed from it (and cached), a light tint of it under a light theme and a deep one under a dark theme.

Parameters

icon UIcons
color string
weight UIconsWeight
SetIcon(string, string)
public OmniResult<T> SetIcon(string text, string color = null)

Puts the given short text on the tile in place of an icon - a file type, "PPTX" or "CSV", where no glyph says it as plainly - in the given color, over a paler wash of that same color.

Parameters

text string
color string
SetIcon(IComponent, string)
public OmniResult<T> SetIcon(IComponent iconOrImage, string color = null)

Puts the given component on the tile - an Image thumbnail, an Avatar, an emoji - optionally tinting the tile with the given color.

Parameters

iconOrImage IComponent
color string
Method
OmniResult.SetBadge
Overload
SetBadge(string)Puts a badge next to the title - what matched, how many times, how the result was found. A null or empty value hides it.
SetBadge(IComponent)Puts the given component next to the title in place of the plain badge - a Badge with a tone of its own, a Spinner, a small button. A null value empties the slot.
SetBadge(string)
public OmniResult<T> SetBadge(string text)

Puts a badge next to the title - what matched, how many times, how the result was found. A null or empty value hides it.

Parameters

text string
SetBadge(IComponent)
public OmniResult<T> SetBadge(IComponent badge)

Puts the given component next to the title in place of the plain badge - a Badge with a tone of its own, a Spinner, a small button. A null value empties the slot.

Parameters

badge IComponent
Method
OmniResult.SetText
public OmniResult<T> SetText(string text)

Sets the excerpt shown under the title. It is plain text, not a component: whatever the search returned as the matching passage, ellipsized to the two lines the row gives it, with the terms of Highlight marked in it. A null or empty value drops the line entirely.

Method
OmniResult.TextLines
public OmniResult<T> TextLines(int lines)

Caps how many lines of the excerpt are shown before it is ellipsized. Two by default.

Method
OmniResult.SetContent
public OmniResult<T> SetContent(IComponent content)

Puts a component under the excerpt, in the text column: the rich preview a result has of its own - a thumbnail, a quoted message, a table of the fields that matched - for everything a plain excerpt can't say. Pass null to take it away. Cap how tall it is allowed to be with ContentMaxHeight, which fades the overflow out rather than cutting it off.

Method
OmniResult.ContentMaxHeight
public OmniResult<T> ContentMaxHeight(UnitSize maxHeight)

Caps how tall the SetContent preview is allowed to grow, fading whatever runs past it out instead of cutting it off. Pass null to un-cap it.

Method
OmniResult.SetIconBadge
public OmniResult<T> SetIconBadge(IComponent badge, OmniResultBadgeCorner corner = OmniResultBadgeCorner.BottomRight)

Pins a badge to a corner of the icon tile - where a result came from, that it is pinned - drawn over the tile's corner and outside its clipping. Pass null to clear that corner.

Method
OmniResult.Highlight
Overload
Highlight(Regex)Marks every match of the given expression in the title and the excerpt - the same pattern a search backend hands back for highlighting. Matching is done against the text itself and the matches are wrapped in their own elements, so neither is ever treated as markup.
Highlight(string, bool)Marks every match of the given regular expression in the excerpt, case-insensitively by default.
Highlight(Regex)
public OmniResult<T> Highlight(Regex highlighter)

Marks every match of the given expression in the title and the excerpt - the same pattern a search backend hands back for highlighting. Matching is done against the text itself and the matches are wrapped in their own elements, so neither is ever treated as markup.

Parameters

highlighter Regex
Highlight(string, bool)
public OmniResult<T> Highlight(string pattern, bool ignoreCase = true)

Marks every match of the given regular expression in the excerpt, case-insensitively by default.

Parameters

pattern string
ignoreCase bool
Method
OmniResult.HighlightWords
public OmniResult<T> HighlightWords(params string[] words)

Marks every occurrence of the given words in the excerpt, case-insensitively - the convenience form of Highlight for a host that has the query terms rather than a pattern.

Method
OmniResult.SetSource
Overload
SetSource(string, string, Action<OmniResult<T>>)Names where the result came from: a small rounded square in the given color, followed by the text, at the start of the footer. A null or empty text hides it. Passing a handler makes the source itself clickable - scoping a search to that source is the usual thing to do with it - without the click counting as opening the result. It takes a tab stop of its own and answers Enter and Space, and the result is handed to the handler so one shared handler can read Result.
SetSource(IComponent, string, Action<OmniResult<T>>)Names where the result came from with a marker of the host's own - the source's logo, an avatar - in place of the plain colored square, followed by the text. Everything else behaves as SetSource: a null or empty text hides it, and passing a handler makes the source clickable.
SetSource(string, string, Action<OmniResult<T>>)
public OmniResult<T> SetSource(string color, string text, Action<OmniResult<T>> onClick = null)

Names where the result came from: a small rounded square in the given color, followed by the text, at the start of the footer. A null or empty text hides it. Passing a handler makes the source itself clickable - scoping a search to that source is the usual thing to do with it - without the click counting as opening the result. It takes a tab stop of its own and answers Enter and Space, and the result is handed to the handler so one shared handler can read Result.

Parameters

color string
text string
onClick Action<OmniResult<T>>
SetSource(IComponent, string, Action<OmniResult<T>>)
public OmniResult<T> SetSource(IComponent marker, string text, Action<OmniResult<T>> onClick = null)

Names where the result came from with a marker of the host's own - the source's logo, an avatar - in place of the plain colored square, followed by the text. Everything else behaves as SetSource: a null or empty text hides it, and passing a handler makes the source clickable.

Parameters

marker IComponent
text string
onClick Action<OmniResult<T>>
Method
OmniResult.OnSourceClick
public OmniResult<T> OnSourceClick(Action<OmniResult<T>> onClick)

Registers what clicking the source in the footer does - scope the search to it, open it, filter by it - and marks the source as clickable. Clicking it does not also count as opening the result. Pass null to make the source plain text again.

Method
OmniResult.SetFooterEntries
Overload
SetFooterEntries(InlineLabel[])Sets the metadata shown after the source in the footer - a path, a size, an owner, a date - as InlineLabels, each separated from the next by a dot. Each one can carry a mark (a glyph, an image, a square of colour), be pressable, or be a real link, and they are all drawn at one size so the line reads as one row of facts. Replaces whatever entries were there.
SetFooterEntries(string[])Sets the metadata shown after the source in the footer, as plain text entries.
SetFooterEntries(InlineLabel[])
public OmniResult<T> SetFooterEntries(params InlineLabel[] entries)

Sets the metadata shown after the source in the footer - a path, a size, an owner, a date - as InlineLabels, each separated from the next by a dot. Each one can carry a mark (a glyph, an image, a square of colour), be pressable, or be a real link, and they are all drawn at one size so the line reads as one row of facts. Replaces whatever entries were there.

Parameters

entries InlineLabel[]
SetFooterEntries(string[])
public OmniResult<T> SetFooterEntries(params string[] entries)

Sets the metadata shown after the source in the footer, as plain text entries.

Parameters

entries string[]
Method
OmniResult.AddFooterEntry
public OmniResult<T> AddFooterEntry(IComponent entry)

Adds one more entry to the end of the footer line, as a component of the host's own rather than an InlineLabel - a badge, a chip, a small control a label cannot be. It gets the same box and the same separating dot as every other entry.

Method
OmniResult.Selectable
public OmniResult<T> Selectable(OmniResultSelectionMode mode = OmniResultSelectionMode.OnHoverBeforeIcon)

Makes the result selectable, with its checkbox shown as the given mode says. The checkbox toggles the selection on click; ctrl-clicking the row does the same, and shift-clicking it asks for a range (see OnRangeSelectionRequested).

Method
OmniResult.NotSelectable
public OmniResult<T> NotSelectable()

Takes the checkbox away again, unselecting the result if it was selected.

Method
OmniResult.Selected
public OmniResult<T> Selected(bool value = true)

Selects (or unselects) the result. Does nothing on a result that isn't selectable.

Method
OmniResult.OnSelectionChanged
public OmniResult<T> OnSelectionChanged(Action<OmniResult<T>, bool> onSelectionChanged)

Registers a callback invoked whenever the result is selected or unselected, by the user or by code, with the new state.

Method
OmniResult.OnRangeSelectionRequested
public OmniResult<T> OnRangeSelectionRequested(Action<OmniResult<T>> onRangeSelectionRequested)

Registers a callback invoked when the user shift-clicks the result, i.e. asks for everything between the last result they selected and this one. A single card knows nothing about its siblings, so the host list owns what "between" means - and selects them itself.

Method
OmniResult.OnContextMenu
Overload
OnContextMenu(Action<OmniResult<T>>, OmniResultCommandsMode)Registers the handler that opens the commands of this result, and says how it is reached: by right-click alone, or also by a [...] button at the top-right of the row - shown always, or only while the row is hovered. The handler is given the result, so it can build a menu from Result and show it with ShowMenu.
OnContextMenu(Func<OmniResult<T>, ContextMenu.Item[]>, OmniResultCommandsMode)Attaches a ContextMenu of actions to the result: the generator runs on every open and is given the result, and the items it returns are shown at the pointer (or under the [...] button). Returning null or an empty array opens nothing.
OnContextMenu(Action<OmniResult<T>>, OmniResultCommandsMode)
public OmniResult<T> OnContextMenu(Action<OmniResult<T>> handler, OmniResultCommandsMode mode = OmniResultCommandsMode.RightClickOnly)

Registers the handler that opens the commands of this result, and says how it is reached: by right-click alone, or also by a [...] button at the top-right of the row - shown always, or only while the row is hovered. The handler is given the result, so it can build a menu from Result and show it with ShowMenu.

Parameters

handler Action<OmniResult<T>>
mode OmniResultCommandsMode
OnContextMenu(Func<OmniResult<T>, ContextMenu.Item[]>, OmniResultCommandsMode)
public OmniResult<T> OnContextMenu(Func<OmniResult<T>, ContextMenu.Item[]> menu, OmniResultCommandsMode mode = OmniResultCommandsMode.RightClickOnly)

Attaches a ContextMenu of actions to the result: the generator runs on every open and is given the result, and the items it returns are shown at the pointer (or under the [...] button). Returning null or an empty array opens nothing.

Parameters

menu Func<OmniResult<T>, ContextMenu.Item[]>
mode OmniResultCommandsMode
Method
OmniResult.CommandsMode
public OmniResult<T> CommandsMode(OmniResultCommandsMode mode)

Changes how the commands registered with OnContextMenu are reached, without touching the handler itself.

Method
OmniResult.InlineCommands
Overload
InlineCommands(OmniResultCommandsVisibility, IComponent[])Puts the given components in the row's command area, before the [...] button - the one or two actions worth reaching without opening a menu. They show only while the row is hovered by default; the space they take is reserved either way, so revealing them never shifts the row.
InlineCommands(IComponent[])Puts the given components in the row's command area, revealed while the row is hovered.
InlineCommands(OmniResultCommandsVisibility, IComponent[])
public OmniResult<T> InlineCommands(OmniResultCommandsVisibility visibility, params IComponent[] commands)

Puts the given components in the row's command area, before the [...] button - the one or two actions worth reaching without opening a menu. They show only while the row is hovered by default; the space they take is reserved either way, so revealing them never shifts the row.

Parameters

visibility OmniResultCommandsVisibility
commands IComponent[]
InlineCommands(IComponent[])
public OmniResult<T> InlineCommands(params IComponent[] commands)

Puts the given components in the row's command area, revealed while the row is hovered.

Parameters

commands IComponent[]
Method
OmniResult.SetContributionBar
public OmniResult<T> SetContributionBar(ContributionBar bar)

Puts a ContributionBar under the footer, spanning the text column: what the result's score is made of - a title match, a content match, recency, popularity - as one stacked bar. Pass null to take it away. A bar with many segments is worth collapsing (Collapsable), so a list of results reads as one line each until the breakdown is asked for.

Method
OmniResult.SetPages
public OmniResult<T> SetPages(PagesStack pages)

Pins the given PagesStack preview to the end of the row, in a rail wide enough for it to fan into. Pass null to take it away.

Method
OmniResult.PagesFanOnHover
public OmniResult<T> PagesFanOnHover(bool value = true)

Configures whether the PagesStack fans while the row is hovered, rather than only while the pointer is over the pages themselves. On by default.

Method
OmniResult.OpenInSource
Overload
OpenInSource(string, Action<bool>, UIcons?)Adds a way to open the result where it actually lives - "Open in Dropbox", "Open in Outlook", "Reveal in folder" - as a named button in the modal's header. The handler is told whether the user asked for a new tab (they shift-clicked the button, or pressed Shift+Enter). Call it more than once to offer several: the first one stays the button, and the rest are reached through an arrow beside it.
OpenInSource(string, Action<bool>, Func<IComponent>)Adds a way to open the result where it actually lives, marked with an icon of the host's own - the source's logo, usually. The factory runs every time the icon is drawn, so one action can be shown more than once without the two fighting over the same element.
OpenInSource(string, Func<T, Uri>, UIcons?)Adds a way to open the result at an address computed from what it stands for - the usual shape of "open this where it came from" when the source is a web address. The result is opened in a new tab either way: an external address replacing the page the user is on would lose their place.
OpenInSource(string, Func<T, Uri>, Func<IComponent>)Adds a way to open the result at a computed address, marked with an icon of the host's own.
OpenInSource(string, Action<bool>, UIcons?)
public OmniResult<T> OpenInSource(string name, Action<bool> onOpen, UIcons? icon = null)

Adds a way to open the result where it actually lives - "Open in Dropbox", "Open in Outlook", "Reveal in folder" - as a named button in the modal's header. The handler is told whether the user asked for a new tab (they shift-clicked the button, or pressed Shift+Enter). Call it more than once to offer several: the first one stays the button, and the rest are reached through an arrow beside it.

Parameters

name string
onOpen Action<bool>
icon UIcons?
OpenInSource(string, Action<bool>, Func<IComponent>)
public OmniResult<T> OpenInSource(string name, Action<bool> onOpen, Func<IComponent> icon)

Adds a way to open the result where it actually lives, marked with an icon of the host's own - the source's logo, usually. The factory runs every time the icon is drawn, so one action can be shown more than once without the two fighting over the same element.

Parameters

name string
onOpen Action<bool>
icon Func<IComponent>
OpenInSource(string, Func<T, Uri>, UIcons?)
public OmniResult<T> OpenInSource(string name, Func<T, Uri> url, UIcons? icon = null)

Adds a way to open the result at an address computed from what it stands for - the usual shape of "open this where it came from" when the source is a web address. The result is opened in a new tab either way: an external address replacing the page the user is on would lose their place.

Parameters

name string
url Func<T, Uri>
icon UIcons?
OpenInSource(string, Func<T, Uri>, Func<IComponent>)
public OmniResult<T> OpenInSource(string name, Func<T, Uri> url, Func<IComponent> icon)

Adds a way to open the result at a computed address, marked with an icon of the host's own.

Parameters

name string
url Func<T, Uri>
icon Func<IComponent>
Method
OmniResult.NoOpenInSource
public OmniResult<T> NoOpenInSource()

Takes every way of opening the result at its source away again.

Method
OmniResult.Open
public OmniResult<T> Open(bool inNewTab = false)

Opens the result at its source the way the primary action says to, as pressing the button (or Ctrl+Enter in the modal) would. Does nothing on a result that has no such action.

Method
OmniResult.ModalCommands
public OmniResult<T> ModalCommands(Action<OmniResult<T>> onCommands)

Registers what the [...] button in the modal's header opens - the same commands the row's own [...] opens, usually. Read CommandsEvent in the handler to place a command surface of the host's own where the user clicked. Pass null to leave the button out.

Method
OmniResult.ModalFullScreen
public OmniResult<T> ModalFullScreen(Action<OmniResult<T>> onFullScreen)

Registers what the full-screen button in the modal's header does - open the result on a page of its own, usually. Without one the button is still there and simply grows the modal to fill the window (and back), which is what "full screen" means to a modal that has nowhere else to go.

Method
OmniResult.NoModalFullScreen
public OmniResult<T> NoModalFullScreen()

Leaves the full-screen button out of the modal's header.

Method
OmniResult.ModalNavigation
public OmniResult<T> ModalNavigation(Action<OmniResult<T>> onPrevious, Action<OmniResult<T>> onNext, int position = 0, int count = 0)

Puts the previous/next arrows in the modal's header, so a result opened out of a list can be stepped through without going back to it. A null handler greys its arrow out - that is how the first and the last result say so. Passing a position and a count (both 1-based, the count being how many results there are) draws "3 of 27" between the arrows.

Method
OmniResult.ModalShortcuts
public OmniResult<T> ModalShortcuts(bool value = true)

Configures whether the modal shows the keyboard shortcuts it answers along its bottom edge - what closes it, what steps through the results, what opens the result at its source. On by default.

Method
OmniResult.SetModalContent
Overload
SetModalContent(IComponent)Sets what ToModal puts inside the modal for this result - the full view of the thing the row stands for. Pass null to make the result modal-less again.
SetModalContent(Func<OmniResult<T>, Task<IComponent>>)Sets what ToModal puts inside the modal, built on open and given the result - for content that shouldn't be paid for until someone asks to see it.
SetModalContent(IComponent)
public OmniResult<T> SetModalContent(IComponent content)

Sets what ToModal puts inside the modal for this result - the full view of the thing the row stands for. Pass null to make the result modal-less again.

Parameters

content IComponent
SetModalContent(Func<OmniResult<T>, Task<IComponent>>)
public OmniResult<T> SetModalContent(Func<OmniResult<T>, Task<IComponent>> content)

Sets what ToModal puts inside the modal, built on open and given the result - for content that shouldn't be paid for until someone asks to see it.

Parameters

content Func<OmniResult<T>, Task<IComponent>>
Method
OmniResult.GetModalContentAsync
public Task<IComponent> GetModalContentAsync()

Builds the modal content on its own, for a host that shows it somewhere other than in a modal - a side panel, a page, a pane of its own. Returns null when the result has no modal content.

Method
OmniResult.SetModalHeader
public OmniResult<T> SetModalHeader(Func<OmniResult<T>, IComponent> header)

Replaces the modal's header - by default the same identifier, title and badge the row shows - with one built from the result. Pass null to go back to the default header.

Method
OmniResult.ModalSize
public OmniResult<T> ModalSize(UnitSize width, UnitSize height)

Sets the size the modal of ToModal opens at. Auto by default, which lets the modal size itself to its content (and to whatever bounds the caller sets on it afterwards).

Method
OmniResult.ModalKeepsIcon
public OmniResult<T> ModalKeepsIcon(bool value = true)

Keeps the icon tile in the modal's header, before the identifier and the title - so an opened result still shows what kind of thing it is, and the row and the modal read as one thing rather than two. Whatever the tile carries comes with it: the glyph or the thumbnail, the color it is tinted with, and any corner badges. Off by default.

Method
OmniResult.ModalKeepsFooter
public OmniResult<T> ModalKeepsFooter(bool value = true)

Keeps the footer - the source and the metadata beside it - as a second line under the title in the modal's header, so where a result came from is still said once it is open. The source stays clickable when the row's is. Off by default.

Method
OmniResult.ToModal
public Modal ToModal()

Builds a Modal showing this result: the row's identifier, title and badge as the header, and whatever SetModalContent was given as the body, at the size ModalSize asked for. Everything else - commands, dismissal, bounds, how it is shown - is left to the caller to chain on the returned modal. Returns null when the result has no modal content, so a caller can treat "this result has no preview" as one check.

Method
OmniResult.ModalHeaderCommands
public IComponent[] ModalHeaderCommands()

The commands ToModal puts at the end of the modal's header: the way to open the result at its source, the arrows stepping through the results, the [...] commands, the full-screen button and the close button - whichever of them this result was configured for. Useful to a caller building a header of its own around them.

Method
OmniResult.ModalShortcutsBar
public IComponent ModalShortcutsBar()

The keyboard shortcuts ToModal lists along the bottom of the modal - only the ones this result actually answers, so a modal that can't be stepped through never says it can.

Method
OmniResult.ModalTitle
public IComponent ModalTitle()

The header ToModal uses by default: the identifier and the title, drawn the way the row draws them, plus whatever ModalKeepsIcon and ModalKeepsFooter asked to keep. Useful to a caller building its own header around it.

Method
OmniResult.ShowMenu
public OmniResult<T> ShowMenu(ContextMenu menu)

Shows the given menu where the commands were asked for: at the pointer when the row was right-clicked, and under the [...] button when it was pressed. This is what a OnContextMenu handler uses to put its menu in the right place without tracking the event itself.

class

OmniResultOpenAction<T>

public sealed class OmniResultOpenAction<T>

One named way of opening an OmniResult{T} where it actually lives - "Open in Dropbox", "Open in Outlook", "Reveal in folder" - either as something the host does itself or as an address computed from the result.

Namespace
Tesserae

Properties

NameDescription
NameGets what this way of opening the result is called.
IconGets what draws the mark shown before the name, or null when it has none. It is a factory rather than a component so that showing the action twice never moves one element between two places.
Property
OmniResultOpenAction.Name
public string Name { get; }

Gets what this way of opening the result is called.

Property
OmniResultOpenAction.Icon
public Func<IComponent> Icon { get; }

Gets what draws the mark shown before the name, or null when it has none. It is a factory rather than a component so that showing the action twice never moves one element between two places.

Methods

NameDescription
UrlForGets the address this action opens for the given result, or null when it isn't an address at all but something the host does itself.
InvokeOpens the given result this way. An address is always opened in a new tab, whatever was asked for: replacing the page with somewhere else entirely would lose the user's place.
Method
OmniResultOpenAction.UrlFor
public Uri UrlFor(OmniResult<T> result)

Gets the address this action opens for the given result, or null when it isn't an address at all but something the host does itself.

Method
OmniResultOpenAction.Invoke
public void Invoke(OmniResult<T> result, bool inNewTab = false)

Opens the given result this way. An address is always opened in a new tab, whatever was asked for: replacing the page with somewhere else entirely would lose the user's place.

class

OmniResultTint

internal sealed class OmniResultTint

The colors an OmniResult{T} icon tile is drawn with, derived from the one color the host passed: the glyph in that color and the tile in a wash of it, in a light and a dark variant.

Namespace
Tesserae
class

OmniResultTints

internal static class OmniResultTints

Computes - and remembers - the tile colors derived from a given icon color. A list of results usually draws the same handful of colors over and over (one per file type), and every one of them costs a parse and two HSL round-trips, so the results are cached by the color they came from.

Namespace
Tesserae

See also

© 2026 Curiosity. All rights reserved.