An open API service indexing awesome lists of open source software.

https://github.com/dcblogdev/laravel-blade-components

Laravel Blade components collection
https://github.com/dcblogdev/laravel-blade-components

Last synced: 8 months ago
JSON representation

Laravel Blade components collection

Awesome Lists containing this project

README

          

## Community

There is a Discord community. https://discord.gg/VYau8hgwrm For quick help, ask questions in the appropriate channel.

# Laravel Blade components collection

[![Latest Version on Packagist](https://img.shields.io/packagist/v/dcblogdev/laravel-blade-components.svg?style=flat-square)](https://packagist.org/packages/dcblogdev/laravel-blade-components)
[![Total Downloads](https://img.shields.io/packagist/dt/dcblogdev/laravel-blade-components.svg?style=flat-square)](https://packagist.org/packages/dcblogdev/laravel-blade-components)

Re-usable Laravel Blade components for your projects

## Installation

You can install the package via composer:

```bash
composer require dcblogdev/laravel-blade-components
```

## Usage

## Form components

* [Open](#open)
* [Input](#form-input)
* [Textarea](#form-textarea)
* [Checkbox](#form-checkbox)
* [Radio](#form-radio)
* [Select](#form-select)
* [Button](#form-button)

All form components accept option parameters that such as class='' style=''

> When the method is set to PUT, PATCH or DELETE the @method() will be applied automatically.
### Open

Defaults to post method and CSRF token

``` php

```

The method and actions can be passed:

``` php

```

### Form input

Create an input with a name, the name will be used as the label as long as the label is not provided.

```php

```

Outputs:

```HTML


Username


```

Use a label

```php

```

Use an id and a class

```php

```

The type is set to test by default, it can be changed

```php

```

Set the input value

```php
{{ $username }}
```

### Form textarea

```php

```

Set the rows and columns

```php

```

Set the textarea data

```php
{{ $comments }}
```

### Form checkbox

A checkbox can also be defined, set the name and value

```php

```

Check the checkbox by passing its value, as long its a match the checkbox will be checked.

```php
1
```

or

```php
{{ $terms }}
```

### Form radio

A radio can also be defined, set the name, label and value

```php

```

Pass a value which will check the matching radio.

```php
{{ $result }}
{{ $result }}
{{ $result }}
```

Check the checkbox by passing its value, as long its a match the checkbox will be checked.

```php
1
```

or

```php
{{ $terms }}
```

### Form select

create a select menu set the name and placeholder for the initial option

```php

```

Leave off the placeholder to have only the select and options that can be selected

```php

```

In order to set the option an array is needed and is looped over and then a nested component is used.

Pass in the key and value from the array

```php
@php
$options = [1 => 'one', 2 => 'two', 3 => 'three'];
@endphp

@foreach($options as $key => $value)

@endforeach

```

### Form button

Create a button, defaults to a submit type

```php
Submit
```

Create a button, using only the defaults and a label

```php
Submit
```

### Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

## Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

If you discover any security related issues, please email dave@dcblog.dev instead of using the issue tracker.

## Credits

- [David Carr](https://github.com/dcblogdev)
- [All Contributors](../../contributors)

## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.