Calendar

用于选择单个日期、日期范围或多个日期的月历网格,支持 WAI-ARIA 日期网格按键、最小和最大日期、禁用日期以及 Intl 月份名称。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 可用

用法

June 2026
Sun Mon Tue Wed Thu Fri Sat
June 2026
Mon Tue Wed Thu Fri Sat Sun

导入

ts
import {
  SoneCalendarComponent,
} from "@surface-one/angular/calendar";

API 参考

SoneCalendarComponent组件

`<sone-calendar>` — a month grid to pick a date, a range or several dates (spartan/ui and shadcn/ui Calendar). The grid follows the WAI-ARIA date picker pattern: one Tab stop, the arrow keys move a day or a week, Home / End to the week's ends, PageUp / PageDown a month and, with Shift, a year; Enter or Space picks. Dates are ISO strings ("YYYY-MM-DD"); month and weekday names come from `Intl` in `locale`.

选择器
sone-calendar
输入
名称类型 默认值
mode

What a pick does: take one date, close a range, or toggle a date of a list.

SoneCalendarMode"single"
value双向

The picked date(s) — `[(value)]`: "YYYY-MM-DD" or `null` (`single`), a list (`multiple`) or `{ start, end }` (`range`).

SoneCalendarValuenull
month双向

The month shown, "YYYY-MM" — `[(month)]`. Default: the picked date's, else today's.

string | nullnull
min

The earliest and latest date that can be picked ("YYYY-MM-DD").

string | nullnull
maxstring | nullnull
disabledDate

Refuses more dates: `(iso) => true` disables that day.

((iso: string) => boolean) | nullnull
weekStartsOn

The first day of the week: 0 = Sunday (the default) … 6 = Saturday.

SoneWeekday0
locale

A BCP 47 tag for the month and weekday names (default: the app's `LOCALE_ID`).

string | nullnull
today

Today, "YYYY-MM-DD". Default: the browser's date, read after the first render so a prerendered page hydrates without a mismatch.

string | nullnull
showOutsideDays

Shows the neighbour months' days that pad the first and last week.

booleantrue
disabledbooleanfalse
ariaLabel

Names the grid; by default the month caption does.

string | nullnull
autofocusDay

Marks the grid's Tab stop `data-autofocus` (a popover focuses it on open).

booleanfalse
previousMonthLabel—$localize`:Calendar previous month button:Previous month`
nextMonthLabel—$localize`:Calendar next month button:Next month`
输出
名称类型
dateSelect

Fires on every pick, with the day picked.

string