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
- Host: GitHub
- URL: https://github.com/dcblogdev/laravel-blade-components
- Owner: dcblogdev
- License: mit
- Created: 2020-07-11T00:00:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-24T23:45:06.000Z (12 months ago)
- Last Synced: 2025-04-23T14:02:22.459Z (10 months ago)
- Language: Blade
- Homepage:
- Size: 55.7 KB
- Stars: 37
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
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
[](https://packagist.org/packages/dcblogdev/laravel-blade-components)
[](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.