Date Input

Masked text input for typing dates and times, with automatic formatting, min and max limits, and validation.

import { DateInput } from "@plexui/ui/components/DateInput";

On Phone, put a date input in a row of a FieldGroup, as the Input examples and the Settings Forms do. The row is its frame and sets its height, insets and type, so the Phone previews show rows without the variant, size and pill controls. To pick a date rather than type it, use the compact date of a Date Picker in the row.

Examples

Overview

With time

With seconds

Limits

US format

ISO format

With Field

Enter your date of birth

Validation

API

PropTypeDefaultDescription
valueDateTime | null—Required. Selected date (Luxon DateTime). The field shows its date and time in its own zone, and a typed date is made in that zone (Luxon's default zone without a value)
onChange(date: DateTime | null) => void—Required. Called when a complete valid date is entered or the field is cleared
modeMaskitoDateMode"dd/mm/yyyy"Date format mode: dd/mm/yyyy, mm/dd/yyyy, yyyy/mm/dd, etc.
separatorstring"."Character between date parts
timeModeMaskitoTimeMode—Enable time input: HH:MM, HH:MM:SS, etc.
dateTimeSeparatorstring", "Separator between date and time parts
timeStepnumber0Arrow-key increment step for time segments
minDateTime—Earliest allowed date
maxDateTime—Latest allowed date
clearablebooleanfalseShow clear button when input has a value
sizeControlSize"md"Input size (3xs to 3xl)
variant"outline" | "soft""outline"Visual style
pillbooleanfalseFully rounded corners
disabledbooleanfalseDisable input
invalidbooleanfalseMark as invalid
placeholderstring—Generated from the format if not set

Other props, such as startAdornment and endAdornment, go to the underlying Input. The mask is Maskito (@maskito/react).

Styling

Date Input reads these component tokens. Override them at any scope to restyle it:

  • --input-border-color-invalid: border color invalid (default var(--color-border-danger-outline))
  • --input-gap-lg: gap lg (default 10px)
  • --input-gap-md: gap md (default 8px)
  • --input-gap-sm: gap sm (default 6px)
  • --input-gap-xs: gap xs (default 4px)
  • --input-outline-border-color: outline border color (default var(--color-border-primary-outline))
  • --input-outline-border-color-focus: outline border color focus (default var(--alpha-50))
  • --input-outline-border-color-hover: outline border color hover (default light-dark(var(--alpha-25), var(--alpha-30)))
  • --input-placeholder-text-color: placeholder text color (default var(--color-text-tertiary))
  • --input-soft-background-color: soft background color (default var(--color-background-primary-soft-alpha))
  • --input-soft-border-color-focus: soft border color focus (default var(--alpha-20))
  • --input-text-color: text color (default var(--color-text))