Sidebar
Persistent side navigation. It collapses to an icon rail or hides completely, remembers its state, and turns into a Drawer on its own below lg. Shortcut: ⌘/Ctrl + B.
Navigation · TaishoDS Core, in plain HTML.
Examples
One working example per case. Each example is the HTML of its preview—copy it as is, and with Core’s CSS and JS loaded, it looks and works the same.
Sidebar with collapsible groups
Class reference
Every value of each modifier, with its HTML ready to copy.
Side
Which side the sidebar sits on: side-left or side-right.
Collapsible
How it collapses: icon (to icons only), offcanvas (hides), or none.
When to use
- There are many sections, with hierarchy, and keeping them always visible helps.
- Users jump between sections often (docs, an admin dashboard).
- You want the same navigation to become a panel on small screens.
When not to use
- There are only a few sections, and they fit at the top →
nav-bar. - It’s the table of contents for the page being read →
toc. - It’s a temporary panel that opens and closes →
drawer.
Do
- Group items by topic and mark the active one.
- Let it collapse. On small screens, the content matters more than the menu.
- In the collapsed rail, the items of an expanded group stay as icons, so give each item its own. A collapsed group is not reachable until the bar is expanded.
Don’t
- Don’t nest menus three levels deep. It turns into a maze.
- Don’t duplicate what’s already in the top bar.
TaishoDS Core
Needs Core’s JS, which handles focus, keyboard, and state.
It’s a set of parts (bar, groups, items, trigger) that coordinate with each other.
Core hooks into it through these attributes. They go in the markup, and there’s nothing to initialize.
data-ts-breakpointdata-ts-persist-keydata-ts-sidebardata-ts-sidebar-collapsibledata-ts-sidebar-drawerdata-ts-sidebar-groupdata-ts-sidebar-group-itemsdata-ts-sidebar-group-toggledata-ts-sidebar-iddata-ts-sidebar-itemdata-ts-sidebar-toggledata-ts-sidebar-trigger
What it does: Collapses and expands with persistence, supports nested groups, and marks the active item. Below the breakpoint (data-ts-breakpoint, via @media), the bar hides, and the HTML includes the Drawer with the same navigation. The trigger (data-ts-sidebar-trigger) opens it in a narrow viewport and collapses the bar in a wide one. If you widen the viewport with the Drawer open, it closes and focus returns to the trigger.
From the CDN, without a build, load taisho.sidebar.css along with taisho.base.css. Also load:
taisho.badge.csstaisho.button.csstaisho.drawer.csstaisho.icon.csstaisho.menu.csstaisho.modal.csstaisho.separator.csstaisho.spinner.csstaisho.tooltip.css
For how Core works in general, see Behavior.
Accessibility
- It’s a
<nav>with anaria-label. The collapse trigger exposesaria-expanded. - Below the breakpoint (
data-ts-breakpoint), the bar becomes a modal Drawer opened by the button withdata-ts-sidebar-trigger. The navigation keeps its<nav aria-label>inside, and the Drawer shows that same name as its visible title (the<h2>that names the<dialog>througharia-labelledby), with its close button. Without a visible trigger on the page, there’s no way to open it on narrow screens (at 320px, the content can’t share the width with a 256px bar—WCAG 1.4.10). Activating an item closes the Drawer, and Esc closes it and returns focus to the trigger. If the viewport is widened past the breakpoint with the Drawer open, it also closes (there’s room for the fixed bar now), and focus returns to the trigger instead of getting lost. When the viewport narrows again, the Drawer doesn’t reappear open. - The active item is scrolled into view by scrolling the bar manually, not with
scrollIntoView, which in Chrome moves the Tab starting point and skips everything before the active item. - Collapsed rail (
collapsible-icon): the items stay as icons and remain operable. Each keeps its accessible name, because the label stays inside the link with its text visually hidden, and it carries atitlewith that name. There’s no group flyout: the items of an expanded group stay in the rail as icons, and a collapsed group stays out of the tab order until the bar is expanded. Withcollapsible-offcanvasfolded, the content isinert.
Keyboard
On top of what the browser already does (Tab moves focus, Enter activates a button).
| Key | What it does |
|---|---|
| Tab/Enter | In the collapsed rail, Tab moves through the items shown as icons, and Enter activates the focused one. |
Verification
What was actually tested. Anything that wasn’t tested says so—we’d rather say “not verified” than claim too much.
- axe WCAG 2.2 A + AA in a real browser, in light and dark mode, before every release.
- keyboard Key map documented above, checked against the component.
- screen reader Not verified with a screen reader. Test it in your own combination of components, not just here, where each one appears alone and on its happy path.