obregonco/yii2-semantic-ui

Semantic UI extension for Yii2

2.0.10 2017-02-06 00:06 UTC

This package is auto-updated.

Last update: 2024-11-13 05:21:18 UTC


README

Semantic UI extension for Yii2

Installation

yii2-semantic-ui 2.* works with Semantic UI 2.*

Composer

The preferred way to install this extension is through Composer.

Either run

php composer.phar require obregonco/yii2-semantic-ui "~2"

or add

"obregonco/yii2-semantic-ui": "~2"

to the require section of your composer.json

Usage

Add SemanticUICSSAsset to AppAsset:

<?php

namespace backend\assets;

use yii\web\AssetBundle;

class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [];
    public $js = [];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\web\JqueryAsset',
        'obregonco\SemanticUI\assets\SemanticUICSSAsset'
    ];
}

Use Semantic UI widgets and elements. Standard Yii2 widgets also adopted.

You may replace yii2 standard widgets. Write in bootstrap.php:

Yii::$container->set(\yii\grid\GridView::className(), \obregonco\SemanticUI\widgets\GridView::class);
Yii::$container->set(\yii\widgets\ActiveForm::className(), \obregonco\SemanticUI\widgets\ActiveForm::class);
Yii::$container->set(\yii\bootstrap\ActiveForm::className(), \obregonco\SemanticUI\widgets\ActiveForm::class);
Yii::$container->set(\yii\widgets\Breadcrumbs::className(), \obregonco\SemanticUI\collections\Breadcrumb::class);
Yii::$container->set(\yii\grid\CheckboxColumn::className(), \obregonco\SemanticUI\widgets\CheckboxColumn::class);

Be very careful with it.

Examples

  • Inside an ActiveForm object
                $form->field($model, 'username')->label(false)->textInput([
                    'autofocus' => true,
                    'placeHolder' => $model->getAttributeLabel('username'),
                    'uiOptions' => [
                            'appendTo' => '<i class="user icon"></i>',
                            'class' => 'ui left icon input',
                    ]
                ])

Author

Obregon.co Ricardo O

Credits

Original maintainer Aleksandr Zelenin