2017 © Pedro Peláez
 

library form-components

Commonly used form components to make it easier and more flexible to create forms in Blade views

image

pod-point/form-components

Commonly used form components to make it easier and more flexible to create forms in Blade views

  • Tuesday, June 12, 2018
  • by pod-point
  • Repository
  • 2 Watchers
  • 0 Stars
  • 1,487 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 21 Versions
  • 23 % Grown

The README.md

Form Components

Commonly used form components to make it easier and more flexible to create forms in Blade views., (*1)

It is intended to be usable by anyone., (*2)

For ease of use by Pod Point staff, when classes are not specified they default to those used in the Pod Point UI toolkit., (*3)

Editing

To edit this project, clone the repository:, (*4)

git clone git@github.com:Pod-Point/form-components.git

Install the PHP dependencies:, (*5)

cd form-components
composer install

Laravel installation

More commonly, you'll want to import these components for use in Laravel applications (or other frameworks that use Blade)., (*6)

To install it using Composer, require the package:, (*7)

composer require pod-point/form-components:^3.0

Then in Laravel, include the service provider in your config/app.php file:, (*8)

PodPoint\FormComponents\FormComponentsServiceProvider::class,

Usage

You can insert components into Blade views using the form:: package prefix., (*9)

Examples

Button, (*10)

@include('form::_components.button', [
    'name'     => 'myButton', // optional, sets name and id
    'element'  => 'button', // optional, defaults to button
    'text'     => 'Submit',
    'attributes' => [ // optional
        'type'     => 'submit',
        'disabled' => true,
        ...
    ],
    'classes' => [ // optional
        'input' => 'myInputClass', // button - defaults to 'btn'
    ],
])

@include('form::_components.button', [
    'element'  => 'a',
    'text'     => 'Cancel',
    'attributes' => [ // optional
        'href' => 'http://somewhere',
        ...
    ],
])

Checkbox, (*11)

@include('form::_components.checkbox', [
    'name'        => 'myCheckbox', // sets name and id
    'labelText'   => 'Choose option(s)', // optional
    'options'     => [
        'option1' => 'Option 1',
        'option2' => 'Option 2',
    ],
    'values'      => ['option1'], // optional default selected values
    'attributes' => [ // optional
        'disabled' => true,
        ...
    ],
    'classes' => [ // optional
        'formGroup' => 'myFormGroupClass', // outermost container div - defaults to 'form__group'
        'label' => 'myLabelClass', // span that appears above all checkboxes - defaults to 'form__label'
        'inputContainer' => 'myInputContainerClass', // label element container wrapping around each checkbox - defaults to 'checkbox form__field'
        'input' => 'myInputClass', // input checkbox element - defaults to 'form__control'
    ],
])

File upload, (*12)

@include('form::_components.file-upload', [
    'name'       => 'myUpload', // sets name and id
    'labelText'  => 'Upload your file', // optional
    'attributes' => [ // optional
        'disabled' => true,
        ...
    ],
    'classes' => [ // optional
        'formGroup' => 'myFormGroupClass', // container div - defaults to 'form__group'
        'label' => 'myLabelClass', // label that appears above input - defaults to 'form__label'
        'input' => 'myInputClass', // input file upload element - defaults to 'form__control form__field'
    ],
])

Text/password input, (*13)

@include('form::_components.input', [
    'name'        => 'myTextbox', // sets name and id
    'type'        => 'text', // optional, defaults to 'text'
    'value'       => 'Some text', // optional default value
    'labelText'   => 'Type here', // optional
    'explanation' => 'Explanation copy', // optional
    'attributes' => [ // optional 
        'placeholder' => 'A hint to the user',
        'required' => true,
        ...
    ],
    'classes' => [ // optional
        'formGroup' => 'myFormGroupClass', // container div - defaults to 'form__group'
        'label' => 'myLabelClass', // label that appears above input - defaults to 'form__label'
        'input' => 'myInputClass', // input element - defaults to 'form__control form__field'
    ],
])

Radio button(s), (*14)

@include('form::_components.radio', [
    'name'        => 'myRadio', // sets name and id
    'labelText'   => 'Choose an option', // optional
    'options'     => [
        'option1' => 'Option 1',
        'option2' => 'Option 2',
    ],
    'value'       => 'option1', // optional default selected value
    'attributes' => [ // optional
        'disabled' => true,
        ...
    ],
    'classes' => [ // optional
        'formGroup' => 'myFormGroupClass', // outermost container div - defaults to 'form__group'
        'label' => 'myLabelClass', // span that appears above all radio buttons - defaults to 'form__label'
        'inputContainer' => 'myInputContainerClass', // label element container wrapping around each radio button - defaults to 'radio form__field'
        'input' => 'myInputClass', // input radio element - defaults to 'form__control'
    ],
])

Select dropdown, (*15)

@include('form::_components.select', [
    'name'        => 'mySelect', // sets name and id
    'labelText'   => 'Choose an option',
    'options'     => [
        'option1' => 'Option 1',
        'option2' => 'Option 2',
    ],
    'value'       => 'option1', // optional default selected value
    'attributes' => [ // optional 
        'required' => true,
        ...
    ],
    'classes' => [ // optional
        'formGroup' => 'myFormGroupClass', // outermost container div - defaults to 'form__group'
        'label' => 'myLabelClass', // label that appears above input - defaults to 'form__label'
        'inputContainer' => 'myInputContainerClass', // div container wrapping around select - defaults to 'select form__field'
        'input' => 'myInputClass', // select element - defaults to 'form__control'
    ],
])

Textarea, (*16)

@include('form::_components.textarea', [
    'name'       => 'myTextarea', // sets name and id
    'labelText'  => 'Type here', // optional
    'value'      => 'Some text', // optional default value
    'attributes' => [ // optional 
        'placeholder' => 'A hint to the user',
        'required' => true,
        ...
    ],
    'classes' => [ // optional
        'formGroup' => 'myFormGroupClass', // container div - defaults to 'form__group'
        'label' => 'myLabelClass', // label that appears above input - defaults to 'form__label'
        'input' => 'myInputClass', // textarea element - defaults to 'form__control form__field'
    ],
])

Grouped typeahead select (Please note this depends on the typeahead JS file), (*17)

@include('form::_components.grouped-typeahead', [
    'name'        => 'phoneNumber', // sets name and of the number field
    'countryName' => 'country', // sets name and id of the country select field
    'labelText'   => 'Type here', // optional
    'options'     => $countryCodeOptions,
    'value'       => 'GB',
    'attributes' => [
        'required' => true,
        ...
    ],
    'classes' => [ // optional
        'formGroup' => 'myFormGroupClass', // outermost container div - defaults to 'form__group'
        'label' => 'myLabelClass', // label that appears above input - defaults to 'form__label'
    ],
])

Attributes

Some key attributes e.g. name can be set directly (see examples above for each component)., (*18)

For all components, any additional attributes can be set using the attributes array. These are optional., (*19)

attributes can take text values where needed, e.g., (*20)

...
    'attributes' => [
        'type' => 'submit',
    ],
...

or they can take boolean values - if a boolean value is used the attribute will be included if true e.g. <input disabled> or omitted if false e.g. <input>, (*21)

...
    'attributes' => [
        'disabled' => true,
    ],
...

Classes

For all components, all classes are optional., (*22)

If an element's class is not specified, it defaults to the appropriate class(es) from the Pod Point UI toolkit - see each component below for details., (*23)

If you want an element to have no class set at all, set that element's class to '' e.g., (*24)

...
    'classes' => [
        'input' => '',
    ],
...

The Versions

12/06 2018

dev-bootstrap-datetimepicker

dev-bootstrap-datetimepicker

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

12/06 2018

dev-feature/add-datetimepicker2

dev-feature/add-datetimepicker2

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

19/02 2018

dev-master

9999999-dev

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

19/02 2018

v3.2.3

3.2.3.0

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

19/02 2018

v3.2.2

3.2.2.0

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

19/02 2018

dev-explanation

dev-explanation

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

09/01 2018

3.2.2

3.2.2.0

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

09/01 2018

dev-fix-typeahead-overlapped-fields-on-loading

dev-fix-typeahead-overlapped-fields-on-loading

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

24/11 2017

v3.2.1

3.2.1.0

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

23/10 2017

v3.2.0

3.2.0.0

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

20/10 2017

v3.1.0

3.1.0.0

Commonly used form components to make it easier and more flexible to create forms in Blade views

  Sources   Download

MIT

The Requires

 

The Development Requires

by Joe Hall

laravel php form blade components

14/09 2017

v3.0.1

3.0.1.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires

13/09 2017

v3.0.0

3.0.0.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires

11/09 2017

v2.0.0

2.0.0.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires

01/09 2017

v1.0.6

1.0.6.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires

01/09 2017

v1.0.5

1.0.5.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires

20/07 2017

v1.0.4

1.0.4.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires

20/06 2017

v1.0.3

1.0.3.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires

20/06 2017

v1.0.2

1.0.2.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires

20/06 2017

v1.0.1

1.0.1.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires

19/06 2017

v1.0

1.0.0.0

Form components for POD Point websites

  Sources   Download

proprietary

The Requires

 

The Development Requires