Description Usage Arguments See Also Examples
View source: R/shiny-material-date-picker.R
Build a shinymaterial date picker.
1 | material_date_picker(input_id, label, value = "", color = NULL)
|
input_id |
String. The input identifier used to access the value. |
label |
String. The date picker label. |
value |
String. The starting date (format 'mmm dd, yyyy'). |
color |
String. The date picker color. Leave empty for the default color. Visit https://materializecss.com/color.html for a list of available colors. |
1 2 3 4 5 | material_date_picker(
input_id = "example_date_picker",
label = "Date Picker",
value = "Jun 02, 2006"
)
|
<script>$(document).ready(function () {
function initShinyMaterialDatePicker(callback) {
$('.datepicker').datepicker({});
callback();
}
initShinyMaterialDatePicker(function () {
var shinyMaterialDatePicker = new Shiny.InputBinding();
$.extend(shinyMaterialDatePicker, {
find: function (scope) {
return $(scope).find(".shiny-material-date-picker");
},
getValue: function (el) {
return $(el).val();
},
subscribe: function (el, callback) {
$(el).on("change.shiny-material-date-picker", function (e) {
callback();
});
},
unsubscribe: function (el) {
$(el).off(".shiny-material-date-picker");
}
});
Shiny.inputBindings.register(shinyMaterialDatePicker);
});
});</script>
<label for="example_date_picker">Date Picker</label>
<input type="text" class="datepicker shiny-material-date-picker" value="Jun 02, 2006" id="example_date_picker"/>
<div></div>
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.