Skip to content

CalendarField

CalendarField wraps the internationalized Cratis DatePickerInput while preserving a Date | null command value.

import { CommandDialog } from '@cratis/components/CommandDialog';
import { CalendarField } from '@cratis/components/CommandForm';
<CommandDialog command={MyCommand} visible={visible} onCancel={() => setVisible(false)}>
<CalendarField<MyCommand>
value={(c) => c.startDate}
placeholder='Select a date'
showIcon
dateFormat='mm/dd/yy'
/>
</CommandDialog>;
PropTypeDefaultDescription
value(instance: TCommand) => unknown-Required. Accessor function that returns the bound property from the command instance. Pass the command type as the generic parameter for full type safety.
placeholderstring-Placeholder text shown when no date is selected.
dateFormatstringLegacy mask retained for source compatibility; locale controls formatting.
showIconbooleantrueDisplays the accessible calendar trigger next to the segmented input. Set false only when typed segment entry is sufficient.
showTimebooleanfalseEnables time selection in addition to date selection.
hourFormat'12' | '24'24Hour format when showTime is enabled.
minDateDate-Minimum selectable date.
maxDateDate-Maximum selectable date.
  • Default value is null.
  • The field spans full width within its container.
  • Validation state is reflected through aria-invalid and data-invalid.