Usage
<%= form_with url: root_path do |f| %>
<%= f.easepick :birthday %>
<%= f.easepick :appointment, data: { easepick_plugins: ["LockPlugin"] } %>
<% end %>Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | Symbol:sm | :md | :lg | :md | Size of the date picker field. |
label | String | false | humanized attribute name | Custom label text. Set to `false` to hide the label. |
hint | String | nil | Helper text displayed below the field. |
error | String | nil | Manual error message. ActiveRecord errors are displayed automatically. |
disabled | Boolean | false | Disable the field. |
data-easepick_plugins | Array | [] | Easepick plugins to enable (e.g., LockPlugin, AmpPlugin). |
data-easepick_lock_min_date | Date | nil | Minimum selectable date (requires LockPlugin). |
data-easepick_amp_dropdown | Hash | nil | AmpPlugin dropdown configuration (months, years, minYear, maxYear). |
Also accepts any HTML attributes via **options (e.g., id:, data:, aria:). class: is also supported for custom styling.
Examples
Basic Date Picker
<%= form_with url: root_path do |f| %>
<%= f.easepick :birthday %>
<% end %>Easepick sizes
<%= form_with url: root_path do |f| %>
<%= f.easepick :large_field, size: :lg %>
<%= f.easepick :default_field %>
<%= f.easepick :small_field, size: :sm %>
<% end %>Label customization
<%= form_with url: root_path do |f| %>
<%= f.easepick :custom_label, label: "Custom Label Text" %>
<%= f.easepick :no_label, label: false %>
<% end %>Hint message
<%= form_with url: root_path do |f| %>
<%= f.easepick :birthday_with_hint, hint: "Select your birth date" %>
<% end %>Date Picker with Plugins
<%= form_with url: root_path do |f| %>
<%= f.easepick :future_date, data: {
easepick_plugins: ["LockPlugin"],
easepick_lock_min_date: Date.current
}, hint: "Future dates only" %>
<%= f.easepick :appointment, data: {
easepick_plugins: ["LockPlugin", "AmpPlugin"],
easepick_amp_dropdown: {
months: true,
years: true,
maxYear: Time.zone.today.year + 2,
minYear: Time.zone.today.year
}
}, hint: "Select appointment date", required: true %>
<% end %>Disabled State
<%= form_with url: root_path do |f| %>
<%= f.easepick :disabled_field, value: Date.current, disabled: true %>
<% end %>Validation
<% user = User.new %>
<% user.errors.add(:last_name, "is required") %>
<%= form_with model: user, url: root_path do |f| %>
<%= f.easepick :last_name, label: "Birthday" %>
<% end %>
<%= form_with url: root_path do |f| %>
<%= f.easepick :with_custom_error, error: "This field has a custom error" %>
<% end %>