Lion Logo Lion Fundamentals Guides Components Blog Toggle darkmode

Input Datepicker: Use Cases

Minimum and maximum date

Below are examples of different validators for dates.

export const minimumAndMaximumDate = () => html`
    .modelValue=${new Date('2018/05/30')}
    .validators=${[new MinMaxDate({ min: new Date('2018/05/24'), max: new Date('2018/06/24') })]}
    <div slot="help-text">
      Enter a date between ${formatDate(new Date('2018/05/24'))} and ${formatDate(
        new Date('2018/06/24'),

Disable specific dates

export const disableSpecificDates = () => html`
    help-text="You're not allowed to choose any 15th."
    .validators=${[new IsDateDisabled(d => d.getDate() === 15)]}

Calendar heading

You can modify the heading of the calendar with the .calendarHeading property or calendar-heading attribute for simple values.

By default, it will take the label value.

export const calendarHeading = () => html`
    .calendarHeading="${'Custom heading'}"
    .modelValue=${new Date()}


You can disable datepicker inputs.

export const disabled = () => html`
  <lion-input-datepicker label="Disabled" disabled></lion-input-datepicker>

Read only

You can set datepicker inputs to readonly, which will prevent the user from opening the calendar popup.

export const readOnly = () => html`
  <lion-input-datepicker label="Readonly" readonly .modelValue="${new Date()}">