RouterPRISM routing
PRISM routing

This tutorial uses PRISM file-based routing: every folder under src/app/ becomes a URL, with nested layouts and server-side loaders.

Read the routing docs →
UIbext/ui
bext/ui

Components come from bext/ui — a faithful shadcn/ui port for bext and PRISM, styled through route_css tokens.

Explore bext/ui →
FREN
Step 5 of 11 · Build the layout

Sidebar navigation

Drive the sidebar from a data array and highlight the active route automatically — server-side.

The sidebar should highlight the page you're on. PRISM passes the current request path to every layout as route.pathname — so the layout knows the active item with no client-side JavaScript at all.

Define the nav as data, then mark the active link while mapping it:

src/app/layout.tsx
const NAV = [
  { label: "Dashboard", href: "/" },
  { label: "Products",  href: "/products" },
  { label: "Orders",    href: "/orders" },
  { label: "Customers", href: "/customers" },
];

const active = (path, href) =>
  href === "/" ? path === "/" : path.startsWith(href);

// inside Layout({ children, route }):
const path = route?.pathname ?? "/";
<nav className="nav">
  {NAV.map((n) => (
    <a key={n.href} href={n.href}
       className={active(path, n.href) ? "on" : ""}>{n.label}</a>
  ))}
</nav>
NOTE
The preview is on /products now — notice the Products link is highlighted. That whole decision happened on the server; the HTML arrived with the right item already active.
Files
src
app
products
src/app/layout.tsxread-only
localhost:3000