Float Input

Text input whose label floats above the value, with error and helper text, a clear button, a password reveal toggle, and a multi-line variant.

import { FloatingLabelInput } from "@plexui/ui/components/FloatingLabelInput";

Examples

Overview

Filled state

Textarea

multiline

With error message

With description

We'll never share your email with anyone else.

With description and error

We'll never share your email with anyone else.

Clear button

Disabled

Read only

All states

Empty
Filled
Invalid
Disabled
Read only

Password input

SSN input

Birthday input

Birthday with validation

Birthday states

Empty
Filled
Invalid
Disabled

Select

Multiple selection

Country select

Phone input

+34

API

PropTypeDefaultDescription
labelstring—Required. Floating label text
valuestring—Controlled value, with onChange
defaultValuestring—Initial value when uncontrolled
errorMessagestring—Validation message below input; sets invalid state
invalidbooleanfalse (true if errorMessage)Invalid visual state
descriptionReactNode—Helper text below the input
disabledbooleanfalseDisable input interactions
readOnlybooleanfalseRead-only input state
typestring"text"Input type; password gets a reveal toggle
revealablebooleantrue for password without an endAdornmentBuilt-in reveal toggle
multilinebooleanfalseRender as an auto-growing textarea
rowsnumber2Initial visible text lines when multiline is true
allowAutofillExtensionsbooleanfalseLet password-manager extensions decorate the input
startAdornmentReactNode—Content rendered before the input, inside the field. Always shown; keeps the label floated
endAdornmentReactNode—Content rendered after the input, before the clear button
onClear() => void—Shows a clear button when the input has a value; focus returns to the input
onRevealedChange(revealed: boolean) => void—Called when the reveal toggle is clicked
onAutofill() => void—Called when the browser autofills the input

Other native <input> attributes (or <textarea> attributes with multiline) are forwarded.

Styling

Float Input reads these component tokens. Override them at any scope to restyle it:

  • --field-error-color: error color (default var(--color-text-danger-outline))
  • --field-error-font-size: error font size (default 0.75rem)
  • --field-error-line-height: error line height (default var(--font-text-xs-line-height))
  • --field-error-margin-top: error margin top (default 0.5rem)
  • --floating-input-background: background (default var(--color-surface))
  • --floating-input-border-color: border color
  • --floating-input-border-color-focus: border color focus (default var(--alpha-50))
  • --floating-input-border-color-hover: border color hover
  • --floating-input-border-color-invalid: border color invalid (default var(--color-border-danger-outline))
  • --floating-input-border-radius: border radius (default var(--radius-full))
  • --floating-input-gutter: gutter (default 1.25rem)
  • --floating-input-height: height (default 3.25rem)
  • --floating-input-label-color: label color (default var(--color-text-tertiary))
  • --floating-input-label-color-focus: label color focus (default var(--color-text))
  • --floating-input-label-color-invalid: label color invalid (default var(--color-text-danger-outline))
  • --floating-input-label-scale: label scale (default 0.88)
  • --floating-input-transition-duration: transition duration (default 80ms)