Search the documentation

Type to search page titles, component names and descriptions.

    Data Entry

    DatePicker

    Civil dates, ranges, local time and reporting periods.

    import { DatePresetPicker, DatePicker, DateRangePicker, DateTimePicker, TimePicker } from 'faifo-design'

    DatePicker, DateRangePicker, DateTimePicker and TimePicker submit civil dates and local wall time unchanged, and fall back to the native field without JavaScript. DatePresetPicker offers a fixed set of reporting periods resolved in the caller's business timezone.

    #When to use

    • Use DateRangePicker for one visible range; its two named boundaries remain the form contract.
    • Use DatePresetPicker on dashboards, where the period is one of a few named ranges.
    • Days are written and typed in the order of the reader's language.

    #Notes

    faifo-design/date-picker and faifo-design/date-picker/runtime are narrow entry points for hosts that need only the pickers.

    #Examples

    Each example is a specimen of the package catalogue, rendered on the server exactly as shown in its code.

    #Date pickers and local time

    Interactive calendars, seven quick ranges, draft selection and native civil-date submission. Open /dates for the focused playground.

    Khoảng ngày cố định · 04/10/2026
    Hôm nay
    2026-10-04 → 2026-10-04
    Hôm qua
    2026-10-03 → 2026-10-03
    7 ngày qua
    2026-09-28 → 2026-10-04
    Tuần này
    2026-09-28 → 2026-10-04
    Tuần trước
    2026-09-21 → 2026-09-27
    30 ngày qua
    2026-09-05 → 2026-10-04
    Tháng này
    2026-10-01 → 2026-10-31
    Tháng trước
    2026-09-01 → 2026-09-30
    90 ngày qua
    2026-07-07 → 2026-10-04
    Năm nay
    2026-01-01 → 2026-12-31
    Năm trước
    2025-01-01 → 2025-12-31
    30 ngày qua
    Chọn trên lịch hoặc nhập ngày trực tiếp.
    Type MM/DD/YYYY or pick a day on the calendar.
    Giới hạn ngày và trạng thái
    Chỉ nhận lịch từ 10 đến 20/09/2026.
    Vui lòng chọn ngày nghiệm thu.
    Show codeHide code
    import { DateTimePicker, Stack, TimePicker } from 'faifo-design'
    // DatePickerExamples: a catalogue fixture, packages/faifo-design/src/catalogue/date-pickers.tsx
    
    export const Example = () => (
      <Stack
        items={[
          <DatePickerExamples />,
          // DatePickerExamples already holds an `appointment` picker; ids stay unique on the page.
          <DateTimePicker id="visit" name="visit" label="Appointment" value="2026-09-08T14:30" />,
          <TimePicker id="cutoff" name="cutoff" label="Cut-off" value="17:00" />,
        ]}
      />
    )

    #Contract

    #Date pickers

    Enhanced asset controls can compose Field with control. Like every field, the frame puts the label above the control at every width, with help/errors below it; a native select keeps its decorative chevron on the control row. layout="inline" now only keeps a Switch beside its label in a toolbar; on any other field it changes nothing (26/11/2026). The public frame owns the label/control gap and uses the control's real native ID. Keep thumbnail geometry in the asset recipe; the Upload catalogue demonstrates the composition.

    Open /dates for the focused Vietnamese playground (states=1 expands validation/access examples), or the date-time specimen under /components/form-controls. DatePicker keeps its native date input as the submitted value and the fallback without JavaScript. A native date field writes the day in the browser's language whatever the page's lang, so the enhanced picker hides it (type="hidden", same name and ISO value) and shows the date-entry text field instead: the day is written and typed in the order of locale (en MM/DD/YYYY, vi dd/mm/yyyy, ja YYYY/MM/DD; ISO is also accepted). A typed day that is not a real day, or falls outside min/max/step, blocks the form with a message on that field; labels pointing at the native field move to it, and disposing the runtime restores them. DateRangePicker combines one read-only range display with a calendar icon inside the same frame as DatePicker. Two hidden boundaries retain the existing names and ISO values. The runtime enforces required, min/max and step; read-only, disabled, help and field errors remain supported. Submission stays YYYY-MM-DD. DateTimePicker and TimePicker retain their native local-time controls. Field.locale sets the calendar language (vi/en) when Field dispatches to a date or datetime picker. Compound datetime parts follow later disabled/read-only updates and dispose their observer with the field.

    Load /runtime/auto.js alongside the stylesheet, or call attachDesignSystemInteractions(root) from /runtime and dispose its returned cleanup when the root is removed. The runtime also enhances fields inserted later. Without JavaScript or the native Popover API, DatePicker retains its native input; DateRangePicker displays and submits its saved boundaries but cannot edit them.

    In CSR islands, DateRangePicker synchronizes its read-only display when the saved boundary attributes change, including Back/Forward and refreshed results. This does not emit another filter decision. Its shared runtime releases the observer when the picker is removed or disposed. Single-date CSR refreshes also synchronize the saved value without emitting an input/change decision. onInput, onChange and onBlur are native Field callbacks, shared by DatePicker. Focused consumers can import the public ./date-picker and ./date-picker/runtime exports instead of the complete component/runtime entry. Server views never read the clock or access the DOM.

    <DatePicker id="delivery" name="delivery" label="Ngày giao hàng" />
    <DateRangePicker
      id="period" label="Thời gian báo cáo"
      start={{ id: 'from', name: 'from' }} startLabel="Từ ngày"
      end={{ id: 'to', name: 'to' }} endLabel="Đến ngày"
    />

    The range calendar header select offers Hôm nay, Hôm qua, 7 ngày qua, Tháng này, Tháng trước, 30 ngày qua, and 90 ngày qua. Rolling ranges include today; month presets cover the entire calendar month. today="2026-09-30" supplies a business-timezone civil date; otherwise the browser reads local today on opening. presets={false} hides quick ranges, or pass an ordered subset of DateRangePreset IDs: today, yesterday, last7, thisMonth, lastMonth, last30, last90. Presets outside either input's bounds or step are disabled, never silently clamped.

    Click two dates to form an inclusive range; reverse selection is ordered. Both calendars hold a draft until Áp dụng updates the fields and emits bubbling input and change events. Hủy, Escape and outside dismissal discard that draft. Choosing a preset commits immediately. Activating the range display opens the calendar. Invalid or incomplete required ranges show a field error and block form submission. Reset restores the original values.

    Arrow keys move by day/week; Home/End move to week edges; PageUp/PageDown move by month (Shift changes year). Enter/Space selects. Tab can leave the non-modal popup; Escape, Cancel and Apply return focus to its opener. Range calendars show two months on desktop. Below 768px, a vertical list renders twelve consecutive months around the selection; scrolling preserves the draft and month navigation recenters that window. Both pickers become fullscreen modal dialogs on mobile, with fixed commands, a scrolling month list, safe-area insets, contained focus, and an inert, scroll-locked background. Desktop calendars remain anchored non-modal popups. The native top-layer popup avoids ancestor clipping. locale="vi" is the default (en and ja are also supported); it sets the calendar language and the order days are written in, in the single date's field, the range display and the calendar status (English month first, en-US). weekStartsOn accepts 0 or 1 (Monday by default). calendarLabels overrides commands, status and preset labels.

    The date-picker / date-range hooks own composition; date-inputs, date-control-row, date-entry, date-tools, date-field-control, date-range-preset, date-boundary and date-range-error own the control area. The shared Field supports labelHidden, selectionHidden (select chevron only, options remain readable) and appearance="embedded" for accessible compound controls. date-calendar, date-calendar-head, date-calendar-title, date-calendar-body, date-calendar-months, date-month, date-month-title, date-grid, date-weekday, date-cell, date-day, date-calendar-footer and date-calendar-status own the popup. data-selected, data-in-range, aria-current="date" and native disabled states define calendar styling; consumers compose the public components rather than targeting their descendants.

    The default single-day calendar commits its ISO value and closes when a day is chosen, before a containing form can submit. applyOnClose={false} keeps the explicit Apply/Cancel flow. Automatic filter submission requires an explicit method="get" on the form; CSR command forms do not submit merely because their omitted HTML method defaults to GET. Reassigning the same supplied date during an unrelated render preserves the native draft.

    #API

    Generated from the package source. A property without a description has none in the source yet.

    #DatePresetPickerComponent

    Dashboard period filter. Menu owns control geometry, popup, keyboard and selected state.

    PropertyDescriptionTypeDefault
    idrequired–string–
    labelrequiredAccessible label only; the trigger displays the selected preset.string–
    valuerequired–DatePreset–
    todayrequiredExplicit YYYY-MM-DD in the business timezone, keeping server rendering pure.string–
    locale–'vi' | 'en'–
    hrefrequiredNative links apply immediately and retain navigation without client JavaScript.(preset: DatePreset, range: DatePresetRange) => string–
    align–'start' | 'end''end'

    #datePresetIdsConstant

    Fixed choices, in display order. No arbitrary date or custom-range entry.

    const datePresetIds = [ 'today', 'yesterday', 'last_7_days', 'this_week', 'last_week', 'last_30_days', 'this_month', 'last_month', 'last_90_days', 'this_year', 'last_year', ] as const

    #datePresetLabelFunction

    function datePresetLabel(preset: "last_30_days" | "last_7_days" | "last_90_days" | "last_month" | "last_week" | "last_year" | "this_month" | "this_week" | "this_year" | "today" | "yesterday", locale?: "en" | "vi"): string
    ParameterType
    presetrequiredDatePreset
    locale'vi' | 'en'
    Returnsstring

    #resolveDatePresetFunction

    Inclusive civil dates in the caller's business timezone. Weeks start Monday; current week/month/year cover the entire calendar period. Rolling ranges include today.

    function resolveDatePreset(preset: "last_30_days" | "last_7_days" | "last_90_days" | "last_month" | "last_week" | "last_year" | "this_month" | "this_week" | "this_year" | "today" | "yesterday", today: string): DatePresetRange
    ParameterType
    presetrequiredDatePreset
    todayrequiredstring
    ReturnsDatePresetRange

    #DatePickerComponent

    Civil dates submit unchanged. Native fields also provide the no-JavaScript fallback.

    PropertyDescriptionTypeDefault
    readOnlyWhenIn a RecordForm, lock/hide this field while the named peer has a non-empty value.string–
    hiddenWhen–string–
    open–boolean–
    onInputNative input events, also emitted by progressively enhanced controls.(event: Event) => void–
    onChange–(event: Event) => void–
    onBlur–(event: Event) => void–
    idrequired–string–
    namerequired–string–
    labelrequired–string–
    localeForward the host locale to date/time controls; omitted keeps their existing default. Days are written in this language's order (English month first), whatever the browser's language; the native fallback without JavaScript keeps the browser's. Calendar labels default to Vietnamese.'vi' | 'en' | 'ja''vi'
    sizeOpt-in matched input/action height: 36px desktop, 44px mobile.'default' | 'large'–
    layoutKeep an enhanced control and its label in one row at narrow widths.'inline'–
    actionA command right after a short single-line entry, such as an Add or Apply Button. The entry keeps a compact width and Enter in it runs the command instead of the form's first submit button.JSXChild–
    value–string | number | boolean | null''
    checked–boolean | 'indeterminate'–
    submitValueLegacy checkbox value used checked state; submitValue opts into separate form data.string–
    prefix–JSXChild–
    suffix–JSXChild–
    clearable–boolean–
    clearLabel–string–
    inputMode–'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'–
    numberLocaleA number or decimal typed and shown as this language writes it ("1.800.000" in vi). The control becomes a text input; the design-system runtime submits the plain decimal ("1800000").string–
    align–'start' | 'center' | 'end'–
    rows–number–
    resize–'vertical' | 'none'–
    maxLength–number–
    minLength–number–
    pattern–string–
    labelHiddenEmbedded controls share the frame of a compound field.boolean–
    selectionHiddenKeep the selected value accessible while showing only the select chevron.boolean–
    appearance–'default' | 'embedded'–
    placeholder–string | null–
    required–boolean–
    disabled–boolean–
    readOnly–boolean–
    min–string | number–
    max–string | number–
    help–string | null–
    options–readonly FieldOption[]–
    optionsOrientationHow checkbox-group and radio options flow. horizontal (default) wraps them on a line; vertical lists one option per line under the shared label, for choices whose labels should scan as a column.'horizontal' | 'vertical'–
    span–'half' | 'full''half'
    widthHow long the value is: the control is no wider than it needs (FieldFrame).'xs' | 'sm' | 'md'–
    step–string | null–
    autocomplete–string | null–
    issues–readonly FieldIssue[]–
    error–string | null–
    todayBusiness-timezone civil date; omit for the browser's local today at opening.string–
    weekStartsOn–0 | 11
    calendarLabels–Partial<Omit<DatePickerLabels, 'presetLabels'>> & { presetLabels?: Partial<DatePickerLabels['presetLabels']> }–
    applyOnClose–boolean–

    #DateRangePickerComponent

    One visible range field; the two named civil-date boundaries remain the form contract.

    PropertyDescriptionTypeDefault
    localeDays are written in this language's order (English month first), whatever the browser's language; the native fallback without JavaScript keeps the browser's. Calendar labels default to Vietnamese.'vi' | 'en' | 'ja''vi'
    todayBusiness-timezone civil date; omit for the browser's local today at opening.string–
    weekStartsOn–0 | 11
    calendarLabels–Partial<Omit<DatePickerLabels, 'presetLabels'>> & { presetLabels?: Partial<DatePickerLabels['presetLabels']> }–
    variantCompact labelled control for page-heading filters; label remains accessible.'field' | 'filter'–
    applyOnCloseCommit a valid draft and submit its GET filter when the calendar closes.boolean–
    idrequired–string–
    labelrequired–string–
    startrequired–Omit<TemporalProps, 'label' | 'span'>–
    endrequired–Omit<TemporalProps, 'label' | 'span'>–
    startLabelrequired–string–
    endLabelrequired–string–
    span–'half' | 'full''full'
    presetsAll seven presets by default; false hides quick ranges.readonly DateRangePreset[] | false–

    #DateTimePickerComponent

    Local wall time stays one submitted value; enhancement splits date and time while retaining a native datetime-local fallback without JavaScript.

    PropertyDescriptionTypeDefault
    readOnlyWhenIn a RecordForm, lock/hide this field while the named peer has a non-empty value.string–
    hiddenWhen–string–
    open–boolean–
    onInputNative input events, also emitted by progressively enhanced controls.(event: Event) => void–
    onChange–(event: Event) => void–
    onBlur–(event: Event) => void–
    idrequired–string–
    namerequired–string–
    labelrequired–string–
    localeForward the host locale to date/time controls; omitted keeps their existing default. Days are written in this language's order (English month first), whatever the browser's language; the native fallback without JavaScript keeps the browser's. Calendar labels default to Vietnamese.'vi' | 'en' | 'ja''vi'
    sizeOpt-in matched input/action height: 36px desktop, 44px mobile.'default' | 'large'–
    layoutKeep an enhanced control and its label in one row at narrow widths.'inline'–
    actionA command right after a short single-line entry, such as an Add or Apply Button. The entry keeps a compact width and Enter in it runs the command instead of the form's first submit button.JSXChild–
    value–string | number | boolean | null''
    checked–boolean | 'indeterminate'–
    submitValueLegacy checkbox value used checked state; submitValue opts into separate form data.string–
    prefix–JSXChild–
    suffix–JSXChild–
    clearable–boolean–
    clearLabel–string–
    inputMode–'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'–
    numberLocaleA number or decimal typed and shown as this language writes it ("1.800.000" in vi). The control becomes a text input; the design-system runtime submits the plain decimal ("1800000").string–
    align–'start' | 'center' | 'end'–
    rows–number–
    resize–'vertical' | 'none'–
    maxLength–number–
    minLength–number–
    pattern–string–
    labelHiddenEmbedded controls share the frame of a compound field.boolean–
    selectionHiddenKeep the selected value accessible while showing only the select chevron.boolean–
    appearance–'default' | 'embedded'–
    placeholder–string | null–
    required–boolean–
    disabled–boolean–
    readOnly–boolean–
    min–string | number–
    max–string | number–
    help–string | null–
    options–readonly FieldOption[]–
    optionsOrientationHow checkbox-group and radio options flow. horizontal (default) wraps them on a line; vertical lists one option per line under the shared label, for choices whose labels should scan as a column.'horizontal' | 'vertical'–
    span–'half' | 'full''half'
    widthHow long the value is: the control is no wider than it needs (FieldFrame).'xs' | 'sm' | 'md'–
    step–string | null–
    autocomplete–string | null–
    issues–readonly FieldIssue[]–
    error–string | null–
    todayBusiness-timezone civil date; omit for the browser's local today at opening.string–
    weekStartsOn–0 | 1–
    calendarLabels–Partial<Omit<DatePickerLabels, 'presetLabels'>> & { presetLabels?: Partial<DatePickerLabels['presetLabels']> }–

    #TimePickerComponent

    PropertyDescriptionTypeDefault
    readOnlyWhenIn a RecordForm, lock/hide this field while the named peer has a non-empty value.string–
    hiddenWhen–string–
    open–boolean–
    onInputNative input events, also emitted by progressively enhanced controls.(event: Event) => void–
    onChange–(event: Event) => void–
    onBlur–(event: Event) => void–
    idrequired–string–
    namerequired–string–
    labelrequired–string–
    localeForward the host locale to date/time controls; omitted keeps their existing default.'vi' | 'en' | 'ja'–
    sizeOpt-in matched input/action height: 36px desktop, 44px mobile.'default' | 'large'–
    layoutKeep an enhanced control and its label in one row at narrow widths.'inline'–
    actionA command right after a short single-line entry, such as an Add or Apply Button. The entry keeps a compact width and Enter in it runs the command instead of the form's first submit button.JSXChild–
    value–string | number | boolean | null–
    checked–boolean | 'indeterminate'–
    submitValueLegacy checkbox value used checked state; submitValue opts into separate form data.string–
    prefix–JSXChild–
    suffix–JSXChild–
    clearable–boolean–
    clearLabel–string–
    inputMode–'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'–
    numberLocaleA number or decimal typed and shown as this language writes it ("1.800.000" in vi). The control becomes a text input; the design-system runtime submits the plain decimal ("1800000").string–
    align–'start' | 'center' | 'end'–
    rows–number–
    resize–'vertical' | 'none'–
    maxLength–number–
    minLength–number–
    pattern–string–
    labelHiddenEmbedded controls share the frame of a compound field.boolean–
    selectionHiddenKeep the selected value accessible while showing only the select chevron.boolean–
    appearance–'default' | 'embedded'–
    placeholder–string | null–
    required–boolean–
    disabled–boolean–
    readOnly–boolean–
    min–string | number–
    max–string | number–
    help–string | null–
    options–readonly FieldOption[]–
    optionsOrientationHow checkbox-group and radio options flow. horizontal (default) wraps them on a line; vertical lists one option per line under the shared label, for choices whose labels should scan as a column.'horizontal' | 'vertical'–
    span–'half' | 'full'–
    widthHow long the value is: the control is no wider than it needs (FieldFrame).'xs' | 'sm' | 'md'–
    step–string | null–
    autocomplete–string | null–
    issues–readonly FieldIssue[]–
    error–string | null–

    #Types

    #DatePreset

    type DatePreset = (typeof datePresetIds)[number]

    #DatePresetRange

    PropertyDescriptionTypeDefault
    startrequired–string–
    endrequired–string–

    #DatePresetPickerProps

    The properties of DatePresetPicker, listed above.

    #DatePickerProps

    The properties of DatePicker, listed above.

    #DatePickerLabels

    PropertyDescriptionTypeDefault
    openrequired–string–
    titlerequired–string–
    previousrequired–string–
    nextrequired–string–
    applyrequired–string–
    cancelrequired–string–
    closerequired–string–
    chooseStartrequired–string–
    chooseEndrequired–string–
    chooseDaterequired–string–
    invalidRangerequired–string–
    presetsrequired–string–
    customRangerequired–string–
    invalidSelectionrequired–string–
    presetLabelsrequired–Record<DateRangePreset, string>–

    #DateRangePreset

    type DateRangePreset =
      | 'today'
      | 'yesterday'
      | 'last7'
      | 'thisMonth'
      | 'lastMonth'
      | 'last30'
      | 'last90'

    #DateRangePickerProps

    The properties of DateRangePicker, listed above.

    #TemporalProps

    The properties of TimePicker, listed above.

    #Hooks

    The data-ui values these components render. Select them in tests and behaviour; their look belongs to the design system. See Contract.

    • date-picker
    • date-time-picker
    • date-time-controls
    • date-time-parts
    • date-range
    • date-inputs
    • date-control-row
    • date-tools
    • date-range-error
    • date-calendar
    • date-calendar-head
    • date-calendar-title
    • date-calendar-body
    • date-field-control
    • date-entry
    • date-range-preset
    • date-boundary
    • date-calendar-months
    • date-month
    • date-month-title
    • date-grid
    • date-weekday
    • date-cell
    • date-day
    • date-calendar-footer
    • date-calendar-status