Skip to content
caliper ui docs

Components

Label

The visible name for a field, tied to it so a click focuses the control.

Free
pnpm dlx shadcn@latest add @caliper/label

New project

Projects group deploys, keys and billing for one product

Installs components/ui/label.tsxDepends on none beyond ReactMotion none in component source

When to use

Use it for

  • Every input, select and textarea that does not already carry its own label.
  • Pair it with htmlFor and the field's id.

Skip it when

  • The control is labelled by its own text, like a button.
  • A placeholder is the only name; placeholders disappear as you type.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/label

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

This is the code behind the preview above.

example.tsx
import { type ReactNode } from "react"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"

function Panel({ title, context, className = "max-w-md", children }: { title: string; context: string; className?: string; children: ReactNode }) {
  return (
    <section className={`grid w-full gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting ${className}`}>
      <div className="grid gap-1">
        <p className="font-medium">{title}</p>
        <p className="text-sm text-muted-foreground">{context}</p>
      </div>
      {children}
    </section>
  );
}

export function RegionLabel() {
  return (
    <Panel title="New project" context="Projects group deploys, keys and billing for one product" className="max-w-sm">
      <div className="grid gap-1.5">
        <Label htmlFor="docs-name">Project name <span className="font-normal text-muted-foreground">Visible to your team</span></Label>
        <Input id="docs-name" defaultValue="Atlas platform" />
      </div>
    </Panel>
  );
}

API reference

Label

component

No props of its own; it accepts the native props of its root element.

Accessibility

It is built on native elements, so roles and focus come from the browser.

No custom key handling; Tab and the native activation keys do the work.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Inputs examples