Components/Select
Since 1.0.0BETA

Select

Popover-backed select with optional local filtering, editable remote search, and panel styling controls.

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

Select

TuffSelect renders a Popover-backed dropdown for primitive string/number values. Options register their labels through TuffSelectItem, disabled options stay visible but cannot be selected, and remote editable mode emits search queries from the trigger input.

Basic Usage

Select

Demo will load when visible.
<template>
  <TuffSelect v-model="value" placeholder="Select an option">
    <TuffSelectItem value="option1" label="Option 1" />
    <TuffSelectItem value="option2" label="Option 2" />
    <TuffSelectItem value="option3" label="Option 3" />
  </TuffSelect>
</template>

Remote Search (Editable)

Select (remote searchable)

Demo will load when visible.
<script setup lang="ts">
import { ref } from 'vue'

const value = ref('')
const remoteOptions = ref<Array<{ value: string; label: string }>>([])

async function onSearch(q: string) {
  // remote request
  // remoteOptions.value = await fetch(...)
}
</script>

<template>
  <TuffSelect v-model="value" remote editable @search="onSearch">
    <TuffSelectItem v-for="o in remoteOptions" :key="o.value" :value="o.value" :label="o.label" />
  </TuffSelect>
</template>

Searchable

Select (searchable)

Demo will load when visible.
<template>
  <TuffSelect v-model="value" placeholder="Searchable" searchable>
    <TuffSelectItem v-for="i in 30" :key="i" :value="`option${i}`" :label="`Option ${i}`" />
  </TuffSelect>
</template>

Disabled State

Select (disabled)

Demo will load when visible.
<template>
  <TuffSelect v-model="value" placeholder="Disabled state" disabled>
    <TuffSelectItem value="option1" label="Option 1" />
  </TuffSelect>
</template>

Disabled Options

Select (disabled option)

Demo will load when visible.
<template>
  <TuffSelect v-model="value" placeholder="Select an option">
    <TuffSelectItem value="option1" label="Option 1" />
    <TuffSelectItem value="option2" label="DisabledOption" disabled />
    <TuffSelectItem value="option3" label="Option 2" />
  </TuffSelect>
</template>

Scroll Panel

Select (scrollable dropdown)

Demo will load when visible.
<template>
  <TuffSelect v-model="value" :dropdown-max-height="220">
    <TuffSelectItem v-for="i in 30" :key="i" :value="`option${i}`" :label="`Option ${i}`" />
  </TuffSelect>
</template>

API

TuffSelect Props

PropDescriptionTypeDefault
modelValue / v-modelSelected primitive value.string | number''
placeholderPlaceholder shown in the trigger input when no label is selected.string'请选择'
disabledDisables the trigger, closes the dropdown, and blocks option selection.booleanfalse
eagerEagerly mounts the Popover panel.booleanfalse
searchableShows an internal search input for local option filtering when the select is not editable.booleanfalse
searchPlaceholderPlaceholder for the internal local search input.string'Search'
editableUses the trigger input as editable search text and opens on focus.booleanfalse
remoteEnables editable remote mode and emits search while the dropdown is open.booleanfalse
dropdownMaxHeightMaximum dropdown list height in pixels.number280
dropdownOffsetPopover offset from the trigger.number6
panelVariantPopover panel surface variant.'solid' | 'dashed' | 'plain''solid'
panelBackgroundPopover panel background style.'pure' | 'mask' | 'blur' | 'glass' | 'refraction''refraction'
panelShadowPopover panel shadow strength.'none' | 'soft' | 'medium''soft'
panelRadiusPopover panel corner radius.number18
panelPaddingPopover panel inner padding.number4
panelCardOptional panel card overrides forwarded to the Popover panel.BaseAnchorPanelCardProps-

TuffSelect Events

EventDescriptionParams
changeEmitted with the selected value after an enabled option is picked or the value is cleared.(value: string | number) => void
update:modelValuev-model update emitted with the selected value or empty string on clear.(value: string | number) => void
searchEmitted in remote mode while the dropdown is open and editable text changes.(query: string) => void

TuffSelectItem Props

PropDescriptionTypeDefault
valuePrimitive option value written to the parent select when picked.string | number-
labelFallback visible label and registered selected-label text.string-
disabledPrevents picking this option while leaving it visible in the dropdown.booleanfalse