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/vue/components/FloatingLabelInput";

Examples

Overview

Filled state

Textarea

multiline

With error message

With description

With description and error

Clear button

Disabled

Read only

All states

Password input

SSN input

Birthday input

Birthday with validation

Birthday states

Select

Multiple selection

Country select

Phone input

API

PropTypeDefaultDescription
labelstring—Label text for the floating label
value / v-model:valuestring—Controlled value; `update:value` fires on input
default-valuestring—Initial value when uncontrolled
error-messagestring—Error message to display below the input
invalidbooleanfalse (true if error-message)Mark the input as invalid
descriptionstring | slot—Helper text below the input
disabledbooleanfalseDisables the input
read-only / readonlybooleanfalseMakes the input read-only (both spellings work)
typestring"text"Input type; password gets a reveal toggle
revealablebooleantrue for password without an end adornmentBuilt-in reveal toggle
multilinebooleanfalseRender an auto-growing textarea
rowsnumber2Visible lines when multiline
allow-autofill-extensionsbooleanfalseLet password-manager extensions decorate the input
#startAdornment / #endAdornmentslots—Content before or after the input (camelCase slot names). A start adornment is always shown and keeps the label floated
@clear() => void—Shows the clear button and fires when it is clicked; focus returns to the input
@revealed-change(revealed: boolean) => void—Fires when the reveal toggle is clicked
@autofill() => void—Fires when the browser autofills the input

Other attributes and listeners are forwarded to the <input> (or to the <textarea> with multiline).

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)