Skip to content
Discussion options

You must be logged in to vote

Hey! I think that by doing this, you're swimming against the current. Rails already does an amazing job at handling forms and its rendering.

To use components in forms, approach it from the opposite perspective: how do you enhance form helpers to use your components underneath?

The answer is FormBuilders
https://guides.rubyonrails.org/form_helpers.html#customizing-form-builders
https://api.rubyonrails.org/v6.0.3.4/classes/ActionView/Helpers/FormBuilder.html

Using form builders you can:

  1. Modify rails' default form helpers with your own markup and css classes
  2. Add new helpers to support new type of input elements you create.

You can either override the default rails form builder:

class Form…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by joelhawksley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants