Composants
Docs nav
The pages of a documentation in quiet groups: each group folds, the one holding the current page is open, only the current page is marked.
import { DocsNav } from "@krizaka/ui/docs-nav";Web uniquement — React, depuis @krizaka/ui/docs-nav. Bêta : son API peut encore changer à une version mineure.
- Mobile · n/a. Documentation is read on the sites, not inside an app.
- Bureau · n/a. A public site's page, not a window of the Mac app.
Pourquoi il est là. Groups the pages in the documentation sidebar.
Quand l’utiliser
- The
sidebarof aDocsLayoutorDocsArticlePage. - A documentation with two or more audiences (a guide, a reference) that must not be mixed.
Quand ne pas l’utiliser
- For the sections of one page.À la place : Table of contents
- For the site's main navigation.À la place : Nav bar
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { DocsNav } from "@krizaka/ui/docs-nav";Exemples
A guide and a reference
Two groups, the second page current.
Props
The pages of the documentation in groups; the group of the current page is open, the others fold.
| Prop | Type | Défaut | Description |
|---|---|---|---|
groupsrequis | readonly DocsNavGroup[] | — | The groups, in order. |
labelrequis | string | — | The navigation's accessible name (Documentation). |
current | string | — | The href of the page being read. |
linkAs | LinkComponent | — | The app's link component (Next's Link). |
Accessibilité
- A
navnamed bylabel; the current page carriesaria-current="page". - Groups are native
details: they work without script.
Clavier
| Touches | Action |
|---|---|
| Enter / Space | Opens or closes a group. |
| Tab | Walks the links of the open groups. |
Bonnes pratiques
- Titles of one line: shorten them, the page's own title says the rest.
- No icon and no emoji: the active page is the only thing that stands out.
Composants liés
Générée depuis le code de @krizaka/ui 3.63.1 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub