bootstrap_form
bootstrap_form copied to clipboard
Bootstrap 4 Custom Controls
Bootstrap 4 provides four custom controls (https://getbootstrap.com/docs/4.0/components/forms/#custom-forms):
input type="radio"input type="checkbox"selectinput type="file"
The state of bootstrap_form v4.0 at the time of writing is:
- v2.7 of
bootstrap_formhas acustomoption onradio_buttonandcheck_boxthat uses the Bootstrap 3 custom controls, and that functionality was carried forward to V4.0. - I believe PR #439 makes
file_fielduse the custom control. - There is no custom
select
It looks like making a custom select with Bootstrap 4 is as simple as adding custom-select to the select tag's classes. I think it would be nice to implement a custom argument to add the class to the select. The alternative would be to document in the read me how to add the class. Whatever way it's done, we should do test cases and check the rendering in the demo app, or Bootply.
The above would also apply to collection_select and grouped_collection_select.
As mentioned, we already do the custom file_field, so we just have to add the custom option and make it turn on and off the custom formatting.
Perhaps worth mentioning is that .input-groups are only supported for custom selects and input type="file". By implementing an explicit option, we could actually check and notify programmers if they don't specify the right combination of options.
Also see #428. Currently collection_select and grouped_collection_select don't get :prepend and :append anyway, but maybe that should change.
Support for Bootstrap 4 has been dropped, and Bootstrap 5 does not have separate custom controls.