Time picker MDB Pro component
Bootstrap Time Picker
Note: We are transitioning MDB4 to a legacy version and focusing on developing MDB5.
While we'll continue to support for the transition period, we encourage you to migrate to
MDB5. We're offering a huge discount on MDB5 PRO to help with your transition,
enabling you to leverage the full potential of the latest version. You can find more information here.
upgrade with discount
Bootstrap time picker is a jQuery plugin which allows the user to select a time in the Bootstrap form without the necessity of using custom JavaScript code.
This documentation may contain syntax introduced in the MDB 4.16.0 and can be incompatible with previous versions. For old Time Picker documentation please follow the link.
Basic examples
The new time picker opens when you click the icon on the right side, not on input.
<div class="row">
<div class="col-md-6">
<div class="md-form md-outline input-with-post-icon timepicker" twelvehour="true">
<input type="text" id="light-version-examples" class="form-control" placeholder="Select time">
<label for="light-version-examples">Light version, 12hours</label>
<i class="fas fa-envelope input-prefix"></i>
</div>
</div>
<div class="col-md-6">
<div class="md-form md-outline input-with-post-icon timepicker" darktheme="true">
<input type="text" id="dark-version-example" class="form-control" placeholder="Select time">
<label for="dark-version-example">Dark version, 24 hours</label>
<i class="fas fa-envelope input-prefix"></i>
</div>
</div>
</div>
Twelve hour clock
Set either a 12 or 24-hour clock.
<div class="md-form md-outline input-with-post-icon timepicker" twelvehour="true">
<input type="text" id="twelve-hour-clock" class="form-control" placeholder="Select time">
<label for="twelve-hour-clock">Twelve hour clock</label>
<i class="fas fa-envelope input-prefix"></i>
</div>
Dark theme
Set a darktheme clock.
<div class="md-form md-outline input-with-post-icon timepicker" darktheme="true">
<input type="text" id="set-dark-theme" class="form-control" placeholder="Select time">
<label for="set-dark-theme">Dark version</label>
<i class="fas fa-envelope input-prefix"></i>
</div>
Manual operations
Set a default value, input without addon and manual operations.
<div class="md-form md-outline input-with-post-icon timepicker" default="now">
<input type="text" id="manualOperations" class="form-control" placeholder="Select time">
<label for="manualOperations">Time now</label>
<i class="fas fa-envelope input-prefix"></i>
</div>
Default Time Picker
<div class="md-form md-outline">
<input type="time" id="default-picker" class="form-control" placeholder="Select time">
<label for="default-picker">Default Time Picker</label>
</div>
Access from outside
If you need open Time Picker by clicking on another element, you have must add trigger click function
<div class="md-form md-outline input-with-post-icon timepicker" id="myTimePicker" default="now">
<input type="text" id="outside-access" class="form-control" placeholder="Select time">
<label for="outside-access">DAccess from outside</label>
<i class="fas fa-envelope input-prefix"></i>
</div>
<button id="time-picker-opener" class="btn btn-primary btn-sm" data-open="myTimePicker">Open</button>
Minimum and Maximum range
Limit the range of time to choose. You can use it with 12hours and 24hours Time picker
<div class="md-form md-outline input-with-post-icon timepicker" twelvehour="true" min="10:45AM" max="5:25PM">
<input type="text" id="minimum-and-maximum-range" class="form-control" placeholder="Select time">
<label for="minimum-and-maximum-range">Minimum and Maximum range</label>
<i class="fas fa-envelope input-prefix"></i>
</div>
Options
Name | Default | Description |
---|---|---|
default | '' | default time, 'now' or '13:14' e.g. |
placement | 'bottom' | popover placement |
align | 'left' | popover arrow align |
donetext | 'OK' | done button text |
cleartext | 'Clear' | done button text |
closetext | 'Close' | done button text |
autoclose | false | auto close when minute is selected |
darktheme | false | set dark theme |
minutestep | 1 | allow to multi increment the minute |
twelvehour | false | use twelve hour Time Picker |
vibrate | true | vibrate the device when dragging clock hand |
fromnow | 0 | set default time to * milliseconds from now (using with default = 'now') |
min | set maximum allow time range to select | |
max | set minimum allow time range to select | |
init | callback function triggered after the colorpicker has been initiated | |
beforeShow | callback function triggered before popup is shown | |
afterShow | callback function triggered after popup is shown | |
beforeHide | callback function triggered before popup is hidden
Note: will be triggered between a beforeDone and afterDone |
|
afterHide | callback function triggered after popup is hidden
Note: will be triggered between a beforeDone and afterDone |
|
beforeHourSelect | callback function triggered before user makes an hour selection | |
afterHourSelect | callback function triggered after user makes an hour selection | |
beforeDone | callback function triggered before time is written to input | |
afterDone | callback function triggered after time is written to input |