An enhanced file upload field for Rails forms, powered by web components. Provides drag-and-drop uploads, image previews, and seamless ActiveStorage integration.
- Drag-and-drop file uploads
- Image and video previews
- Direct uploads to ActiveStorage
- Multiple file support
- Form validation (required, accept, size limits)
- Persists attachments through validation errors
Add to your Gemfile:
gem "bard-attachment_field"
In your form:
<%= form.attachment_field :avatar %>
<%= form.attachment_field :documents, multiple: true %>multiple: true- Allow multiple file uploadsaccept: "image/*"- Restrict file typesrequired: true- Make field requiredpreview: false- Disable image previewsdisabled: true- Disable the field
MIT