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

Commit 160e08c

Browse files
committed
Update README.md
1 parent 8fd36b1 commit 160e08c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ todo
6464

6565
### Input and textarea elements
6666

67-
The minimum requirement for an `input` or `textarea` is a `name` attribute.
67+
The minimum requirement for an `input` or `textarea` is the `name` attribute.
6868

6969
```blade
7070
<x-form-input name="company_name" />
@@ -136,6 +136,27 @@ You can even mix targets!
136136
</x-form>
137137
```
138138

139+
## Select
140+
141+
Besides the `name` attribute, the `select` element has a required `options` attribute, which should be a simple *key-value* array.
142+
143+
```php
144+
$countries = [
145+
'be' => 'Belgium',
146+
'nl' => 'The Netherlands',
147+
];
148+
```
149+
150+
```blade
151+
<x-form-select name="country_code" :options="$countries" />
152+
```
153+
154+
If you want a select 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.
155+
156+
```blade
157+
<x-form-select name="country_code" :options="$countries" multiple :default="['be', 'nl']" />
158+
```
159+
139160
### Testing
140161

141162
``` bash

0 commit comments

Comments
 (0)