Skip to content

Special modifiers: disabled and selected #34

@gpbl

Description

@gpbl

It is very common for a date picker to work with selected and disabled days. While it is already possibile to implement disabled and selected modifiers, we could give them a special treatment to change the component's behavior. Example:

  • if provided, they may add the aria-selected and aria-disabled attributes (see Add ARIA attributes for better accessibility #33)
  • the disabled modifier may also prevent to attach click or touchtap events to those days
  • we could implement them as prop (shortcut for the modifiers prop):
// will add the `selected` modifier for the selected day
<DayPicker selected={ day => isSameDay(this.state.selectedDay) } />

// will add the `disabled` modifier to sundays
<DayPicker disabled={ day => day.getDate() === 6 } />

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions