Skip to content

CalendarField

CalendarField wraps the PrimeReact Calendar component for selecting date values.

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.
dateFormatstringPrimeReact defaultDate display and parsing format used by the calendar input.
showIconbooleanfalseDisplays a calendar icon button next to the input.
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 via the PrimeReact invalid flag.