material_date_picker: Create a shinymaterial date picker

Description Usage Arguments See Also Examples

View source: R/shiny-material-date-picker.R

Description

Build a shinymaterial date picker.

Usage

1
material_date_picker(input_id, label, value = "", color = NULL)

Arguments

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.

See Also

update_material_date_picker

Examples

1
2
3
4
5
material_date_picker(
  input_id = "example_date_picker",
  label = "Date Picker",
  value = "Jun 02, 2006"
)

Example output

<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>

shinymaterial documentation built on Sept. 1, 2020, 1:07 a.m.