An app's top links, where some open a panel of pages with a line about each.
- 2.1 kB JS 3.3 kB CSS gzipped
- No serious axe issues
- Server-rendered, hydrates
- 44px touch targets
- 4 keys checked
- Right-to-left
- 11 tests
When to use
An app's top links, where some open a panel of pages with a line about each. Use Sidebar instead when the links run down a sidebar.
Usage
import { NavigationMenu } from "./ui/uicontext/components/NavigationMenu.ts"export const Main = <M>(h: Html.H<M>, current: string) => NavigationMenu(h, { props: { label: "Main", current, items: [ { _tag: "Link", label: "Home", href: "/" }, { _tag: "Group", value: "reports", label: "Reports", links: [{ label: "Revenue", href: "/reports/revenue", description: "MRR and churn" }] }, ], }, })Examples
API reference
Props
| Name | Type | Description |
|---|---|---|
labelrequired | string | The landmark's name: "Main", "Docs" |
itemsrequired | NavigationMenuItem[] | — |
current | string | The href of the page showing |
Keyboard and accessibility
| Keys | Does |
|---|---|
| →Right arrow ←Left arrow | Move along the bar |
| ↓Down arrow EnterEnter | Open a link's panel |
| TabTab | Walk into the open panel, then on past it |
| EscEscape | Close the panel and go back to its link |