vue-3-better-picker is a mobile-first picker component designed specifically for Vue 3 applications. It is a maintained fork of the popular `openfe-openfe/vue-better-picker` library, adapted to leverage Vue 3's composition API and reactivity system. Currently at version 3.0.4, this package provides a clean and responsive UI for selecting values, typically seen in mobile environments. The library aims for stability and compatibility with modern Vue development practices, including `<script setup>`. While the original library supports Vue 2, `vue-3-better-picker` explicitly targets Vue 3, offering a dedicated branch for Vue 2 users. Its primary differentiator is its focus on a smooth mobile experience and robust integration into the Vue 3 ecosystem, making it a suitable choice for projects requiring interactive data selection on touch devices. Release cadence appears to be driven by maintenance and bug fixes for the Vue 3 specific implementation.
npm install vue-3-better-pickerVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to import and use the `BetterPicker` component, bind its visibility with `v-model`, provide data for multiple selection slots, and handle the `select` event to retrieve chosen values. It also shows a basic button to trigger the picker and display the selected items.
For Vue 2 projects, use the `vue2` branch of the s-sasaki-0529/vue-better-picker repository or the original `openfe-openfe/vue-better-picker`.
Ensure your `pickerData` adheres to `Array<{ value: string | number; text: string }>[]`. For example: `[[{ value: 'a', text: 'A' }], [{ value: 'b', text: 'B' }]]`.Use `v-model="showPicker"` for visibility and `@select="handleSelection"` to capture the chosen items in a separate method.
Add `import BetterPicker from 'vue-3-better-picker';` to your script and ensure it's available, especially when using options API or global registration. For `<script setup>`, ensure the import is present.
Verify that `pickerData` is an `Array<Array<{ value: string; text: string }>>` with correct object structures within each slot array.