1.1.1 • Published 9 months ago
@component-hook/picker v1.1.1
@component-hook/picker
Picker component with vue3 and react.
Features
- Supports
single-columnandcascadepicker - Scroll wheel 3D effect for smooth selection
- Customize
title,confirmandcancelbuttons - Flexible column structure for different use cases
- Built-in
DatePickerandTimePickercomponents - Full TypeScript support
Documentation
For detailed documentation and usage examples, please visit: Official Docs.
Installation
# Using npm
$ npm install @component-hook/picker
# Using yarn
$ yarn add @component-hook/picker
# Using pnpm
$ pnpm install @component-hook/pickerBase Usage
Vue3
<script setup lang="ts">
import { Picker } from '@component-hook/picker/vue';
import { ref } from 'vue';
const isShowPicker = ref(false);
const pickerValues = ref<number[]>([]);
const columns = Array.from({ length: 50 }, (_, index) => ({ label: index, value: index }));
function onConfirm(value: number[]) {
pickerValues.value = value;
}
function onCancel() {
console.log('cancel');
}
</script>
<template>
<picker
v-model:show="isShowPicker"
:columns="columns"
title="Base Selector"
@confirm="onConfirm"
@cancel="onCancel"
/>
<button @click="isShowPicker = true">toggle Base picker</button>
<p class="mt-6 text-sm font-mono">Selected value: {{ pickerValues.join('') || 'not selected yet' }}</p>
</template>React
import { Picker } from '@component-hook/picker/react';
import { useState } from 'react';
const columns = Array.from({ length: 50 }, (_, index) => ({ label: index, value: index }));
export function BasePicker() {
const [showPicker, setShowPicker] = useState(false);
const [pickerValues, setPickerValues] = useState<number[]>([]);
function onConfirm(values: number[]) {
setPickerValues(values);
}
return (
<>
<Picker
show={showPicker}
columns={columns}
title="Base Selector"
onClose={() => setShowPicker(false)}
onConfirm={onConfirm}
onCancel={onCancel}
/>
<button onClick={() => setShowPicker(true)}>toggle Base picker</button>
<p>Selected value: {pickerValues.join('') || 'not selected yet'}</p>
</>
);
}
function onCancel() {
console.log('cancel');
}License
This project is licensed under the MIT License.
1.1.1
9 months ago
1.0.2
10 months ago
1.1.0
9 months ago
1.0.1
12 months ago
1.0.0
12 months ago
0.2.4-alpha.0
1 year ago
1.0.4
10 months ago
1.0.3
10 months ago
0.2.0-alpha.0
1 year ago
1.0.1-alpha.0
12 months ago
1.0.0-alpha.1
12 months ago
1.0.0-alpha.0
12 months ago
1.0.2-alpha.0
10 months ago
1.0.2-alpha.1
10 months ago
0.2.1-alpha.0
1 year ago
0.2.1
1 year ago
0.2.0
1 year ago
0.2.3
1 year ago
0.2.2
1 year ago
0.2.5
1 year ago
0.2.4
1 year ago
0.1.6
1 year ago
0.1.5
1 year ago
0.1.4
1 year ago
0.1.3
1 year ago
0.1.2
1 year ago
0.1.2-alpha.1
2 years ago
0.1.2-alpha.0
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago