Skip to content

Calendar Input

CalendarInputView pairs a read-only text input with a Calendar in a popover. Clicking the field opens the calendar; picking a day fills the field with the formatted date. It’s a convenience wrapper for the common “date field” pattern where the value is always chosen from the calendar rather than typed.

Installation

import { useState } from 'react';
import { CalendarInputView } from '@harnessio/ui/components';
const DateField = () => {
const [value, setValue] = useState<string>('');
return (
<CalendarInputView
value={value}
setValue={(date) => setValue(date.toISOString())}
placeholder="Select a date"
/>
);
};
export default DateField;

The field stores its value as a string that you own. setValue hands you a Date when a day is picked — convert and store it however you like (an ISO string above), and pass it back in through value.