Flatpickr
Ruby component
class Components::Form::Flatpickr < Matestack::Ui::Bootstrap::Form::Input
optional :enable_time
vue_name "form-flatpickr-component"
def vue_props
{
init_value: init_value,
enable_time: enable_time
}
end
def response
# exactly one root element is required since this is a Vue.js component template
div class: "form-flatpickr-component" do
label input_label, for: attr_key, class: "form-label" if input_label
input input_attributes.merge(bootstrap_flatpickr_input_attributes)
render_errors
render_form_text
end
end
def bootstrap_flatpickr_input_attributes
bootstrap_input_attributes.merge({
type: :text,
class: (options[:class] || "") << (" form-control flatpickr"),
disabled: disabled
})
end
endVue.js component
Usage
Example 1: Usage in form (e.g. mapped to an Active Record model) with enabled time picker
Last updated