Skip to content

useSelect ​

Provides a makeSelectProps factory defining the standard prop set for select-type inputs — items, value/title keys, multiple selection, and object return behavior.

File: vue/src/js/hooks/utils/useSelect.js


Props Factory ​

js
import { makeSelectProps } from '@/hooks/utils/useSelect'
PropTypeDefaultDescription
itemValueString'id'The item property used as the option value
itemTitleString'name'The item property used as the option label
multipleBooleanfalseAllow multiple selections
itemsArray[]The list of selectable options
returnObjectBooleanfalseWhen true, emit the full object instead of just itemValue
objectIdDefinerString—Property that uniquely identifies an object when returnObject is true
convertObjectBooleanfalseAuto-convert object values to ID values on emit
objectModelValuesArray['*']Which object properties to include when convertObject is true. ['*'] means all.
maxNumbernullMaximum number of selectable items (for multiple mode)

Usage ​

js
import useSelect, { makeSelectProps } from '@/hooks/utils/useSelect'

const props = defineProps({
  ...makeSelectProps(),
  // additional props
})

useSelect(props, context)

Notes ​

  • makeSelectProps is used by all select-type input components (InputSelect, InputSelectScroll, etc.) to share a consistent prop API.
  • returnObject / convertObject / objectModelValues control the shape of emitted values when options are objects — allowing fine-grained control over what gets stored in the form model.

See Also ​

  • useInputFetch — remote data loading for select inputs
  • useInput — base input composable used alongside useSelect