Skip to content

Picker

A bottom-sheet wheel picker component that supports single-column, multi-column, and cascade modes. Options are selected via touch scrolling with inertia and snap effects. Commonly used in forms for option selection scenarios.

Platform Differences

App (vue)App (nvue)H5Mini Program

Basic Usage

  • In single-column mode, pass a one-dimensional array to columns. Bind the selected value using v-model.
html
<see-picker v-model="value" :columns="columns" />

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

const value = ref('')
const columns = [
  { text: 'Hangzhou', value: 'hangzhou' },
  { text: 'Ningbo', value: 'ningbo' },
  { text: 'Wenzhou', value: 'wenzhou' },
  { text: 'Jiaxing', value: 'jiaxing' }
]
</script>

Multiple Columns

  • In multi-column mode, pass a two-dimensional array to columns. Each column scrolls independently.
html
<see-picker v-model="value" :columns="columns" />

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

const value = ref<string[]>(['2024', '06'])
const columns = [
  [
    { text: '2023', value: '2023' },
    { text: '2024', value: '2024' },
    { text: '2025', value: '2025' }
  ],
  [
    { text: '01', value: '01' },
    { text: '02', value: '02' },
    { text: '03', value: '03' },
    { text: '04', value: '04' },
    { text: '05', value: '05' },
    { text: '06', value: '06' }
  ]
]
</script>

Cascade Selection

  • Set isCascade to true to enable cascade mode. Define child data through the children field.
  • When a column is selected, the column to its right automatically updates with the corresponding child options.
html
<see-picker v-model="value" :columns="columns" isCascade />

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

const value = ref<string[]>([])
const columns = [
  {
    text: 'Zhejiang',
    value: 'zhejiang',
    children: [
      {
        text: 'Hangzhou',
        value: 'hangzhou',
        children: [
          { text: 'Xihu District', value: 'xihu' },
          { text: 'Yuhang District', value: 'yuhang' }
        ]
      },
      {
        text: 'Ningbo',
        value: 'ningbo',
        children: [
          { text: 'Haishu District', value: 'haishu' },
          { text: 'Yinzhou District', value: 'yinzhou' }
        ]
      }
    ]
  },
  {
    text: 'Jiangsu',
    value: 'jiangsu',
    children: [
      {
        text: 'Nanjing',
        value: 'nanjing',
        children: [
          { text: 'Xuanwu District', value: 'xuanwu' },
          { text: 'Gulou District', value: 'gulou' }
        ]
      }
    ]
  }
]
</script>

Custom Configuration

  • Set the title via toolbarTitle.
  • Customize button text via confirmText and cancelText.
  • Control the number of visible options via visibleItemCount.
html
<see-picker
  v-model="value"
  :columns="columns"
  toolbarTitle="Select City"
  confirmText="Confirm"
  cancelText="Close"
  :visibleItemCount="7"
/>

Disabled Options

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

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

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

API

Props

ParameterDescriptionTypeDefault
modelValueBound value (v-model)string | number | (string|number)[]''
columnsOption dataPickerColumn[][]
placeholderPlaceholder textstring'Please select'
isDisabledWhether disabledbooleanfalse
isReadonlyWhether readonlybooleanfalse
isShowToolbarWhether to show the top toolbarbooleantrue
toolbarTitleToolbar titlestring''
confirmTextConfirm button textstring'Confirm'
cancelTextCancel button textstring'Cancel'
isCascadeWhether cascade mode is enabledbooleanfalse
valueKeyKey name for valuestring'value'
labelKeyKey name for labelstring'text'
childrenKeyKey name for childrenstring'children'
sizeSize'small' | 'default' | 'large''default'
isBorderWhether to show borderbooleantrue
nameForm field namestring''
visibleItemCountNumber of visible optionsnumber5
isAsyncWhether async loading is enabledbooleanfalse

PickerOption Type Definition:

FieldDescriptionTypeRequired
textDisplay textstringYes
valueOption valuestring | numberYes
disabledWhether disabledbooleanNo
childrenSub-options (for cascade mode)PickerOption[]No

Events

EventDescriptionCallback Parameters
onChangeTriggered when the selected value changesvalue: string | number | (string|number)[], index: number
onConfirmTriggered when the confirm button is clickedvalue: string | number | (string|number)[]
onCancelTriggered when the cancel button or overlay is clicked-
onColumnChangeTriggered when a column changes (in cascade mode when switching columns)index: number

Expose

MethodDescriptionParameters
openOpen the picker-
closeClose the picker-
getValueGet the current selected value-

Liao ICP No. 2025070134