Skip to content

PrimeListbox

A FormKit wrapper for PrimeVue's Listbox component.

Live Example on Website

Usage

vue
<FormKit type="primelistbox" :options="options" option-label="label" option-value="value" v-model="selected" />

Object-based Example

vue
<script setup>
const options = [
  { label: 'Every page load', value: 'refresh' },
  { label: 'Every hour', value: 'hourly' },
  { label: 'Every day', value: 'daily' },
]
const schema = [
  { $formkit: 'primeListbox', name: 'cookie_notice', label: 'Cookie notice', value: 'hourly', optionLabel: 'label', optionValue: 'value', options, help: 'Cookie notice frequency ?' },
  { $formkit: 'primeListbox', name: 'styled', label: 'Styled and Diabled', value: 'hourly', style: { background: 'gray' }, class: 'customClass', optionLabel: 'label', optionValue: 'value', options, disabled: true },
  { $formkit: 'primeListbox', name: 'custom', label: 'With Multiple Select and Filter', multiple: true, filter: true, placeholder: 'Please select', optionLabel: 'label', optionValue: 'value', options, validation: 'required' },
]
const data = {}
</script>

<template>
  <FormKit :schema="schema" :data="data" />
</template>

Props

NameTypeDescription
ptobjectPass-through options
ptOptionsobjectPass-through options
unstyledbooleanDisable default styles
optionsarrayList of options
optionLabelstringField for label
optionValuestringField for value
multiplebooleanEnable multiple selection
filterbooleanEnable filtering
filterIconstringIcon for filter
filterPlaceholderstringPlaceholder for filter
filterLocalestringLocale for filter
filterMatchModestringFilter match mode
autoOptionFocusbooleanAuto focus option
selectOnFocusbooleanSelect on focus

See PrimeVue Listbox docs for more details.

FormKit PrimeVue Module