Open sourcing our form builder
November 5, 2024
The BNB form builder is now open source! Well, it’s always been open source, but now it’s easier to find and use. We previously wrote about it in 2021, and we have been using it in every app since then. With very few tweaks to boot!
The theme of Rails 8 has been to own your stack and form builders are a great example of this. Ever since we switched from gems to this in-app form builder, all of our engineers have been way more comfortable making changes and updates to how forms look for each of our apps. Our developers write Ruby code every day, so it’s easy for them to make abstractions inside of this builder without having to learn a new configuration language.
Our install process is as simple as applying a template to your Rails app. Since there is so much value in having this form builder be a part of your code base, we didn’t want to hide the code away in a gem. Applying the template makes the necessary changes to your app to include the form builder and get you started. From there, feel free to make any changes that you want to fit your needs.
A recap of benefits of using the BNB form builder:
f.input
method that auto finds the correct input to render each field (inspired by SimpleForm)It allows your forms to focus on the data collection and not the presentation.
= app_form_with model: @book do |f|
= f.input :title
= f.input :author_id, collection: Author.all, include_blank: "Select author"
Generates a form like this: