DatePicker 日期选择器
用于在表单、筛选器和报表参数中选择日期或日期范围。
变体
尺寸
禁用状态
只读
只读状态允许打开和浏览面板,但不能修改或清空当前值。
范围选择
范围组件通过 DatePicker.Range 使用;其公开属性类型为 DateRangePickerProps。
约束
预设
自定义触发器
API
DatePicker Props
继承自
DatePickerBaseProps
| 属性名 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| value | 受控日期值 | Date | null | - |
| defaultValue | 默认日期值 | Date | null | - |
| onChange | 日期提交时触发 | (value: Date | null) => void | - |
| presets | 预设日期列表 | Array<DatePickerPreset<Date | null>> | - |
DatePicker.Range Props
继承自
Omit<DatePickerBaseProps, 'defaultValue' | 'onChange' | 'placeholder' | 'value'>
| 属性名 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| value | 受控范围值 | readonly [Date, Date] | null | - |
| defaultValue | 默认范围值 | readonly [Date, Date] | null | - |
| onChange | 范围提交时触发 | (value: readonly [Date, Date] | null) => void | - |
| placeholder | 触发器占位内容 | string | [string, string] | - |
| presets | 预设范围列表 | Array<DatePickerPreset<readonly [Date, Date] | null>> | - |
DatePicker.Trigger Props
继承自
HTMLAttributes<HTMLElement>
| 属性名 | 描述 | 类型 | 默认值 |
|---|---|---|---|
| children | 自定义触发节点 | ReactElement<any, string | JSXElementConstructor<any>> | - |