Components · Search
Search
The search trigger in the web top bar, and the parts of search results — rows for places and people, message and thread hits, grouped by kind with the matched words marked.
import { Search } from "@botiverse/raft-ui";Search is a field, a few filters and results grouped by kind. Places and people are rows; messages are hits that say who, where and when, with the matched words on a yellow fill. On the web, search opens from the search field in the top bar (SearchTrigger); on a phone it is the Search tab, with the field in the tab's top bar.
When to use
Anatomy
Trigger
SearchTrigger: the top bar's search field. It looks like a field and is a button that opens the search dialog. Like every field it doesn't hover; a press lays the medium tier (Hover and press).- A search icon, then
SearchTriggerLabel(the placeholder, Search Raft), thenSearchTriggerShortcut(⌘K) at the right end. The label truncates first.
- A search icon, then
Results
SearchShellRoot: the search surface, withSearchShellFilters(the row of filters) andSearchShellViewport(the scrolling results).SearchResultsSummary: one line about the results: "Searching for “launch”…".SearchResultsSection: one kind of result, withSearchResultsSectionHeading(Messages 13) andSearchResultsList.SearchEntityResult: a channel, a person or an agent. It follows the layout of a ListRow:SearchEntityResultLeading(aSearchEntityResultIconor an avatar, with an optionalSearchEntityResultActivitylight), andSearchEntityResultContentwithSearchEntityResultHeader,SearchEntityResultTitleandSearchEntityResultSubtitle. It is a list cell: no line above or below it, its states on an inset shape (see Behavior). Put a result's test ids and data attributes onSearchEntityResultitself.SearchMessageResult: a message.SearchMessageResultHeaderholdsSearchMessageResultSender(who),SearchMessageResultMeta(where),SearchMessageResultThreadMeta(in a thread) andSearchMessageResultTimestamp(when);SearchMessageResultBodyholds the excerpt, with each match inSearchMessageResultMatch.SearchThreadResult: a thread with several hits:SearchThreadResultHeader(SearchThreadResultMeta,SearchThreadResultTimestamp,SearchThreadResultTitle) andSearchThreadResultMessages, a list ofSearchThreadMessageResult.
States
Behavior
- On a phone, search is the Search tab, and the field is in its navigation row (Page structure). Its keyboard, its kept state, opening a result and searching inside one place are in Navigation.
- Give the field the same margin on both sides, the content edge of what is under it: 20px, where a result's content starts, on a phone too (
SearchShellRootsets--column-margin; Lists).SearchShellFilterspads by the same margin. Don't leave a narrower edge on one side for an icon. - In a narrow list (the ⌘K dialog) a hit's head line gives way in order: the place truncates first, down to nothing, then the time, so the time doesn't run past the 12px inside the shape. The sender, the thread mark and badges keep their width; a line of those alone wider than the list is the one case left, and no list is that narrow today.
- On the web, open search from the top bar's field as a centered dialog, 720px wide, whose top edge covers the top bar's field, so the field seems to grow into it. It has the scrim and no animation, like every centered overlay (Choosing a component).
- Group results by kind (Conversation): places and people first, then messages.
- Draw no line between results, or between two threads. A result is a list cell (Lists): hover, press, menu open, the keyboard highlight and the focus ring are drawn on one rounded shape as tall as the result and inset 8px from each side.
SearchResultsListand a thread's messages are columns with a 2px gap and 8px at their top and bottom, so two filled results show 2px between them and the first sits 8px under its heading. Section headings, the summary and a thread's header separate the groups; they start 20px in, where a result's content starts. A result's content is padded from its shape, 12px inside it at the start and at the end and 8px at the top and bottom with every pointer (list-row-inset, as an Activity item), so the icon and the time never touch the shape (Lists).SearchShellViewporttakes the 8px list scrollbar and publishes its width, so the shape stays 8px from both edges with a classic scrollbar. - Show the scope, the sender, the place and the time range as filters in the filter row, each a select or combobox.
- Open a selected result in the side panel (Conversation). A hit in a thread opens that thread directly.
- Move the keyboard highlight from the field into the results with the Down arrow, and open the highlighted result with Enter.
Content
- Make the excerpt of a message at most 2 lines, with the matched words in
SearchMessageResultMatch. - Mark the matched words on a
youfill, in the text's own weight and with no edge (stdrc, 2026-10-24). A hit is a highlight behind words, not a thing, so it has no ink edge (A block of color is a sticker); with one it read as one more badge beside a row's "DM" or "Channel" tag and cut through the descenders. It keeps the fullyouyellow rather than a soft tint: a 40% tint was ΔE 1.2 from a selected row's fill and turned muddy in dark mode, while the full fill keeps ink type at 13:1 in both modes. The fill reaches 1px past the glyphs above and below, so descenders stay inside it. A mention of you keeps its sticker, edge and all. - Include a leading
@or#in the hit when the query matches a handle or a channel name: "@Remy", not "@" outside the fill. - Write the no-results state as what wasn't found and how to widen it: "No results for “launch”", "Try another word or remove a filter."
- Write the trigger's placeholder as what it searches: Search Raft.
Accessibility
- The parts render native elements through Base UI's
useRender; no Base UI primitive is involved. Results arebuttons by default; pass a link withrenderfor a result that navigates. SearchTriggeris abuttonnamed by its label. It opens a Dialog; give the dialog a title and the field inside it an accessible name (aria-label="Search").- Put the field and its filters in an element with
role="search", and give the clear buttonaria-label="Clear search". selectedis visual only. When you move a keyboard highlight through the results, keep focus on the field and point to the highlighted result witharia-activedescendant, or move focus to it.- Give an entity's activity light a name:
role="img"andaria-label="Active". SearchMessageResultMatchis amark, so matches are announced where the reader supports it.
API
SearchShellRoot
Also takes the attributes of its element.
SearchShellFilters, SearchShellViewport
Takes the attributes of its element.
SearchResultsSummary, SearchResultsSection, SearchResultsSectionHeading, SearchResultsList
Also takes the attributes of its element.
SearchEntityResult
Also takes the attributes of its element.
SearchEntityResultContent, SearchEntityResultHeader, SearchEntityResultLeading, SearchEntityResultIcon, SearchEntityResultActivity
Also takes the attributes of its element.
SearchEntityResultTitle, SearchEntityResultSubtitle
Also takes the attributes of its element.
SearchMessageResult, SearchThreadMessageResult
Also takes the attributes of its element.
SearchMessageResultHeader, SearchMessageResultBody, SearchMessageResultMeta, SearchMessageResultThreadMeta, SearchMessageResultSender, SearchMessageResultTimestamp, SearchMessageResultMatch
Also takes the attributes of its element.
SearchThreadResult
Also takes the attributes of its element.
SearchThreadResultHeader, SearchThreadResultMeta, SearchThreadResultTimestamp, SearchThreadResultTitle, SearchThreadResultMessages, SearchTrigger, SearchTriggerLabel
Also takes the attributes of its element.
SearchTriggerShortcut
Takes the attributes of its element.
Related
Changes
- 0.103.0 · Breaking ChangesData parts named for what they hold:
SearchEntityResultDescription→SearchEntityResultSubtitle,PreviewCardDescription→PreviewCardSubtitle,TaskCardDescription→TaskCardSubtitle,MobileNavServerPopoverRowDescription→MobileNavServerPopoverRowSubtitle(and their…Propstypes), andStep'sdescriptionprop →subtitle. Their look anddata-slotvalues are unchanged. - 0.73.0 · ChangedEvery region that scrolls is a ScrollArea:
PanelScrollViewport,ActivityInboxViewport,SearchShellViewport,NotificationCenterScroller,FilesViewport,TasksPanelViewport, ChoiceList's scroller,MobileNavServerPopoverList,ComposerSuggestionList,AnnouncementDialogBody,MessageActionCardScopeListViewportandDialogNavshow ScrollArea's overlay scrollbar instead of the platform's. Native scrolling stays only in the places scroll-area.md lists, each with its reason, and a test fails on any other. - 0.49.0 · ChangedSidebarItem, InboxItem, SearchEntity/SearchHit rows: list cells, no dividers; their lists (
SidebarList,SearchResultsList,ActivityInboxViewport,InboxItemSkeletonList,DialogNav) space rows withgap-0.5 py-2. An app that drew its own row padding or right inset on these rows should remove it. - 0.40.0 · Design SystemComments and search: a reply is one more
CommentEntryin the card, with no indent or wrapper; put test ids onSearchEntityResultitself, since a wrapper hides the hairlines between results. - 0.35.0 · ChangedA search hit (
searchHit:MessageItemSearchMatch,MarkdownMark,SearchMessageResultMatch) is ayoufill with ink type, in the surrounding weight, with no ink ring, and 1px of fill above and below so descenders stay inside it. A mention of you keeps its sticker. - 0.10.0 · Breaking ChangesField frames (
Input,Textarea,InputGroup,Select,Combobox,ComboboxSelect,Composer, optionCard,SearchTrigger) are drawn at 1px inline-fieldinstead of 1.5px, on the phone too. - 0.6.1 · Added
SearchTrigger(SearchTriggerLabel,SearchTriggerShortcut): the web top bar's search box, a button drawn as a field.