Label

Label is a component used to provide a name or title for form elements. It supports both standard and floating label styles for enhanced form usability.

Label pairs with the Input component. See the Input examples.

Basic Usage

Code Example
Basic.vue

Label

The Label component provides a name or title for form elements. It supports both standard and floating label styles for enhanced form usability.

Label Props Type Description
is
string

Allows changing the element tag. Default is label.

floating
boolean

When true, applies the floating label style. This creates a label that floats above the input when it has content or is focused.

input
boolean

When true, styles the label with input-like classes (for input groups, etc). If an Input component is nested inside, it will automatically remove its own input styling to avoid duplication.

select
boolean

When true, styles the label with select-like classes (for select groups, etc). If a Select component is nested inside, it will automatically remove its own select styling to avoid duplication.

toggle
boolean

When true, styles the label for use with a Toggle component. Applies toggle-related classes and color logic.

Props below only apply if input , select , or toggle is set.
join
boolean

When true and input, select, or toggle is set, applies the join-item class for grouping with other controls.

color
string

Sets the color style. Accepts neutral, primary, secondary, accent, info, success, warning, or error.

   
neutral
boolean

Sets the color to neutral (applies to input, select, or toggle styles).

   
primary
boolean

Sets the color to primary.

   
secondary
boolean

Sets the color to secondary.

   
accent
boolean

Sets the color to accent.

   
info
boolean

Sets the color to info.

   
success
boolean

Sets the color to success.

   
warning
boolean

Sets the color to warning.

   
error
boolean

Sets the color to error.

ghost
boolean

Applies the ghost (transparent) style. Used with input, select, or toggle.

size
string

Sets the size of the label and associated control. Accepts xl, lg, md, sm, or xs.

   
xl
boolean

Sets size to xl.

   
lg
boolean

Sets size to lg.

   
md
boolean

Sets size to md.

   
sm
boolean

Sets size to sm.

   
xs
boolean

Sets size to xs.

Label Slots Description
default

The default slot. Place the label text and associated form element here. If using with input/select/toggle, place the form element inside the slot as well.

Examples

Label as Date Input

A label with a text span and a date input.

Code Example
LabelAsDateInput.vue

Label as Text Input with Floating Label

A floating label for an input.

Code Example
LabelAsTextInputWithFloatingLabel.vue

Floating Label with Side Button

Floating labels cannot have content inside them. Use a Join component instead.

Code Example
FloatingLabelWithSideButton.vue

Floating Label Sizes

Floating labels with different input sizes.

Code Example
FloatingLabelSizes.vue

Label as an Input with Text After

A label with an input at the end.

Code Example
LabelAsInputWithTextAfter.vue

Label as Input with Text Before

A label with text and an input.

Code Example
LabelAsInputWithTextBefore.vue

Label as Toggle with Custom Icons

A label styled to look like a toggle.

Note: You may need to custom size the icons to center them. See the next example.

Code Example
LabelAsToggleWithCustomIcons.vue

Label as XL Toggle with Custom Icons

A label styled to look like a toggle with custom icons and xl size. This example sets a custom size on the icons to properly position them in the center of the toggle circle.

Code Example
LabelAsXlToggleWithCustomIcons.vue