Black Friday is here 🔥 Get Wensity Pro for 20% less with

Label

A React form label that renders a real label element, with a red required asterisk, an Optional tag, a hint line, and muted, inline, or disabled styles.

Loading preview

Examples

Practical examples and common states for the same installable component.

Default

Standard block label for stacked form fields.

Requires: input

examples/label-default.tsx
import { Label } from "@/components/wensity/label";
import { Input } from "@/components/wensity/input";
export function LabelDefault() {
return (
<div>
<Label htmlFor="display-name">Display name</Label>
<Input id="display-name" placeholder="Parth Sharma" />
</div>
);
}

Required

Required indicator stays visible without relying on placeholder copy.

Requires: input

examples/label-required.tsx
import { IconMail } from "@tabler/icons-react";
import { Label } from "@/components/wensity/label";
import { Input } from "@/components/wensity/input";
export function LabelRequired() {
return (
<div>
<Label variant="required" htmlFor="email">
Work email
</Label>
<Input
id="email"
type="email"
placeholder="you@company.com"
leftIcon={<IconMail stroke={1.75} />}
/>
</div>
);
}

Optional

Optional marker for fields that are helpful but not required.

Requires: input

examples/label-optional.tsx
import { Label } from "@/components/wensity/label";
import { Input } from "@/components/wensity/input";
export function LabelOptional() {
return (
<div>
<Label variant="optional" htmlFor="note">
Internal note
</Label>
<Input id="note" placeholder="Only visible to admins" />
</div>
);
}

Muted

Secondary label copy for helper context beneath a primary label.

Requires: input

examples/label-muted.tsx
import { Label } from "@/components/wensity/label";
import { Input } from "@/components/wensity/input";
export function LabelMuted() {
return (
<div>
<Label htmlFor="channels">Notification channels</Label>
<Label variant="muted" htmlFor="channels">
Choose where alerts should land.
</Label>
<Input id="channels" placeholder="Email, push, or SMS" />
</div>
);
}

Inline

Horizontal label rhythm for compact settings rows.

Requires: input

examples/label-inline.tsx
import { IconMail } from "@tabler/icons-react";
import { Label } from "@/components/wensity/label";
import { Input } from "@/components/wensity/input";
export function LabelInline() {
return (
<div className="flex flex-wrap items-center gap-x-4 gap-y-3">
<Label variant="inline" htmlFor="email" hint="Work only">
Email
</Label>
<Input
id="email"
className="min-w-[14rem] flex-1"
placeholder="you@company.com"
leftIcon={<IconMail stroke={1.75} />}
/>
</div>
);
}

Disabled

Disabled labels reduce emphasis while keeping the field readable.

Requires: input

examples/label-disabled.tsx
import { Label } from "@/components/wensity/label";
import { Input } from "@/components/wensity/input";
export function LabelDisabled() {
return (
<div>
<Label variant="required" htmlFor="org-id" disabled>
Organization ID
</Label>
<Input id="org-id" defaultValue="org_8f2k91" disabled />
</div>
);
}

Overview

Label is a React and Tailwind CSS form label, in Next.js or any React app, that renders a real label element so clicking it focuses the linked input. The required variant adds a red asterisk hidden from screen readers, and optional prints a small Optional note instead. Muted and inline variants suit settings rows and checkbox captions, hint adds a quiet line of guidance, and disabled dims it to match a disabled control. Because the asterisk is visual only, also set required or aria-required on the input itself.

Installation

Run the following command

~/your-project
pnpm dlx wensity@latest add label

Usage

Import Label from @/components/wensity/label and render it anywhere in your React or Next.js app. The source lands in your own repo, so every prop, class and animation below is yours to edit.

app/example.tsx
import { Label } from "@/components/wensity/label";
import { Input } from "@/components/wensity/input";
export function LabelDemo() {
return (
<div>
<Label variant="required" htmlFor="email">
Work email
</Label>
<Input id="email" type="email" placeholder="you@company.com" />
</div>
);
}

Props

PropTypeDefaultDescription
variant"default" | "required" | "optional" | "muted" | "inline""default"required appends an asterisk, optional a muted suffix, inline sits beside the control.
hintReact.ReactNode-Secondary copy beside the label text, most useful with the inline variant.
disabledbooleanfalseDims the label to match a disabled control.
htmlForstring-Id of the control this label describes. Native attribute, forwarded as-is.
  • Follow Cursor Label component preview

    Follow Cursor Label

    A floating label that trails the cursor across your hover targets with an elastic pop-in and a soft spring settle.

  • Multi-Step Form Wizard component preview

    Multi-Step Form Wizard

    A multi-step form wizard whose card physically reshapes to wrap each new step as the content slides in behind it.

  • Multi-Select Tag Input component preview

    Multi-Select Tag Input

    A tag input where pills pop in as you add them and slide out on remove, closing the gap without snapping the layout.

  • Text Highlight component preview

    Text Highlight

    A hand-placed highlighter band that sweeps in behind your text and tracks wrapping.