---
order: 1.1
title:
zh-CN: 切换不同的选择器
en-US: Switchable picker
---
## zh-CN
提供选择器,自由切换不同类型的日期选择器,常用于日期筛选场合。
## en-US
Switch in different types of pickers by Select.
```tsx
import type { DatePickerProps, TimePickerProps } from 'antd';
import { DatePicker, Select, Space, TimePicker } from 'antd';
import React, { useState } from 'react';
const { Option } = Select;
type PickerType = 'time' | 'date';
const PickerWithType = ({
type,
onChange,
}: {
type: PickerType;
onChange: TimePickerProps['onChange'] | DatePickerProps['onChange'];
}) => {
if (type === 'time') return ;
if (type === 'date') return ;
return ;
};
const App: React.FC = () => {
const [type, setType] = useState('time');
return (
console.log(value)} />
);
};
export default App;
```