Krizaka UI
Krizaka UI
Composants

Slot

Slot merges its props and classes into its only child — the engine of asChild — and VisuallyHidden names things for screen readers only.

WebStableUtilitaires et marque

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 asChild prop.
  • VisuallyHidden for 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: asChild on the button does it.À la place : Button
  • To hide something from everyone: use hidden.

Installation

Installer

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@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é

  • VisuallyHidden is read by screen readers and not shown.
  • Slot keeps the child's element: a link stays a link, with its role and keyboard.

Bonnes pratiques

  • Slot takes exactly one child element.
  • Prefer a visible label to VisuallyHidden when there is room for one.

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

Sur cette page