Form components

Inputs, selects, switches and form helpers.

AdminLTE Vue ships a small set of form controls that wrap Bootstrap 5.3 markup with v-model support, optional labels, validation feedback and consistent sizing. The components are LteInput, LteSelect, LteTextarea, LteInputSwitch and LteButton. Every control forwards unknown attributes to the underlying element, so native attributes like name, autocomplete or maxlength work as expected.

LteInput

A labelled text input that supports input-group prepend/append addons and inline validation.

<script setup lang="ts">
import { ref } from 'vue'

const email = ref('')
const amount = ref('')
</script>

<template>
  <LteInput v-model="email" label="Email" type="email" placeholder="[email protected]" required />

  <LteInput
    v-model="amount"
    label="Amount"
    prepend="$"
    append=".00"
    group-size="lg"
  />

  <LteInput v-model="email" label="Email" error="This field is required." />
</template>

When prepend, append or error is set, the input is wrapped in a Bootstrap input-group. The error string renders as .invalid-feedback and applies is-invalid to the field. The default slot renders below the field (useful for help text).

Props

NameTypeDefaultDescription
modelValuestring | numberBound value (v-model).
labelstringLabel text rendered above the input.
typestring'text'Native input type.
idstringautoInput id; auto-generated via useId() when omitted.
placeholderstringPlaceholder text.
errorstringValidation message; adds is-invalid and renders feedback.
fgroupClassstringExtra classes on the wrapping .mb-3 div.
groupSize'sm' | 'lg'Sizing for the input-group (only when an addon/error is present).
prependstringText addon before the input.
appendstringText addon after the input.
disabledbooleanfalseDisables the input.
requiredbooleanfalseMarks the input as required.

Emits

NamePayloadDescription
update:modelValuestringFired on input for v-model.

Slots

NameDescription
defaultRendered below the field, inside the wrapper.

LteSelect

A labelled form-select supporting single or multiple selection. Options can come from the options prop or the default slot.

<script setup lang="ts">
import { ref } from 'vue'

const country = ref('us')
const tags = ref<string[]>([])

const countries = [
  { value: 'us', label: 'United States' },
  { value: 'lv', label: 'Latvia' },
]
</script>

<template>
  <LteSelect v-model="country" label="Country" :options="countries" />

  <LteSelect v-model="tags" label="Tags" multiple :options="countries" />

  <!-- Custom options via the default slot -->
  <LteSelect v-model="country" label="Country">
    <option value="us">United States</option>
    <option value="lv">Latvia</option>
  </LteSelect>
</template>

With multiple, modelValue is an array of the selected option values.

Props

NameTypeDefaultDescription
modelValuestring | number | Array<string | number>Bound value (v-model). Array when multiple.
labelstringLabel text rendered above the select.
idstringautoSelect id; auto-generated when omitted.
options{ value: string | number; label: string }[][]Options to render when the slot is empty.
errorstringValidation message; adds is-invalid and renders feedback.
fgroupClassstringExtra classes on the wrapping .mb-3 div.
multiplebooleanfalseEnables multi-select; emits an array value.
disabledbooleanfalseDisables the select.

Emits

NamePayloadDescription
update:modelValuestring | number | Array<string | number>Fired on change; array when multiple.

Slots

NameDescription
defaultReplaces the auto-rendered <option> list.

LteTextarea

A labelled multi-line text control.

<script setup lang="ts">
import { ref } from 'vue'

const bio = ref('')
</script>

<template>
  <LteTextarea v-model="bio" label="Bio" :rows="6" placeholder="Tell us about yourself" />
</template>

Props

NameTypeDefaultDescription
modelValuestringBound value (v-model).
labelstringLabel text rendered above the textarea.
idstringautoTextarea id; auto-generated when omitted.
rowsnumber4Number of visible text rows.
placeholderstringPlaceholder text.
errorstringValidation message; adds is-invalid and renders feedback.
fgroupClassstringExtra classes on the wrapping .mb-3 div.
disabledbooleanfalseDisables the textarea.

Emits

NamePayloadDescription
update:modelValuestringFired on input for v-model.

LteInputSwitch

A Bootstrap switch (form-switch) bound to a boolean.

<script setup lang="ts">
import { ref } from 'vue'

const notifications = ref(true)
</script>

<template>
  <LteInputSwitch v-model="notifications" label="Email notifications" />
</template>

Props

NameTypeDefaultDescription
modelValuebooleanChecked state (v-model).
labelstringLabel text rendered beside the switch.
idstringautoInput id; auto-generated when omitted.
themeBootstrapThemeBootstrap color variant.
disabledbooleanfalseDisables the switch.

Emits

NamePayloadDescription
update:modelValuebooleanFired on change with the new checked state.

LteButton

A themed Bootstrap button with optional icon and block layout.

<template>
  <LteButton theme="primary" label="Save" />
  <LteButton theme="danger" outline icon="trash" label="Delete" />
  <LteButton type="submit" theme="success" size="lg" block>
    Submit
  </LteButton>
</template>

The icon value is passed through the biClass() helper (Bootstrap Icons). When a label or default slot is present, the icon gets a trailing me-1 margin. The default slot overrides the label prop.

Props

NameTypeDefaultDescription
type'button' | 'submit' | 'reset''button'Native button type.
themeBootstrapTheme'primary'Bootstrap color variant.
outlinebooleanfalseRenders the outline (btn-outline-*) style.
size'sm' | 'lg'Button size.
iconstringBootstrap Icon name, resolved via biClass().
labelstringButton text (overridden by the default slot).
blockbooleanfalseFull-width button (w-100).

Slots

NameDescription
defaultButton content; overrides label.