Skip to content

FloatLabel ​

Floating / in-field label wrapper

For where a stacked label costs too much height — a sign-in card, a search bar, a filter row. A long form defaults to Field: it has description, error and required, this has a label.

Basic
  • The control inside takes the wrapper's id, so the label is associated without for/id. for is there for a control that already has one.
  • over (default) is CSS-only and floats on focus or value via :placeholder-shown, so the control needs a placeholder — placeholder=" " will do; it is hidden. The wrapper reserves the room above for the floated label.
  • in keeps the label inside the control, top-aligned, and never moves; no placeholder needed.

Usage ​

ts
import { BlessFloatLabel } from "blessing-ui";

API ​

Props

NameTypeDefaultDescription
label*string—
forstring—id of the control; by default the control inside takes the wrapper's id
variant"over" | "in""over"over = floats up on focus/value; in = always inside, top-aligned (IFTA)

Slots

NameScopeDescription
default—

Released under the MIT License. Character names and artwork belong to their owners.