Docs menu

Label

A chunky label that perks up with its field. Focus the field and the label hops, turns sakura and draws a wavy underline. Mark it required and a little star twinkles after the text, then spins while the field has focus. キラッ

Installation

❯ npx shadcn@latest add https://yan.moe/r/label.json

Usage

tsx
import { Label } from "@/components/ui/label"
tsx
<Label htmlFor="email" required>Email</Label>
<Input id="email" type="email" required />

Accessibility

  • Built on Radix Label: clicking it focuses the field named by htmlFor, and double-clicking does not select its text.
  • The star is decoration and hidden from screen readers. Put required on the field too.
  • The label follows focus only through htmlFor. A field wrapped inside the label is not watched.
  • With prefers-reduced-motion: reduce, the label changes colour without the hop, and the star stays still.

API

PropTypeDefault
required

Show a star after the text.

booleanfalse
intensity

kawaii: hop, sakura ink, wavy underline and a spinning star on focus. subtle: sakura ink only. off: nothing changes.

"kawaii" | "subtle" | "off""kawaii"
htmlFor

The id of the field this label names and watches.

string-