diff --git a/README.md b/README.md index 9328182..b66d205 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,15 @@ we support livewire loading state, so if you use livewire you can use loading st ``` +### Select component +```html + +``` +He accept all normal attributes of select tag and add some new attributes: +- div-class: add class to div tag +- label-class: add class to label tag +- other attributes will be added to select tag + ## Supported Templates - [Vuexy](https://pixinvent.com/demo/vuexy-html-bootstrap-admin-template/html/ltr/vertical-menu-template/dashboard-ecommerce.html) diff --git a/config/template-components.php b/config/template-components.php index 1c1e426..d9099be 100644 --- a/config/template-components.php +++ b/config/template-components.php @@ -14,6 +14,13 @@ 'button' => 'btn', 'indicator-progress' => 'd-block', 'spinner-class' => 'spinner-border spinner-border-sm', - ] + ], + 'select' => [ + 'div' => '', + 'label' => 'form-label', + 'select' => 'form-select', + 'error-div' => 'invalid-feedback', + 'select-error' => 'is-invalid', + ], ], ]; diff --git a/resources/views/components/select.blade.php b/resources/views/components/select.blade.php new file mode 100644 index 0000000..ac61093 --- /dev/null +++ b/resources/views/components/select.blade.php @@ -0,0 +1,20 @@ +
+ + + + + + @error($attributes->get('name') ?? $attributes->whereStartsWith('wire:model')->first()) +
+ {{ $message }} +
+ @enderror +
diff --git a/tests/components/SelectComponentTest.php b/tests/components/SelectComponentTest.php new file mode 100644 index 0000000..0e522c5 --- /dev/null +++ b/tests/components/SelectComponentTest.php @@ -0,0 +1,9 @@ +assertTrue(View::exists('template-components::select')); +});