Coder Social home page Coder Social logo

okipa / laravel-toggle-switch-button Goto Github PK

View Code? Open in Web Editor NEW
3.0 4.0 3.0 68 KB

A customizable toggle switch button generator for Laravel that enables you to simply display it on your projects pages.

License: MIT License

PHP 52.66% CSS 41.30% HTML 6.04%
laravel php toggle switch button generate generator generation html okipa package

laravel-toggle-switch-button's Introduction

laravel-toggle-switch-button

Package abandonned in profit of https://github.com/Okipa/laravel-bootstrap-components package.

Source Code Latest Version Total Downloads License: MIT Code Coverage Scrutinizer Code Quality

A customizable and configurable toggle switch button generator for Laravel that enables you to simply display it on your projects pages.

Laravel Toggle Switch Button


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 SASS or CSS file from the [path/to/composer/vendor]/okipa/laravel-toggle-switch-button/styles directory 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

laravel-toggle-switch-button's People

Contributors

okipa avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.