Search Navigation
Present a navigation menu's item in a popover for the user to quickly search in by keyboard.
#Examples
A SearchNavigation
allows the user to choose a specific navigation item by browsing a flattened list of them.
The items must implement the properties defined in type SearchableNavigationItem
.
<SearchNavigation
hotkey="m"
items={[
{
id: "myMenuA",
title: "My Menu A",
children: [
{ id: "myLinkPlain", title: "My Link plain", href: "http://example.com" },
{
id: "myLinkOpenNew",
title: "My Link openNew",
href: "http://example.com",
openNew: true,
},
{ id: "myButton", title: "My Button", onClick: () => alert("clicked") },
],
},
{
id: "myMenuB",
title: "My Menu B",
children: [
{
id: "mySubA",
title: "My Sub A",
children: [
{
id: "link",
title: "Link",
href: "http://example.com",
},
],
},
{
id: "mySubB",
title: "My Sub B",
children: [
{
id: "mySubBB",
title: "My Sub BB",
children: [
{
id: "myItemSubBB",
title: "My Item Sub BB",
href: "http://example.com",
},
],
},
{
id: "mySubBC",
title: "My Sub BC",
href: "http://example.com",
},
],
},
],
},
{
id: "myMenuC",
title: "My Menu C",
},
]}
/>
#Properties
Property | Description | Defined | Value |
---|---|---|---|
itemsRequired | object[] List of strings or objects to display in the menu | ||
labelOptional | string Optional label text of the search button | ||
placeholderOptional | string Optional placeholder text of the search field | ||
hotkeyOptional | string Optional character of hotkey for invoking the search | ||
function Custom navigation function, in case the user has a better way of navigating than setting window.location.href | |||
dialogSelectorsOptional | string[] Optional list of selectors to identify dialogs (e.g. modals and sidepanels) that should disable the hotkey | ||
data-observe-keyOptional | string Unique string, used by external script e.g. for event tracking | ||
classNameOptional | string Custom className that's applied to the outermost element (only intended for special cases) | ||
styleOptional | object Style object to apply custom inline styles (only intended for special cases) |