Docs / Components / SideBar
ven.js
SideBar
venjs.sideBar(props) — a fixed left navigation drawer that is always open on desktop and collapses off-canvas on mobile.
Signature
venjs.sideBar(props) → VNode
Props
| Prop | Type | Description |
|---|---|---|
isOpen | boolean | When false, the drawer is hidden/translated off-screen (default true). |
children | VNode | VNode[] | Drawer contents (nav links, headers, etc.). |
Example
const open = venjs.signal(true);
venjs.sideBar({
isOpen: open.value,
children: [
venjs.h3({ class: "sb-title" }, "Menu"),
venjs.a({ href: "#/home", class: "sb-link" }, "Home"),
venjs.a({ href: "#/settings", class: "sb-link" }, "Settings")
]
});
On desktop (
md:) the sidebar is always visible at w-64. On mobile it becomes w-0 -translate-x-full unless isOpen opens it. Drive isOpen from a signal toggled by a hamburger button in your AppBar.