okipa/laravel-toggle-switch-button
最新稳定版本:2.0.5
Composer 安装命令:
composer require okipa/laravel-toggle-switch-button
包简介
A customizable toggle switch button generator for Laravel.
关键字:
README 文档
README
Package abandonned in profit of https://github.com/Okipa/laravel-bootstrap-components package.
A customizable and configurable toggle switch button generator for Laravel that enables you to simply display it on your projects pages.
Installation
Versions
- V1 :
composer require okipa/laravel-toggle-switch-button:^1.0.0 - V2 :
composer require okipa/laravel-toggle-switch-button:^2.0.0
For Laravel >=5.4 only
Add the package service provider in the register() method from your app/Providers/AppServiceProvider.php :
// laravel toggle switch button // https://github.com/Okipa/laravel-toggle-switch-button $this->app->register(Okipa\LaravelToggleSwitchButton\ToggleSwitchButtonServiceProvider::class);
Styles import
- Load the package
SASSorCSSfile from the[path/to/composer/vendor]/okipa/laravel-toggle-switch-button/stylesdirectory to your project.
Usage
Since the toggle switch button implements the Htmlable interface, just call it this way in your blade file :
{{ toggleSwitchButton()
->name('active')
->checked(old('active') or $model->active)
->icon('<i class="fas fa-power-off"></i>')
->label('Activation') }}
API
Public methods See the available public methods in the ToggleSwitchButton class
Customize styles
If you use CSS, just override the package styles.
If you use SASS, you can override the following variables before the package SASS file import. Check the following example for a bootstrap use :
// bootstrap 4 example $toggle-switch-button-label-background-color: $input-group-addon-bg; $toggle-switch-button-label-border-color: $input-group-addon-border-color; $toggle-switch-button-label-font-size: $font-size-base; $toggle-switch-button-unchecked-background-color: $input-group-addon-border-color; $toggle-switch-button-checked-background-color: $primary; $toggle-switch-button-label-border-radius: $btn-border-radius; @import '[path/to/composer/vendor]/okipa/laravel-toggle-switch-button/styles/styles';
Customize templates
Publish the package blade templates file in your project :
php artisan vendor:publish --tag=toggle-switch-button::views
Then, change the content from your resources/views/vendor/components/switch-button.blade.php file.
Contributors
统计信息
- 总下载量: 1.59k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-06-15
