Talisman LogoTalisman Logo Design System
Browse documentation
Components

Label

The visible name of a form control, with an optional required mark and an info tooltip for extra context.

Stableimport { Label } from "@repo/ui/label";Source
size
<Label size="sm">Número do processo</Label>

When to use

  • To name a control that has no built-in label, such as a Select, a Switch or an Input without label.
  • To add an info tooltip or a required mark to a field name.

When not to use

  • Fields inside React Hook Form. Use FormLabel from Form, which links the label to the field for you.
  • Input and Textarea with their own label prop. They already render a label.
  • Headings and descriptions. Use Typography.

Sizes

sm is the default. Form fields use sm or md.

Size Type size Use for
lg 18px Large forms and sign-in pages.
md 16px Standalone field labels.
sm 14px Default. Compact forms.
xs 12px Dense layouts.
xxs 10px Avoid for primary field names.

Required

required adds a red asterisk. It is visual only: set required on the control too, so assistive technology announces it.

Info tooltip

info adds an icon button that opens a tooltip. Always set infoLabel, which names the button.

Linking to a control

Set htmlFor to the control’s id. Clicking the label then focuses the control.

Content

  • Use the noun, in sentence case, with no colon: “Nome do cliente”.
  • Keep labels short. Move rules and examples to a hint under the field.
  • Put long explanations in info, not in the label.

Do and don’t

DoLink the label to the control with htmlFor and id.
Don'tDon't leave the label unlinked. Clicking it does nothing and screen readers lose the name.

Accessibility

  • Built on Radix Label, which renders a native <label>. Clicking it activates the control it names, and double clicks do not select the text.
  • The control must have the matching id. Without htmlFor, nothing links them.
  • The required asterisk is drawn with CSS (after:content-['*']). It is not read by assistive technology, so set required on the control as well.
  • The info button is a ghost Button with a tooltip. Without infoLabel it has no accessible name. The tooltip opens on hover and on keyboard focus.
  • Pair it with a sibling control marked peer to dim the label when the control is disabled.

Code

import { Label } from "@repo/ui/label";
import { Input } from "@repo/ui/input";

<Label htmlFor="cliente" required size="md">
  Nome do cliente
</Label>
<Input id="cliente" required />

// With an info tooltip
<Label
  info="O revisor recebe a tarefa quando o prazo é atingido."
  infoLabel="Mais informações sobre o prazo de revisão"
>
  Prazo de revisão
</Label>

Props

PropTypeDefaultDescription
childrenstring—Label text
htmlForstring—Id of the control the label names
infostring—Tooltip content shown from an info icon next to the label. Omit for a plain label
infoLabelstring—Accessible name of the info icon button. Required whenever `info` is set
requiredbooleanfalseAdds a red asterisk after the text
size"lg" | "md" | "sm" | "xs" | "xxs"smType size

Known issues

Issue Effect
infoLabel is optional in the type, although the info button needs it. Omitting it leaves an icon button with no accessible name.
The required mark is CSS-generated content with no text alternative. Screen readers do not announce that the field is required unless the control is required.
Disabled dimming uses peer-disabled:opacity-70. A translucent treatment, and the label must come after a peer control to get it.
xxs is text-[0.625rem] (10px). Below a comfortable reading size for 8h+ sessions on low-spec monitors.
Edit this page on GitHub