Skip to content

Commit 21e2c10

Browse files
committed
Update the docs.
1 parent 53a153a commit 21e2c10

File tree

4 files changed

+64
-56
lines changed

4 files changed

+64
-56
lines changed

examples.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,23 @@ class CreateClientForm extends FormComponent
1919
public function fields()
2020
{
2121
return [
22-
Input::make('name', 'Name')
23-
->col_md()
24-
->placeholder('Full Name'),
25-
Input::make('email', 'Email')
26-
->type('email')
27-
->placeholder('Email, example: [email protected]')
28-
->col_md(),
29-
Select::make('gender', 'Gender')
30-
->placeholder('Gender')
31-
->options(['Male', 'Female'])
32-
->col_md()
33-
->addAttrs(['class' => 'd-block w-full']),
34-
Input::make('phone_no', 'Contact Number')
35-
->placeholder('(xxx) xxx xxxxx')
36-
->col_md(),
37-
Input::make('street_address', 'Street Address')
38-
->col_md(),
39-
Input::make('city', 'City')
40-
->col_md(),
41-
Input::make('state', 'State / Parist')
42-
->col_md(),
43-
Input::make('country', 'Country')
44-
->col_md(),
22+
Row::make()->fields([
23+
Input::make('name', 'Name')
24+
->placeholder('Full Name'),
25+
Input::make('email', 'Email')
26+
->type('email')
27+
->placeholder('Email, example: [email protected]'),
28+
Select::make('gender', 'Gender')
29+
->placeholder('Gender')
30+
->options(['Male', 'Female'])
31+
->addAttrs(['class' => 'd-block w-full']),
32+
Input::make('phone_no', 'Contact Number')
33+
->placeholder('(xxx) xxx xxxxx'),
34+
Input::make('street_address', 'Street Address'),
35+
Input::make('city', 'City'),
36+
Input::make('state', 'State / Parist'),
37+
Input::make('country', 'Country'),
38+
])
4539
];
4640
}
4741

readme.md

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,6 @@ Input::make('name', 'Name')->lazy(), // bind on change
166166
Input::make('name', 'Name')->debounce(500), // bind after 500ms delay
167167
```
168168

169-
## Bootstrap Grid
170-
171-
Many fields also allow you to specify a bootstrap column size for the input e.g.:
172-
173-
```php
174-
Input::make('name', 'Name')->col_size('col-md-9'), // Update the default column size
175-
Input::make('name', 'Name')->col_sm(), // Update the default column size to small
176-
Input::make('name', 'Name')->col_md(), // Update the default column size to medium
177-
Input::make('name', 'Name')->col_lg(), // Update the default column size to large
178-
```
179169

180170
## Sizing
181171

@@ -234,6 +224,26 @@ Arrayable::make('locations', 'Locations')->fields([
234224

235225
Available methods: `fields`, `help`, `disabled`
236226

227+
228+
229+
### Bootstrap Grid
230+
231+
A bootstrap support to the form.
232+
233+
#### Row `($label = null)` and RowColumn `($label = null)`
234+
235+
An array of fields display in a Bootstrap Row or Column
236+
237+
```php
238+
Row::make()->fields([
239+
Input::make('city')->placeholder('City'),
240+
Select::make('state')->placeholder('State')->options(['FL', 'TX']),
241+
]),
242+
```
243+
244+
Available methods: `fields`, `help`, `disabled`, `isColumn`, `col_class`
245+
246+
237247
### Button `($label = 'Submit', $style = 'primary')`
238248

239249
A button used for actions and links.
@@ -404,29 +414,23 @@ class CreateClientForm extends FormComponent
404414
public function fields()
405415
{
406416
return [
407-
Input::make('name', 'Name')
408-
->col_md()
409-
->placeholder('Full Name'),
410-
Input::make('email', 'Email')
411-
->type('email')
412-
->placeholder('Email, example: [email protected]')
413-
->col_md(),
414-
Select::make('gender', 'Gender')
415-
->placeholder('Gender')
416-
->options(['Male', 'Female'])
417-
->col_md()
418-
->addAttrs(['class' => 'd-block w-full']),
419-
Input::make('phone_no', 'Contact Number')
420-
->placeholder('(xxx) xxx xxxxx')
421-
->col_md(),
422-
Input::make('street_address', 'Street Address')
423-
->col_md(),
424-
Input::make('city', 'City')
425-
->col_md(),
426-
Input::make('state', 'State / Parist')
427-
->col_md(),
428-
Input::make('country', 'Country')
429-
->col_md(),
417+
Row::make()->fields([
418+
Input::make('name', 'Name')
419+
->placeholder('Full Name'),
420+
Input::make('email', 'Email')
421+
->type('email')
422+
->placeholder('Email, example: [email protected]'),
423+
Select::make('gender', 'Gender')
424+
->placeholder('Gender')
425+
->options(['Male', 'Female'])
426+
->addAttrs(['class' => 'd-block w-full']),
427+
Input::make('phone_no', 'Contact Number')
428+
->placeholder('(xxx) xxx xxxxx'),
429+
Input::make('street_address', 'Street Address'),
430+
Input::make('city', 'City'),
431+
Input::make('state', 'State / Parist'),
432+
Input::make('country', 'Country'),
433+
])
430434
];
431435
}
432436

src/Components/Row.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ public function isColumn($field) {
4747
return Column::class == get_class($field);
4848
}
4949

50+
public function col_size($col="mb-2") {
51+
$this->column_class = "$col mb-2 mb-md-0";
52+
return $this;
53+
}
54+
5055
public function render()
5156
{
5257
$row = $this;

src/Components/RowColumn.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ public static function make($label = null)
3434
return $component;
3535
}
3636

37+
public function col_size($col="mb-2") {
38+
$this->column_class = "$col mb-2 mb-md-0";
39+
return $this;
40+
}
41+
3742
public function fields($fields = [])
3843
{
3944
$this->props['fields'] = $fields;

0 commit comments

Comments
 (0)