Components / Navigation
AppBar
Top bar with logo, main links and actions. On phones (640px and narrower) the links move to their own row below the logo.
import { AppBar } from "@stylhero/ui";
Example
Code
import { AppBar, Button, Text } from "@stylhero/ui";
function AppBarExample() {
return (
<AppBar logo={<Text variant="strong">Stylhero</Text>} logoHref="#"
links={[{ label: "Docs", href: "#", active: true }, { label: "Components", href: "#" }, { label: "Themes", href: "#" }]}
actions={<Button size="sm">Install</Button>} />
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
actions |
ReactNode |
- | Right side: search, avatar, buttons. |
links |
NavLink[] |
- | |
logo |
ReactNode |
- | Usually <img src="/stylhero-wordmark.svg" …>. |
logoHref |
string |
"/" |
Where the logo links to. |
sticky |
boolean |
true |
Stays at the top while scrolling. |
Also takes the HTML attributes of its root element (id, style, data-*, aria-*, event handlers…).
Types
type NavLink = { label: ReactNode; href: string; active?: boolean };
Accessibility
- The links are a labelled
<nav>; the active link hasaria-current="page". On phones they move to their own row.
Generated from src/components/AppBar.tsx. Something wrong or missing? Open an issue.