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
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
Password input
Phone input
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.
API
FloatingLabelInput
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Label text for the floating label |
value / v-model:value | string | — | Controlled value; `update:value` fires on input |
default-value | string | — | Initial value when uncontrolled |
error-message | string | — | Error message to display below the input |
invalid | boolean | false (true if error-message) | Mark the input as invalid |
description | string | slot | — | Helper text below the input |
disabled | boolean | false | Disables the input |
read-only / readonly | boolean | false | Makes the input read-only (both spellings work) |
type | string | "text" | Input type; password gets a reveal toggle |
revealable | boolean | true for password without an end adornment | Built-in reveal toggle |
multiline | boolean | false | Render an auto-growing textarea |
rows | number | 2 | Visible 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 |
pill | boolean | true | Pill shape; false takes the rounded box of the other fields |
allow-autofill-extensions | boolean | false | Let password-manager extensions decorate the input |
#startAdornment / #endAdornment | slots | — | 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.
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | — | Label text for the floating label |
selected | boolean | false | Whether a value is selected: floats the label and shows the default slot |
open | boolean | false | Whether the attached list is open |
error-message | string | — | Error message to display below the field |
invalid | boolean | false (true if error-message) | Mark the field as invalid |
disabled | boolean | false | Disables 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 |
pill | boolean | true | Pill 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 (defaultvar(--color-text-danger-outline))--field-error-font-size: error font size (default0.75rem)--field-error-line-height: error line height (defaultvar(--font-text-xs-line-height))--field-error-margin-top: error margin top (default0.5rem)--floating-input-background: background (defaultvar(--color-surface))--floating-input-border-color: border color--floating-input-border-color-focus: border color focus (defaultvar(--alpha-50))--floating-input-border-color-hover: border color hover--floating-input-border-color-invalid: border color invalid (defaultvar(--color-border-danger-outline))--floating-input-border-radius: border radius (defaultvar(--radius-full))--floating-input-box-gutter: gutter of the rounded box (defaultvar(--control-gutter-lg))--floating-input-box-radius: radius of the rounded box (defaultvar(--control-radius-xl))--floating-input-font-size: value and resting label size (default1rem)--floating-input-gutter: gutter (default1.25rem)--floating-input-height: height (default3.25rem)--floating-input-inside-height: height with the label inside (default3.5rem)--floating-input-inside-label-color: label color with the label inside (defaultvar(--color-text-secondary))--floating-input-inside-label-scale: label scale with the label inside (default0.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 (default1.25rem)--floating-input-inside-value-shift: how far the value drops under the label (default1rem)--floating-input-label-color: label color (defaultvar(--color-text-tertiary))--floating-input-label-color-focus: label color focus (defaultvar(--color-text))--floating-input-label-color-invalid: label color invalid (defaultvar(--color-text-danger-outline))--floating-input-label-scale: label scale (default0.88)--floating-input-transition-duration: transition duration (default80ms)