Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default_builder configuration option #1796

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gregorw
Copy link

@gregorw gregorw commented Nov 23, 2022

For some CSS frameworks the current Simple Form configuration options are not enough. In particular, the error notification may require additional nesting. But also data attributes on some wrappers may be required. By introducing the default_builder configuration option any framework should be able to be configured.

In the case of simple_form_tailwind_css this would allow to use

<%= simple_form_for(@foo) do |f| %>

instead of

<%= simple_form_for(@foo, builder: SimpleForm::Tailwind::FormBuilder) do |f| %>

See also #1723.

For some CSS frameworks the current Simple Form configuration options are not enough. In particular, the error notification may require [additional nesting](https://github.com/abevoelker/simple_form_tailwind_css/blob/master/lib/simple_form/tailwind/error_notification.rb). But also data attributes on some wrappers may be [required](https://react.carbondesignsystem.com/?path=/story/components-textinput--playground&args=invalid:true). By introducing the `default_builder` configuration option any framework should be able to be configured.

In the case of https://github.com/abevoelker/simple_form_tailwind_css this would allow to use

```erb
<%= simple_form_for(@foo) do |f| %>
```

instead of

```erb
<%= simple_form_for(@foo, builder: SimpleForm::Tailwind::FormBuilder) do |f| %>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant