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";

On Phone a label does not float: iOS has no floating label. Each field is a cell of a FieldGroup on the grouped background, and its placeholder names it: an Input, a Textarea or a Select in a Field row hide-label, as the Settings Forms do. The label stays for screen readers, a description goes in the group's footer, and an error stands inside the cell. The Phone previews show those cells; the examples about the floating label itself (where it rests, the shape of the field) have no Phone view.

Examples

Overview

Types

Empty
Filled
Label on the border
Pill
Label on the border
Rounded box
Label inside
Rounded box

Label inside

Rounded box

Text fields

Everything that is typed: more than one line, a password, or a phone number. Values with a mask, such as an SSN or a birthday, are on the Input page: their mask works the same under a floating label.

Textarea

multiline

Password input

Phone input

+34

Selects

FloatingLabelSelect is the trigger of a Select, so a list reads like the fields around it.

Select

Multiple selection

Country select

States

Choose Empty or Filled to replace the value with a preset. The other controls preserve your text. Invalid and errorMessage demonstrate visual states, not email validation. An error message also marks the field invalid; when both messages are enabled, the error appears before the description. Read-only text can still be selected and copied. onClear shows a built-in clear button: it appears when the field has a value and is not disabled or read-only, and focus returns to the field. Listen to @clear, or bind :on-clear as here to switch it on and off.

On Phone the field is a cell named by its placeholder: the description goes in the group's footer and the error stands inside the cell. A cell has no frame to color, so invalid alone is desktop only.

preset

API

FloatingLabelInput

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
label-placement"border" | "inside""border"Where the label rests once it floats. inside keeps it in the box, with the value under it, and always takes the rounded box
pillbooleantruePill shape; false takes the rounded box of the other fields
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).

FloatingLabelSelect

The #trigger of a Select or Menu, or a field of your own. Its default slot is the selected value.

PropTypeDefaultDescription
labelstring—Label text for the floating label
selectedbooleanfalseWhether a value is selected: floats the label and shows the default slot
openbooleanfalseWhether the attached list is open
error-messagestring—Error message to display below the field
invalidbooleanfalse (true if error-message)Mark the field as invalid
disabledbooleanfalseDisables the field
label-placement"border" | "inside""border"Where the label rests once it floats. inside keeps it in the box, with the value under it, and always takes the rounded box
pillbooleantruePill shape; false takes the rounded box of the other fields
@clear-click() => void—Shows a clear button when a value is selected
@interact() => void—Fires on pointer down and on the keys that open the field. Without it those keys click the field, so a wrapping trigger opens

Other attributes and listeners go to the field, class to its root.

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-box-gutter: gutter of the rounded box (default var(--control-gutter-lg))
  • --floating-input-box-radius: radius of the rounded box (default var(--control-radius-xl))
  • --floating-input-font-size: value and resting label size (default 1rem)
  • --floating-input-gutter: gutter (default 1.25rem)
  • --floating-input-height: height (default 3.25rem)
  • --floating-input-inside-height: height with the label inside (default 3.5rem)
  • --floating-input-inside-label-color: label color with the label inside (default var(--color-text-secondary))
  • --floating-input-inside-label-scale: label scale with the label inside (default 0.75)
  • --floating-input-inside-label-shift: how far the label rises inside the box (default -0.75rem)
  • --floating-input-inside-line-height: line step of the textarea, and the distance from the label to the value (default 1.25rem)
  • --floating-input-inside-value-shift: how far the value drops under the label (default 1rem)
  • --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)