AsterUIDocsv1.0.2

Docs / Component reference

AppShell, Sidebar & NavItem

Give the page a persistent navigation rail. At a narrow width the menu button opens the same destinations in a sheet.

App shell example

Install

sh
npx @fierst/ui@1.0.2 add app-shell

Registry dependencies: theme, icon, sheet. Package dependencies: @lucide/icons.

Exports from ./ui/app-shell: NavItem, Sidebar, AppShell.

Download the registry source for app-shell 1.0.2.

API contracts

ts
export function NavItem({
  href,
  label,
  icon,
  active = false,
  compact = false,
  badge,
  onClick,
  class: extraClass,
}: {
  href?: string;
  label: string;
  icon?: LucideIconInput;
  active?: boolean;
  compact?: boolean;
  badge?: View;
  onClick?: (e: MouseEvent) => void;
  class?: string;
})

export function Sidebar({
  header,
  footer,
  collapsed = false,
  class: extraClass,
  children,
}: {
  header?: View;
  footer?: View;
  collapsed?: boolean;
  class?: string;
  children?: View;
})

export function* AppShell(
  props: {
    brand?: View;
    sidebar: View | ((opts: { collapsed: boolean; closeMobile: () => void }) => View);
    topbar?: View;
    collapsible?: boolean;
    class?: string;
    children?: View;
  },
  ctx: Ctx,
)