diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
index dcc0949..470d98e 100644
--- a/.github/workflows/run-tests.yml
+++ b/.github/workflows/run-tests.yml
@@ -10,7 +10,7 @@ jobs:
matrix:
php: [8.0, 7.4]
laravel: [8.*, 7.*]
- framework: [tailwind, tailwind-2, bootstrap-4]
+ framework: [tailwind, tailwind-2, bootstrap-4, bootstrap-5]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 8.*
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d1a75e..19038f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
All notable changes to `laravel-form-components` will be documented in this file
+## 3.0.0 - 2021-09-08
+
+- Support for Bootstrap 5
+
## 2.5.4 - 2020-02-15
- Bugfix for old nested data
diff --git a/README.md b/README.md
index 02c8337..51a1a2c 100644
--- a/README.md
+++ b/README.md
@@ -6,9 +6,9 @@
[](https://packagist.org/packages/protonemedia/laravel-form-components)
[](https://plant.treeware.earth/protonemedia/laravel-form-components)
-A set of Blade components to rapidly build forms with [Tailwind CSS v1](https://tailwindcss-custom-forms.netlify.app), [Tailwind CSS v2](https://tailwindcss-forms.vercel.app) and [Bootstrap 4](https://getbootstrap.com/docs/4.0/components/forms/). Supports validation, model binding, default values, translations, includes default vendor styling and fully customizable!
+A set of Blade components to rapidly build forms with [Tailwind CSS v1](https://tailwindcss-custom-forms.netlify.app), [Tailwind CSS v2](https://tailwindcss-forms.vercel.app), [Bootstrap 4](https://getbootstrap.com/docs/4.0/components/forms/) and [Bootstrap 5 Forms](https://getbootstrap.com/docs/5.1/forms/overview/). Supports validation, model binding, default values, translations, includes default vendor styling and fully customizable!
-#### ... 👀 There's a Pro version of this package in development: check out [formcomponents.pro](https://formcomponents.pro)!
+Looking for Inertia/Vue.js support? Check out [formcomponents.pro](https://formcomponents.pro)!
### 📺 Want to see this package in action? Join the live stream on November 19 at 14:00 CET: [https://youtu.be/7eNZS4U7xyM](https://youtu.be/7eNZS4U7xyM)
@@ -17,7 +17,8 @@ A set of Blade components to rapidly build forms with [Tailwind CSS v1](https://
* Components for input, textarea, select, multi-select, checkbox and radio elements.
* Support for Tailwind v1 with [Tailwind CSS Custom Forms](https://tailwindcss-custom-forms.netlify.app).
* Support for Tailwind v2 with [Tailwind Forms](https://tailwindcss-forms.vercel.app/).
-* Support for [Bootstrap 4 Forms](https://getbootstrap.com/docs/4.0/components/forms/).
+* Support for [Bootstrap 4 Forms](https://getbootstrap.com/docs/4.6/components/forms/).
+* Support for [Bootstrap 5 Forms](https://getbootstrap.com/docs/5.1/forms/overview/).
* Component logic independent from Blade views, the Tailwind and Bootstrap views use the same logic.
* Bind a target to a form (or a set of elements) to provide default values (model binding).
* Support for [Laravel Livewire](https://laravel-livewire.com) v2.
@@ -75,7 +76,7 @@ If you're using Tailwind, make sure the right plugin ([v1](https://github.com/ta
```
-
+
## Preface
@@ -130,7 +131,7 @@ You can also choose to use a `placeholder` instead of a label, and of course you
```
-By default every element shows validation errors but you can hide them if you want.
+By default, every element shows validation errors, but you can hide them if you want.
```blade
@@ -406,7 +407,7 @@ By the default, the errors messages are positioned under the element. To show th
### Submit button
-The label defaults to *Submit* but you can use the slot to provide your own content.
+The label defaults to *Submit*, but you can use the slot to provide your own content.
```blade
@@ -414,21 +415,23 @@ The label defaults to *Submit* but you can use the slot to provide your own cont
```
-### Bootstrap 4
+### Bootstrap
-You can switch to [Bootstrap 4](https://getbootstrap.com/docs/4.0/components/forms/) by updating the `framework` setting in the `form-components.php` configuration file.
+You can switch to [Bootstrap 4](https://getbootstrap.com/docs/4.0/components/forms/) or [Bootstrap 5](https://getbootstrap.com/docs/5.0/forms/overview/) by updating the `framework` setting in the `form-components.php` configuration file.
```php
return [
- 'framework' => 'bootstrap-4',
+ 'framework' => 'bootstrap-5',
];
```
-There is a little bit of styling added to the `form.blade.php` view to add support for inline form groups. If you want to change it or remove it, [publish the assets](#customize-the-blade-views) and update the view file.
+There is a little of styling added to the `form.blade.php` view to add support for inline form groups. If you want to change it or remove it, [publish the assets](#customize-the-blade-views) and update the view file.
+
+Bootstrap 5 changes a lot regarding forms. If you migrate from 4 to 5, make sure to read the migration logs about [forms](https://getbootstrap.com/docs/5.0/migration/#forms).
-#### Input prepend and append
+#### Input group / prepend and append
-In addition to the Tailwind features, there is also support for [input groups](https://getbootstrap.com/docs/4.1/components/forms/#auto-sizing). Use the `prepend` and `append` slots to provide the contents.
+In addition to the Tailwind features, with Bootstrap 4, there is also support for [input groups](https://getbootstrap.com/docs/4.6/components/forms/). Use the `prepend` and `append` slots to provide the contents.
```blade
@@ -444,9 +447,28 @@ In addition to the Tailwind features, there is also support for [input groups](h
```
+With Bootstrap 5, the [input groups](https://getbootstrap.com/docs/5.0/forms/input-group/) have been simplified. You can add as many items as you would like in any order you would like. Use the `form-input-group-text` component to add text or [checkboxes](https://getbootstrap.com/docs/5.0/forms/input-group/#checkboxes-and-radios).
+
+```blade
+
+
+ @
+
+
+
+```
+
+#### Floating labels
+
+As of Bootstrap 5, you can add [floating labels](https://getbootstrap.com/docs/5.0/forms/floating-labels/) by adding the `floating` attribute to inputs, selects (excluding `multiple`), and textareas.
+
+```blade
+
+```
+
#### Help text
-You can add [block-level help text](https://getbootstrap.com/docs/4.1/components/forms/#help-text) to any element by using the `help` slot.
+You can add [block-level help text](https://getbootstrap.com/docs/4.6/components/forms/#help-text) to any element by using the `help` slot.
```blade
diff --git a/composer.json b/composer.json
index 339d640..7212b9b 100644
--- a/composer.json
+++ b/composer.json
@@ -7,6 +7,9 @@
"tailwindcss",
"bootstrap",
"bootstrap4",
+ "bootstrap5",
+ "bootstrap-4",
+ "bootstrap-5",
"laravel",
"form",
"forms",
diff --git a/config/config.php b/config/config.php
index e1992e3..653e40d 100644
--- a/config/config.php
+++ b/config/config.php
@@ -5,7 +5,7 @@
return [
'prefix' => '',
- /** tailwind | tailwind-2 | bootstrap-4 */
+ /** tailwind | tailwind-2 | bootstrap-4 | bootstrap-5 */
'framework' => 'tailwind',
'components' => [
@@ -34,6 +34,16 @@
'class' => Components\FormInput::class,
],
+ 'form-input-group' => [
+ 'view' => 'form-components::{framework}.form-input-group',
+ 'class' => Components\FormInputGroup::class,
+ ],
+
+ 'form-input-group-text' => [
+ 'view' => 'form-components::{framework}.form-input-group-text',
+ 'class' => Components\FormInputGroupText::class,
+ ],
+
'form-label' => [
'view' => 'form-components::{framework}.form-label',
'class' => Components\FormLabel::class,
@@ -44,6 +54,11 @@
'class' => Components\FormRadio::class,
],
+ 'form-range' => [
+ 'view' => 'form-components::{framework}.form-range',
+ 'class' => Components\FormRange::class,
+ ],
+
'form-select' => [
'view' => 'form-components::{framework}.form-select',
'class' => Components\FormSelect::class,
diff --git a/resources/views/bootstrap-4/form-range.blade.php b/resources/views/bootstrap-4/form-range.blade.php
new file mode 100644
index 0000000..5bc0747
--- /dev/null
+++ b/resources/views/bootstrap-4/form-range.blade.php
@@ -0,0 +1,26 @@
+
+@enderror
\ No newline at end of file
diff --git a/resources/views/bootstrap-5/form-group.blade.php b/resources/views/bootstrap-5/form-group.blade.php
new file mode 100644
index 0000000..3719afd
--- /dev/null
+++ b/resources/views/bootstrap-5/form-group.blade.php
@@ -0,0 +1,13 @@
+