Components
Slot
Slot merges its props and classes into its only child — the engine of asChild — and VisuallyHidden names things for screen readers only.
Web only — React, from @krizaka/ui/slot. Stable: its API only changes in a major version.
Why it is here. The `asChild` mechanism: every primitive that renders your own link or element is built on it.
When to use
- To give your own component an
asChildprop. VisuallyHiddenfor words that only assistive technology needs: an icon button's name, a table caption.
When not to use
- To style a link like a button:
asChildon the button does it.Use instead: Button - To hide something from everyone: use
hidden.
Installation
Install
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Import
import { Slot, VisuallyHidden } from "@krizaka/ui/slot";Examples
Slot
The link is rendered, styled by the Slot.
VisuallyHidden
An icon button named for screen readers.
Props
This module has no component props: see the import and the preview above.
Accessibility
VisuallyHiddenis read by screen readers and not shown.Slotkeeps the child's element: a link stays a link, with its role and keyboard.
Best practices
Slottakes exactly one child element.- Prefer a visible label to
VisuallyHiddenwhen there is room for one.
Related components
Generated from the code of @krizaka/ui 3.8.0: its meta.ts, its examples and its types.Edit this documentation on GitHub