import { SelectDate } from '@duik/it'import SelectDate from '@duik/select-date'SelectDate is a select which wraps Datepicker component, in which documentation you can also find more information. SelectDate accepts same properties and some extra such as "label" in the list below
Same way as Datepicker is designed, you can use SelectDate as an component with uncontrolled value.
Date of Birth MonTueWedThuFriSatSun | <SelectDate label="Date of Birth" /><div class="form-group"> <span class="content-title">Date of Birth</span> <div class="outer-events-handler dropdown btn-group select-date"> <button class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button" role="button">Select Date</button> <div class="dropdown-menu select-date-dropdown bottom-right"> <div class="datepicker"> <div class="datepicker-header"> <button class="datepicker-nav-btn">←</button> <button class="datepicker-title-btn" type="button">May 2020</button> <button class="datepicker-nav-btn">→</button> </div> <div class="datepicker-view-container"> <div class="datepicker-month"> <span class="datepicker-day-name">Mon</span> <span class="datepicker-day-name">Tue</span> <span class="datepicker-day-name">Wed</span> <span class="datepicker-day-name">Thu</span> <span class="datepicker-day-name">Fri</span> <span class="datepicker-day-name">Sat</span> <span class="datepicker-day-name">Sun</span> <button type="button" disabled="" class="datepicker-day datepicker-day-not-current"> <span class="datepicker-day-content">27</span> </button> <button type="button" disabled="" class="datepicker-day datepicker-day-not-current"> <span class="datepicker-day-content">28</span> </button> <button type="button" disabled="" class="datepicker-day datepicker-day-not-current"> <span class="datepicker-day-content">29</span> </button> <button type="button" disabled="" class="datepicker-day datepicker-day-not-current"> <span class="datepicker-day-content">30</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">1</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">2</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">3</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">4</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">5</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">6</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">7</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">8</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">9</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">10</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">11</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">12</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">13</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">14</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">15</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">16</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">17</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">18</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">19</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">20</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">21</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">22</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">23</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">24</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">25</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">26</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">27</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">28</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">29</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">30</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">31</span> </button> </div> </div> </div> </div> </div> </div> ReactHTML Snippet |
Here is an example selecting date range with a controlled value.
MonTueWedThuFriSatSun | <SelectDate
isRange
onDateChange={function x(){}}
value={{
from: new Date('2020-05-07T22:00:00.000Z'),
to: new Date('2020-05-18T22:00:00.000Z')
}}
/><div class="outer-events-handler dropdown btn-group select-date"> <button class="btn dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" type="button" role="button"> <strong>5/8/2020</strong> ═ <strong>5/19/2020</strong> </button> <div class="dropdown-menu select-date-dropdown bottom-right"> <div class="datepicker"> <div class="datepicker-header"> <button class="datepicker-nav-btn">←</button> <button class="datepicker-title-btn" type="button">May 2020</button> <button class="datepicker-nav-btn">→</button> </div> <div class="datepicker-view-container"> <div class="datepicker-month"> <span class="datepicker-day-name">Mon</span> <span class="datepicker-day-name">Tue</span> <span class="datepicker-day-name">Wed</span> <span class="datepicker-day-name">Thu</span> <span class="datepicker-day-name">Fri</span> <span class="datepicker-day-name">Sat</span> <span class="datepicker-day-name">Sun</span> <button type="button" disabled="" class="datepicker-day datepicker-day-not-current"> <span class="datepicker-day-content">27</span> </button> <button type="button" disabled="" class="datepicker-day datepicker-day-not-current"> <span class="datepicker-day-content">28</span> </button> <button type="button" disabled="" class="datepicker-day datepicker-day-not-current"> <span class="datepicker-day-content">29</span> </button> <button type="button" disabled="" class="datepicker-day datepicker-day-not-current"> <span class="datepicker-day-content">30</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">1</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">2</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">3</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">4</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">5</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">6</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">7</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected datepicker-day-selected-first"> <span class="datepicker-day-content">8</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">9</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">10</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">11</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">12</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">13</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">14</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">15</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">16</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">17</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected"> <span class="datepicker-day-content">18</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month datepicker-day-selected datepicker-day-selected-last"> <span class="datepicker-day-content">19</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">20</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">21</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">22</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">23</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">24</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">25</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">26</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">27</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">28</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">29</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">30</span> </button> <button type="button" class="datepicker-day datepicker-day-current-month"> <span class="datepicker-day-content">31</span> </button> </div> </div> </div> </div> </div> ReactHTML Snippet |
You can format how to display the displayed value. For other formatters, check Datepicker localization.
| renderValue | (value?: DatepickerValue, isRange?: boolean, placeholder?: React.ReactNode) => React.ReactNode |
| placeholder | Required: false |
| type: React.ReactNode | |
| label | Required: false |
| type: React.ReactNode | |
| Label to be displayed above the select. |
| Datepicker | Required: false |
| type: | |
| You can pass any prop that Datepicker accepts as well, e.g. minDate |
| noWrap | Required: false |
| type: boolean | |
| When multiple elements are rendered, e.g. providing a label, the component will wrap the content with a FormGroup component for mroe consistent UI. pass noWrap={false} to disable the default behaviour. |
| ...rest | Required: false |
| type: any | |
| Rest of the properties are passed down to Dropdown. |