The Forms component introduces:
The Shadcn::FormBuilder
is a custom form builder that extends the
FormBuilder
class. It adds the following methods that provide the form with inputs and controls:
To use these methods which generate the styled, ActiveModel backed form, you use the <%= code("render_form_for") %> or <%= code("render_form_with") %> methods provided by <%= code("app/helpers/components/forms_helper.rb") %>.
These methods yield the common FormBuilder
instance that you can use to generate the controls and inputs above.
If a form field or attribute fails validation, its label and input will be given an error
class to allow for styling. The default error
style is defined in <%= code("app/assets/stylesheets/shadcn.css") %>