月份选择器
支持选择月份与年份的日期选择组件。
使用方式
import { MonthDatepicker } from "@chaos-design/month-datepicker";在 shadcn/ui 中使用
- 安装依赖
npm install @chaos-design/month-datepicker- 在组件中使用
import { MonthDatepicker } from "@chaos-design/month-datepicker";
export default function Demo() {
return <MonthDatepicker />;
}Props
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| className | string | - | 自定义类名。 |
| classNames | MonthDatepickerClassNames | - | 内部组件自定义类名。 |
| currentDate | Date | - | 当前选中日期。 |
| onMonthSelect | (date: Date) => void | - | 月份选择回调。 |
| locale | Locale | - | 日期语言包 (from date-fns)。 |
MonthDatepickerClassNames
| 属性 | 类型 | 说明 |
|---|---|---|
| header | string | 头部区域。 |
| monthGrid | string | 月份网格容器。 |
| monthButton | string | 月份按钮。 |
| yearGrid | string | 年份网格容器。 |
| yearButton | string | 年份按钮。 |