Skip to content
Stylhero 0.8.0
Components

Core

Layout and type

Inputs

Overlays

Navigation

Data display

Charts

Transitions and utilities

Page pieces (landing pages, portfolios, docs)

Icons

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

PropTypeDefaultDescription
actions ReactNode - Right side: search, avatar, buttons.
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 has aria-current="page". On phones they move to their own row.

Generated from src/components/AppBar.tsx. Something wrong or missing? Open an issue.