2017 © Pedro Peláez
 

library pure-css-switch

Pure CSS Switch Button for WP Bones

image

wpbones/pure-css-switch

Pure CSS Switch Button for WP Bones

  • Saturday, February 11, 2017
  • by gfazioli
  • Repository
  • 1 Watchers
  • 0 Stars
  • 104 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 1 % Grown

The README.md

Pure CSS Switch Button for WP Bones

[![Latest Stable Version](https://poser.pugx.org/wpbones/pure-css-switch/v/stable?style=for-the-badge)](https://packagist.org/packages/wpbones/pure-css-switch)   [![Latest Unstable Version](https://poser.pugx.org/wpbones/pure-css-switch/v/unstable?style=for-the-badge)](https://packagist.org/packages/wpbones/pure-css-switch)   [![Total Downloads](https://poser.pugx.org/wpbones/pure-css-switch/downloads?style=for-the-badge)](https://packagist.org/packages/wpbones/pure-css-switch)   [![License](https://poser.pugx.org/wpbones/pure-css-switch/license?style=for-the-badge)](https://packagist.org/packages/wpbones/pure-css-switch)   [![Monthly Downloads](https://poser.pugx.org/wpbones/pure-css-switch/d/monthly?style=for-the-badge)](https://packagist.org/packages/wpbones/pure-css-switch)

Pure CSS Switch Button for WordPress/WP Bones, (*1)

Pure CSS Switch Button for WP Bones, (*2)

Requirements

This package works with a WordPress plugin written with WP Bones framework library., (*3)

Installation

You can install third party packages by using:, (*4)

```sh copy php bones require wpbones/pure-css-switch, (*5)


I advise to use this command instead of `composer require` because doing this an automatic renaming will done. You can use composer to install this package: ```sh copy composer require wpbones/pure-css-switch

You may also to add " wpbones/pure-css-switch": "~0.7" in the composer.json file of your plugin:, (*6)

```json copy filename="composer.json" {4} "require": { "php": ">=7.4", "wpbones/wpbones": "~1.5", " wpbones/pure-css-tabs": "~0.7" },, (*7)


and run ```sh copy composer install

Development installation

Use yarn to install the development tools. Next, use gulp --production to compile the resources., (*8)

Enqueue for Controller

You can use the provider to enqueue the styles., (*9)

public function index()
{
  // enqueue the minified version
  PureCSSSwitchProvider::enqueueStyles();

  // ...

}

PureCSSSwitchProvider

This is a static class autoloaded by composer. You can use it to enqueue or get the styles path:, (*10)

// enqueue the minified version
PureCSSSwitchProvider::enqueueStyles();

// enqueue the flat version
PureCSSSwitchProvider::enqueueStyles( false );

// return the absolute path of the minified css
PureCSSSwitchProvider::css();

// return the absolute path of the flat css
PureCSSSwitchProvider::css();

Mode

To default the switch works as on/off button. You can change the mode by setting mode property,, (*11)

<?php echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-7' )
            ->mode( 'select' ); ?>

In the above example, you can use it as selector instead of on/off button., (*12)

Theme

Of course, you can switch theme by using theme property ot its fluent version. Currently, we support two theme:, (*13)

  • flat-round - default
  • flat-square

You should use something look like:, (*14)

<?php echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-7' )
            ->theme( 'flat-square' ); ?>

Examples

In your view you can use the WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton class, (*15)

```php copy filename="Simple Usage" echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-1' );, (*16)


```php copy filename="Left Label" echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-2' ) ->left_label( 'Swipe me' );

```php copy filename="Right Label" echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-3' ) ->right_label( 'Swipe me' );, (*17)


```php copy filename="Both Labels" echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-4' ) ->left_label( 'Swipe me' ) ->right_label( 'Swipe me' );

```php copy filename="Checked" echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-5' ) ->left_label( 'Swipe me' ) ->checked( true );, (*18)


```php copy filename="Disabled" echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-6' ) ->left_label( 'Swipe me' ) ->disabled( true );

```php copy filename="Theme" echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-7' ) ->theme( 'flat-square' );, (*19)


```php copy filename="Mode" echo WPKirk\PureCSSSwitch\Html\HtmlTagSwitchButton::name( 'test-switch-8' ) ->left_label( 'Turn left' ) ->right_label( 'Turn right' ) ->mode( 'select' );

The Versions

11/02 2017

dev-master

9999999-dev https://github.com/wpbones/pure-css-switch

Pure CSS Switch Button for WP Bones

  Sources   Download

MIT

css less wp bones

11/02 2017

dev-develop

dev-develop https://github.com/wpbones/pure-css-switch

Pure CSS Switch Button for WP Bones

  Sources   Download

MIT

css less wp bones

11/02 2017

1.0.9

1.0.9.0 https://github.com/wpbones/pure-css-switch

Pure CSS Switch Button for WP Bones

  Sources   Download

MIT

css less wp bones

08/01 2017

1.0.8

1.0.8.0 https://github.com/wpbones/pure-css-switch

Pure CSS Switch Button for WP Bones

  Sources   Download

MIT

css less wp bones

07/01 2017

1.0.7

1.0.7.0 https://github.com/wpbones/pure-css-switch

Pure CSS Switch Button for WP Bones

  Sources   Download

MIT

css less wp bones

25/11 2016

1.0.6

1.0.6.0 https://github.com/wpbones/pure-css-switch

Pure CSS Switch Button for WP Bones

  Sources   Download

MIT

css less wp bones

25/11 2016

1.0.5

1.0.5.0 https://github.com/wpbones/pure-css-switch

Pure CSS Switch Button for WP Bones

  Sources   Download

MIT

css less wp bones