Rails Bootstrap Forms
view_component-form
Rails Bootstrap Forms | view_component-form | |
---|---|---|
1 | 1 | |
1,627 | 185 | |
0.7% | 3.2% | |
7.6 | 4.6 | |
about 1 month ago | 28 days ago | |
Ruby | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Rails Bootstrap Forms
-
Rails scaffold templates
Next, let’s change our view templates. I don’t like current ones so I took templates from rails 6.x and updated it for my needs (for bootstrap based project I’ve taken bootstrap_form gem and have changed ujs-dependent code to use hotwire). I’ve created directory lib/templates/erb/scaffold and placed my _form.html.erb.tt, edit.html.erb.tt, index.html.erb.tt, partial.html.erb.tt, new.html.erb.tt, show.html.erb.tt to that location. You can find my code below
view_component-form
-
Building UI with Rails 7 + Tailwind
In the past I have used simple_form but after a lot of projects I have switched to plain FormBuilder. It became easier to styling every input without headacle. For reusing purpose I’m in flavor of view-component_form gem (it only wraps every input type in a view_component).
What are some alternatives?
Simple Form - Forms made easy for Rails! It's tied to a simple DSL, with no opinion on markup.
tailwindcss-stimulus-components - A set of StimulusJS components for TailwindCSS apps similar to Bootstrap JS components.
Cocoon - Dynamic nested forms using jQuery made easy; works with formtastic, simple_form or default forms
Formtastic - A Rails form builder plugin with semantically rich and accessible markup.
view_components - ViewComponents for the Primer Design System
Reform - Form objects decoupled from models.
simple_form_tailwind_css - Tailwind components for Simple Form
ActiveForm - Create nested forms with ease.
Abracadabra
ComfyBootstrapForm - Rails form builder for Bootstrap 4 markup that actually works!
Ruby on Rails - Ruby on Rails