Skip to content

Label

Download .md

A label names a form control, and clicking it moves focus to that control.

  • Give every input, select and checkbox a visible label.
  • Put labels above inputs and selects, and beside checkboxes.
  • Keep labels short; put guidance in a hint below the field.
React
Vue
123
  1. 1Label text
  2. 2Required mark
  3. 3The control it names

One line of text-sm medium text in foreground. A disabled control dims its label too.

There is one style.

React Vue Flutter Type Default Use
htmlFor for label on the field string none The id of the control it names.
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
export default function LabelDemo() {
return (
<div className="grid w-full max-w-sm gap-2">
<Label htmlFor="label-demo-name">Nama lengkap</Label>
<Input id="label-demo-name" />
</div>
)
}
Terminal window
npx shadcn@latest add https://design.sosialoka.tech/r/react/label.json
  • Renders a native label, so clicking it focuses the control.
  • Flutter has no separate label widget; pass label to the form field.