feat: add defaultSelected selection prop#2998
Conversation
🦋 Changeset detectedLatest commit: 00a5855 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
rodgobbi
left a comment
There was a problem hiding this comment.
@gpbl IMO uncontrolled mode is not useful for DayPicker.
The consumers want to have access to the selected dates to use for something else.
Using DayPicker uncontrolled is just a calendar day picker that changes state, but that state is not used for anything else.
Fair point, and sorry for not providing enough context in this draft PR. The goal is to introduce the I am still exploring the right solution here, so any feedback is very welcome! |
|
@gpbl I see, I also revisited the discussion in the issue. What do you think of trying this together with another prop that changes the empty selection from |
Adds
defaultSelectedso apps can initialize uncontrolled selections without relying onselectedas initial state. Keeps existingselectedbehavior intact for v10 compatibility; read-only controlled selections can useselectedwith a no-oponSelect.What Changed
defaultSelectedto single, multiple, and range selection prop types.defaultSelected, falling back to existingselectedbehavior when omitted.defaultSelectedthrough the existingtimeZoneconversion path.