2017 © Pedro Peláez
 

library pure-css-tabs

Pure CSS tabs for WP Bones

image

wpbones/pure-css-tabs

Pure CSS tabs for WP Bones

  • Saturday, March 11, 2017
  • by gfazioli
  • Repository
  • 1 Watchers
  • 0 Stars
  • 151 Installations
  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 1 % Grown

The README.md

Pure CSS Tabs for WP Bones

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

This package provides a simple way to create tabs with pure CSS for WordPress/WP Bones., (*1)

Pure CSS Tabs for WP Bones, (*2)

## Requirements, (*3)

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

Installation

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

```sh copy php bones require wpbones/pure-css-tabs, (*6)


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-tabs

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

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


and run ```sh copy composer install

Enqueue for Controller

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

```php copy public function index() { // enqueue the minified version PureCSSTabsProvider::enqueueStyles();, (*10)

// ..., (*11)

}, (*12)


## PureCSSTabsProvider This is a static class autoloaded by composer. You can use it to enqueue or get the styles path: ```php copy // enqueue the minified version PureCSSTabsProvider::enqueueStyles(); // enqueue the flat version PureCSSTabsProvider::enqueueStyles( false ); // return the absolute path of the minified css PureCSSTabsProvider::css(); // return the absolute path of the flat css PureCSSTabsProvider::css();

HTML markup

```html copy , (*13)


Of course, you may use the **fragment** feature to include the single tabs: ```html copy
view( 'folder.tab1' ) ?> view( 'folder.tab2' ) ?>

In /folder/tab1.php you just insert the following markup:, (*14)

```html copy , (*15)

Content


## Customize Of course, you can edit both of CSS or LESS files in order to change the appearance of tabs. In the LESS file, you'll find the color variable as well. ```less copy @wpbones-tab-border-color : #aaa; @wpbones-tab-responsive-accordion-border : #ddd; @wpbones-tab-disabled : #ddd; @wpbones-tab-content-color : #fff;

💡 Anyway, the best way to customize your tabs is override the default styles. Otherwise, when an update will be done you'll lose your customization., (*16)

Helper

In addition, you can use some methods provided by PureCSSTabsProvider class. In your HTML view you might use:, (*17)

```php copy /** * Display tabs by array * * self::tabs( * 'tab-1' => [ 'label' => 'Tab 1', 'content' => 'Hello', 'selected' => true ], * 'tab-2' => [ 'label' => 'Tab 1', 'content' => 'Hello' ], * ... * ); * * @param array $array */ WPKirk\PureCSSTabs\PureCSSTabsProvider::tabs( 'tab-1' => [ 'label' => 'Tab 1', 'content' => 'Hello', 'selected' => true ], 'tab-2' => [ 'label' => 'Tab 1', 'content' => 'Hello' ], ... );, (*18)


Also, you can use `openTab()` and `closeTab()` methods: ```php copy /** * Display the open tab. * * @param string|array $label The label of tab or un array with [label, group] * @param null $id Optional. ID of tab. If null, will sanitize_title() the label. * @param bool $selected Optional. Default false. TRUE for checked. * @param string $group Optional. Group of tabs when you want to handle multiple tab in the same view. Default 'tabs' */ public static function openTab( $label, $id = null, $selected = false ) {}

```html copy, (*19)

Hello, world! I'm the content of tab-1

Hello, world! I'm the content of tab-2


You may also use the hook approach by using `::useTabs()` ```php copy

Content for Settings

Content for Dashboard

👆 Remember, in the example above I have used WPKirk base namespace. You should replace it with your own namespace., (*20)

The Versions

11/03 2017

dev-master

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

Pure CSS tabs for WP Bones

  Sources   Download

MIT

css less wp bones

11/03 2017

dev-develop

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

Pure CSS tabs for WP Bones

  Sources   Download

MIT

css less wp bones

11/03 2017

1.0.11

1.0.11.0 https://github.com/wpbones/pure-css-tabs

Pure CSS tabs for WP Bones

  Sources   Download

MIT

css less wp bones

07/01 2017

1.0.10

1.0.10.0 https://github.com/wpbones/pure-css-tabs

Pure CSS tabs for WP Bones

  Sources   Download

MIT

css less wp bones

11/11 2016

1.0.9

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

Pure CSS tabs for WP Bones

  Sources   Download

MIT

css less wp bones

10/11 2016

1.0.8

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

Pure CSS tabs for WP Bones

  Sources   Download

MIT

css less wp bones