Label

A plain, muted caption for a control.

Plain label

Real use · floating label form

Required

Using Label

Silica ships one design system through three paths. They share a class vocabulary but are not interchangeable — pick the one that matches what you are building.

Plain HTML — CSS classes

The Tailwind v4 plugin. Works in any framework or none — Rails, Django, PHP, Go, a static file. This path is complete for Label — it needs no JavaScript, so the classes below are the whole story.

/* in your CSS */
@import "tailwindcss";
@plugin "@wizeworks/silicaui";

Root class floating-label, with 3 modifiers:

  • .floating-label
  • .label
  • .label-control
  • .label-required

React

Typed components over those same classes, with behavior and accessibility from Base UI.

npm i @wizeworks/silicaui-react
import { Label } from "@wizeworks/silicaui-react";

Props

LabelProps
PropTypeRequiredDescription
requiredbooleannoAppends a required-field asterisk after the label text.
FloatingLabelProps
PropTypeRequiredDescription
labelReact.ReactNodeyesCaption text that floats onto the border when the field is focused/filled.
childrenReact.ReactElement<{ placeholder?: string }>yesThe control (an <Input>, <Textarea>, <select>, …).

Source of the demo above

The exact file that renders the examples above, so it can never drift from them. It imports a few of this site’s own layout helpers (../lib/…), so read it for the component calls rather than copying it whole.

Show source
import { Label, FloatingLabel, Input } from "@wizeworks/silicaui-react";
import { Section, Stack } from "../lib/Section";

export function LabelDemo() {
    return (
        <>
            <Section title="Plain label">
                <div className="flex max-w-sm flex-col gap-1.5">
                    <Label htmlFor="email-plain">Email</Label>
                    <Input id="email-plain" placeholder="you@example.com" />
                </div>
            </Section>

            <Section title="Real use · floating label form">
                <Stack className="max-w-sm">
                    <FloatingLabel label="Email">
                        <Input type="email" />
                    </FloatingLabel>
                    <FloatingLabel label="Password">
                        <Input type="password" />
                    </FloatingLabel>
                </Stack>
            </Section>

            <Section title="Required">
                <div className="flex max-w-sm flex-col gap-1.5">
                    <Label htmlFor="email-required" required>
                        Email
                    </Label>
                    <Input id="email-required" placeholder="you@example.com" />
                </div>
            </Section>
        </>
    );
}

Vanilla — node tree to HTML

Plain element atoms — same shape as elementDef, one tag each, no behavior. Build a node tree, project it with toHtml(), and let the zero-dependency runtime hydrate it. This is the path for generated or user-authored documents — a site builder, CMS output, a static export.

npm i @wizeworks/silicaui-html @wizeworks/silicaui-behaviors
import { atom, toHtml } from "@wizeworks/silicaui-html";

const node = atom("Label", "floating-label", { /* props */ });
const markup = toHtml(node);

Styling on this path is the class string in the second argument — the same classes as the Plain HTML section above. There is no color prop here; write "floating-label floating-label-primary" rather than passing a colour as a prop.

Takes children
no
Hydrated by
nothing — this one is static markup

The full API for Label, on every path, is available through the Silica MCP server.