Skip to content

Instantly share code, notes, and snippets.

@joeybeninghove
Created December 17, 2020 05:08
Show Gist options
  • Save joeybeninghove/c5340af8001481d1a4c874ec337da5f5 to your computer and use it in GitHub Desktop.
Save joeybeninghove/c5340af8001481d1a4c874ec337da5f5 to your computer and use it in GitHub Desktop.
simple_form + flatpickr
config.wrappers :flatpickr, class: 'mb-6 relative' do |b|
b.use :html5
b.use :label, class: 'mb-2'
b.wrapper tag: :div, html: {
data: {
controller: 'flatpickr',
wrap: true,
alt_format: 'm/d/Y',
flatpickr_cleave_date_pattern: %w[m d Y]
}
} do |component|
component.use :input, class: 'w-full', placeholder: 'mm/dd/yyyy', data: { input: '' }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment