Krizaka UI
Krizaka UI
Components

Slot

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

WebStableUtilities & brand

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

Installation

Install

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

Styles

@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

  • 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.

Best practices

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

Generated from the code of @krizaka/ui 3.8.0: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page