Skip to content
This repository was archived by the owner on Jan 2, 2024. It is now read-only.

Commit 9f5d2ac

Browse files
authored
Update README.md
1 parent 700dfdb commit 9f5d2ac

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ composer require protonemedia/laravel-form-components
3636

3737
Make sure the [Tailwind plugin](https://github.com/tailwindcss/custom-forms#install) is installed and added to your `tailwind.config.js` file. If you're starting a new project, you can use the [Frontend preset for Tailwind CSS](https://github.com/laravel-frontend-presets/tailwindcss) which includes the Custom Forms plugin as well.
3838

39-
## Configuration
40-
41-
There is no configuration needed unless you want to [customize the Blade views and components](#customize-the-blade-views).
42-
4339
## Quick example
4440

4541
```blade
@@ -71,9 +67,7 @@ There is no configuration needed unless you want to [customize the Blade views a
7167

7268
<img src="https://github.com/pascalbaljetmedia/laravel-form-components/blob/master/quick-example-form.png?raw=true" width="450" />
7369

74-
## Usage
75-
76-
### Preface
70+
## Preface
7771

7872
Generating HTML in PHP is always quite opinionated and limited. Blade Components are great because additional attributes are passed down to the element. That's why we prefer writing forms using components instead of using PHP builders. This way, you don't have to write extensions or custom code for any attribute you pass in. Let's take a look at this `x-form` example.
7973

@@ -91,6 +85,12 @@ The `action` attribute is optional, but you can pass a hard-coded, primitive val
9185
</x-form>
9286
```
9387

88+
## Configuration
89+
90+
There is no configuration needed unless you want to [customize the Blade views and components](#customize-the-blade-views).
91+
92+
## Usage
93+
9494
### Input and textarea elements
9595

9696
The minimum requirement for an `input` or `textarea` is the `name` attribute.
@@ -239,6 +239,15 @@ $countries = [
239239
<x-form-select name="country_code" :options="$countries" />
240240
```
241241

242+
You can provide a *slot* to the `select` element as well:
243+
244+
```blade
245+
<x-form-select name="country_code">
246+
<option value="be">Belgium</option>
247+
<option value="nl">The Netherlands</option>
248+
</x-form-select>
249+
```
250+
242251
If you want a select element where multiple options can be selected, add the `multiple` attribute to the element. If you specify a default, make sure it is an array. This applies to bound targets as well.
243252

244253
```blade

0 commit comments

Comments
 (0)