SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

docsNavTools

Finishes a server-rendered docs sidebar in the browser.

tsx
import { docsNavTools } from "@sdxc/ui/docs";

Usage

Works on the closest [data-docs-nav] around its host. The current link is the one with aria-current="page". When the host holds an <input>, typing hides every li whose title misses the query, hides sections left empty, opens <details> groups holding a match, and shows [data-docs-nav-empty] when nothing matches; clearing the field restores every group's own open state. A page reload that resets the tree keeps the query applied. The host is hidden until this runs, so a page without script never shows an inert field.

Signature

typescript
docsNavTools(): MixinDescriptor<HTMLElement>

Examples

tsx
<div data-docs-nav><div hidden mix={[docsNavTools()]}><input type="search" /></div><nav>…</nav></div>

The events, constants and types its module publishes, each imported from @sdxc/ui/docs too.

Function

filterDocsNav

Shows the pages whose title holds every word of query, case- and accent-insensitive, with the groups and sections that contain them; a group whose own title matches keeps all its pages. An empty query restores the full tree and each group's own open state.

typescript
filterDocsNav(nav: HTMLElement, query: string, ownState: Map<HTMLDetailsElement, boolean>)
ParameterTypeRequiredDescription
navHTMLElementYes
querystringYes
ownStateMap<HTMLDetailsElement, boolean>Yes
@sdxc/ui

Can’t find it? Contact us