Layout

Page frames, breadcrumbs and empty states for simple screens.

Northwind FreightProjects

No projects yet

Projects you create or join show here.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/layout

Usage

import { Crumbs, EmptyState, Page } from "./ui/uicontext/components/Layout.ts"
export const ProjectsPage = <M>(h: Html.H<M>) =>	Page(h, {		header: Crumbs(h, ["Northwind Freight", "Projects"]),		body: [EmptyState(h, { title: "No projects yet", hint: "Projects you create or join show here." })],	})

API reference

AppFrameView function

Options

AppFrame options
NameTypeDescription
sidebarrequiredView.ChildrenWhat runs down the left of the window, usually NavSections of NavItems.
pagerequiredView.ChildrenThe current page, drawn in the inset panel.

NavItemView function

Options

NavItem options
NameTypeDescription
hrefrequiredstringWhere the link goes.
labelrequiredstringThe link's text.
iconrequiredstringA short mark before the label, such as an emoji or a character.
activerequiredbooleanWhether this link is the current page; it's highlighted and announced as current.

NavSectionView function

Options

NavSection options
NameTypeDescription
titlestringA small heading over the group. Leave it out for an untitled group.
childrenrequiredView.ChildrenThe group's links.

PageView function

Options

Page options
NameTypeDescription
headerrequiredView.ChildrenWhat the header bar shows, such as Crumbs and actions.
bodyrequiredView.ChildrenThe page's content, under the header.
styleStyleStyleX styles for the page, applied after its own.

EmptyStateView function

Options

EmptyState options
NameTypeDescription
titlerequiredstringWhat's missing, in a few words: "No projects yet".
hintstringWhat will fill it, or what to do next.

Accessibility

  • The page sits in a main landmark and each page is a section with a header.
  • A sidebar link to the current page is aria-current="page", and the › between crumbs is hidden from screen readers.

Source