Command palette

@yasinsensoy/web

Web · Components

Label

Form field label.

2 exports

Import

import { Label } from "@yasinsensoy/web";

Label

componentServer component

Form field label. Link it to the field with htmlFor or put the field inside it. It fades while the linked field is disabled (inside the same group or before it as a peer).

With tooltip, an ⓘ icon is added next to the label. Since the label itself can't be focused and tapping it on mobile focuses the field, the hint opens on this icon instead of the label, so everyone can reach it.

Label({ className, tooltip, ...props }: LabelProps): JSX.Element

Examples

<Label htmlFor="name">Name</Label>
<Input id="name" />

<Label>
  <Checkbox /> Remember me
</Label>

<Label htmlFor="taxId" tooltip="Required for invoicing.">Tax ID</Label>

LabelProps

interface

Props of the Label component.

Extends: ComponentProps<"label">

NameTypeDescription
tooltip?TooltipPropHint shown with a small ⓘ icon next to the label (e.g. why the field is requested). The icon opens on mouse hover, on keyboard focus and on tap on mobile. See TooltipProp and InfoTip.