Composants
Slot
Slot merges its props and classes into its only child — the engine of asChild — and VisuallyHidden names things for screen readers only.
Web uniquement — React, depuis @krizaka/ui/slot. Stable : son API ne change qu’à une version majeure.
Pourquoi il est là. The `asChild` mechanism: every primitive that renders your own link or element is built on it.
Quand l’utiliser
- To give your own component an
asChildprop. VisuallyHiddenfor words that only assistive technology needs: an icon button's name, a table caption.
Quand ne pas l’utiliser
- To style a link like a button:
asChildon the button does it.À la place : Button - To hide something from everyone: use
hidden.
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { Slot, VisuallyHidden } from "@krizaka/ui/slot";Exemples
Slot
The link is rendered, styled by the Slot.
VisuallyHidden
An icon button named for screen readers.
Props
Ce module n'a pas de props de composant : voir l'import et l'aperçu ci-dessus.
Accessibilité
VisuallyHiddenis read by screen readers and not shown.Slotkeeps the child's element: a link stays a link, with its role and keyboard.
Bonnes pratiques
Slottakes exactly one child element.- Prefer a visible label to
VisuallyHiddenwhen there is room for one.
Composants liés
Générée depuis le code de @krizaka/ui 3.9.0 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub