Skip to content

Select

A dropdown selector component that supports single selection, multiple selection, search filtering, remote search, and grouped options. Built on a popup dropdown panel, options support both flat list and tree-grouped structures.

Platform Differences

App (vue)App (nvue)H5Mini Program

Basic Usage

  • Set the option list via options, and bind the selected value using v-model.
html
<see-select v-model="value" :options="options" />

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

const value = ref('')
const options = [
  { label: 'Option One', value: '1' },
  { label: 'Option Two', value: '2' },
  { label: 'Option Three', value: '3' }
]
</script>

Multiple Selection

  • Set isMultiple to true to enable multiple selection mode. modelValue should be bound to an array type.
  • Control the maximum number of displayed tags via maxTagCount; overflow will be shown as +N.
html
<see-select v-model="value" :options="options" isMultiple />
<see-select v-model="value" :options="options" isMultiple :maxTagCount="2" />

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

const value = ref<string[]>([])
const options = [
  { label: 'Option One', value: '1' },
  { label: 'Option Two', value: '2' },
  { label: 'Option Three', value: '3' }
]
</script>

Search Filter

  • Set isFilterable to true to enable local search filtering.
  • You can customize the filtering logic via filterMethod.
html
<see-select v-model="value" :options="options" isFilterable />

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

const value = ref('')
const options = [
  { label: 'Beijing', value: 'beijing' },
  { label: 'Shanghai', value: 'shanghai' },
  { label: 'Guangzhou', value: 'guangzhou' },
  { label: 'Shenzhen', value: 'shenzhen' }
]
</script>
  • Set isRemote to true to enable remote search, and pass a search callback via remoteMethod.
  • The search input includes a built-in 300ms debounce.
  • Set loading to true to display a loading state.
html
<see-select
  v-model="value"
  :options="options"
  isFilterable
  isRemote
  :remoteMethod="onSearch"
  :loading="loading"
/>

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

const value = ref('')
const options = ref([])
const loading = ref(false)

function onSearch(query: string) {
  loading.value = true
  // Simulate remote request
  setTimeout(() => {
    options.value = [
      { label: `${query}-Result One`, value: `${query}-1` },
      { label: `${query}-Result Two`, value: `${query}-2` }
    ]
    loading.value = false
  }, 500)
}
</script>

Grouped Options

  • Use the children field in options to nest sub-options for grouped display.
html
<see-select v-model="value" :options="options" />

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

const value = ref('')
const options = [
  {
    label: 'East China',
    value: 'east',
    children: [
      { label: 'Shanghai', value: 'shanghai' },
      { label: 'Hangzhou', value: 'hangzhou' }
    ]
  },
  {
    label: 'South China',
    value: 'south',
    children: [
      { label: 'Guangzhou', value: 'guangzhou' },
      { label: 'Shenzhen', value: 'shenzhen' }
    ]
  }
]
</script>

Disabled Options

  • Set isDisabled to true in the option data to disable a single option.
  • Set isDisabled on the component to disable the entire selector.
html
<see-select v-model="value" :options="options" />
<see-select v-model="value" :options="options" isDisabled />

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

const value = ref('')
const options = [
  { label: 'Option One', value: '1' },
  { label: 'Option Two (Disabled)', value: '2', isDisabled: true },
  { label: 'Option Three', value: '3' }
]
</script>

Clearable

  • Set isClearable to true. After a value is selected, a clear button will appear on hover.
html
<see-select v-model="value" :options="options" isClearable />

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

const value = ref('1')
const options = [
  { label: 'Option One', value: '1' },
  { label: 'Option Two', value: '2' },
  { label: 'Option Three', value: '3' }
]
</script>

Sizes

  • Set the selector size via size. Supports small, default, and large.
html
<see-select v-model="value" :options="options" size="small" />
<see-select v-model="value" :options="options" />
<see-select v-model="value" :options="options" size="large" />

API

Props

ParameterDescriptionTypeDefault
modelValueBound value (v-model)string | number | (string|number)[][]
optionsOption listSelectOption[][]
placeholderPlaceholder textstring'Please select'
isDisabledWhether disabledbooleanfalse
isReadonlyWhether readonlybooleanfalse
isClearableWhether clearablebooleanfalse
isMultipleWhether multiple selection is enabledbooleanfalse
isFilterableWhether searchablebooleanfalse
filterMethodCustom filter method(query: string, option: SelectOption) => boolean-
isRemoteWhether remote search is enabledbooleanfalse
remoteMethodRemote search method(query: string) => void-
loadingWhether loadingbooleanfalse
sizeSize'small' | 'default' | 'large''default'
maxTagCountMaximum number of tags displayed in multiple modenumber-
isBorderWhether to show borderbooleantrue
nameForm field namestring''
valueKeyKey name for option valuestring'value'
labelKeyKey name for option labelstring'label'

SelectOption Type Definition:

FieldDescriptionTypeRequired
labelDisplay textstringYes
valueOption valuestring | numberYes
isDisabledWhether disabledbooleanNo
childrenSub-options (for grouping)SelectOption[]No

Events

EventDescriptionCallback Parameters
onChangeTriggered when the value changesvalue: string | number | (string|number)[]
onVisibleChangeTriggered when the dropdown visibility changesvisible: boolean
onRemoveTagTriggered when a tag is removed in multiple modevalue: string | number
onClearTriggered when cleared-
onSearchTriggered on search inputquery: string

Slots

Slot NameDescriptionScoped Parameters
defaultCustom option content (scoped slot){ option: SelectOption }
prefixPrefix content in the trigger area-
emptyContent displayed when the option list is empty-

Expose

MethodDescriptionParameters
openOpen the dropdown-
closeClose the dropdown-
clearClear the selected value-

Liao ICP No. 2025070134