PHPackages                             iguazoft/yii2-daisyui - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. iguazoft/yii2-daisyui

ActiveYii2-extension

iguazoft/yii2-daisyui
=====================

DaisyUI components for Yii2 framework — full widget library with ActiveForm, GridView and 37+ components

v1.0.0(2mo ago)00MITPHPPHP &gt;=8.0

Since Mar 10Pushed 2mo agoCompare

[ Source](https://github.com/dannyrios81/yii2-daisyui)[ Packagist](https://packagist.org/packages/iguazoft/yii2-daisyui)[ RSS](/packages/iguazoft-yii2-daisyui/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

yii2-daisyui
============

[](#yii2-daisyui)

[![Latest Stable Version](https://camo.githubusercontent.com/a739e919e93a8568e9cb691da04ef27b5e12e40c580b99694d648537774fb254/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696775617a6f66742f796969322d646169737975692e737667)](https://packagist.org/packages/iguazoft/yii2-daisyui)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/854124dd57cfd3aad3184fca9760bf1f33a5ec1e5d080cfbe8aa4e3337ba46e6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e302d3838393242462e737667)](https://php.net)

A complete **DaisyUI** component library for **Yii2**, covering all 37+ DaisyUI components as PHP widgets — with full `ActiveForm`, `ActiveField`, `GridView`, and theme switching support.

No JavaScript build step required. Uses Tailwind CSS and DaisyUI via CDN by default.

---

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- Yii2 &gt;= 2.0

---

Installation
------------

[](#installation)

```
composer require iguazoft/yii2-daisyui
```

The extension auto-registers via Composer's `extra.bootstrap` — no manual configuration needed.

---

Configuration (optional)
------------------------

[](#configuration-optional)

```
// config/web.php
'params' => [
    'daisyui' => [
        'theme'  => 'light',   // default data-theme applied on every page
        'useCdn' => true,      // set false to use a local Tailwind/DaisyUI build
    ],
],
```

### Using a local build (production)

[](#using-a-local-build-production)

```
// config/web.php
'params' => [
    'daisyui' => ['useCdn' => false],
],
```

Register your compiled CSS in `AppAsset`:

```
public $css = ['css/app.css'];  // built with Tailwind + DaisyUI
```

---

Quick Start
-----------

[](#quick-start)

```
use iguazoft\daisyui\widgets\Alert;
use iguazoft\daisyui\widgets\Button;
use iguazoft\daisyui\widgets\Card;
use iguazoft\daisyui\form\ActiveForm;

// Button
echo Button::widget(['label' => 'Save', 'variant' => 'btn-primary']);

// Alert
echo Alert::widget([
    'type'        => 'alert-success',
    'title'       => 'Done!',
    'body'        => 'Record saved successfully.',
    'dismissible' => true,
]);

// Card
echo Card::widget([
    'title'   => 'My Card',
    'body'    => 'Some content here.',
    'actions' => Button::widget(['label' => 'Read more', 'variant' => 'btn-primary']),
]);

// Form
$form = ActiveForm::begin(['id' => 'my-form']);
echo $form->field($model, 'name')->textInput(['placeholder' => 'Full name']);
echo $form->field($model, 'email')->textInput(['placeholder' => 'you@example.com']);
echo $form->field($model, 'role')->dropdownList(['admin' => 'Admin', 'user' => 'User']);
echo $form->field($model, 'active')->toggle();
ActiveForm::end();
```

---

Component Reference
-------------------

[](#component-reference)

### Actions

[](#actions)

#### Button

[](#button)

```
use iguazoft\daisyui\widgets\Button;

echo Button::widget([
    'label'   => 'Primary',
    'variant' => 'btn-primary',   // btn-secondary | btn-accent | btn-ghost | btn-link | btn-error | ...
    'size'    => 'btn-sm',        // btn-xs | btn-sm | btn-md | btn-lg
    'outline' => true,
    'loading' => false,
    'wide'    => false,
    'block'   => false,
    'url'     => '/some/path',    // renders  instead of
    'options' => ['type' => 'submit'],
]);
```

#### Swap

[](#swap)

```
use iguazoft\daisyui\widgets\Swap;

echo Swap::widget([
    'on'     => 'moon',
    'off'    => 'sun',
    'rotate' => true,
]);
```

#### Dropdown

[](#dropdown)

```
use iguazoft\daisyui\widgets\Dropdown;

echo Dropdown::widget([
    'label'    => 'Options',
    'position' => 'dropdown-end',
    'items'    => [
        ['label' => 'Profile',  'url' => '/profile'],
        ['label' => 'Settings', 'url' => '/settings'],
        '-',
        ['label' => 'Logout',   'url' => '/logout'],
    ],
]);
```

#### Modal

[](#modal)

```
use iguazoft\daisyui\widgets\Modal;
use yii\helpers\Html;

// Trigger
echo Html::button('Open', ['onclick' => "document.getElementById('my-modal').showModal()", 'class' => 'btn']);

// Modal definition
echo Modal::widget([
    'options' => ['id' => 'my-modal'],
    'title'   => 'Confirm',
    'body'    => 'Are you sure?',
    'actions' => Html::button('Cancel', ['class' => 'btn', 'onclick' => "document.getElementById('my-modal').close()"])
              . Html::button('Confirm', ['class' => 'btn btn-primary']),
]);

// Or with begin/end for custom content:
Modal::begin(['options' => ['id' => 'custom-modal'], 'title' => 'Edit User']);
echo 'Custom content inside the modal.';
Modal::end();
```

---

### Data Display

[](#data-display)

#### Alert

[](#alert)

```
use iguazoft\daisyui\widgets\Alert;

echo Alert::widget([
    'type'        => 'alert-success',  // alert-info | alert-warning | alert-error
    'title'       => 'Success!',       // optional bold title
    'body'        => 'Operation completed.',
    'dismissible' => true,
    'icon'        => '',               // custom SVG, auto-icon used when empty
]);
```

#### Badge

[](#badge)

```
use iguazoft\daisyui\widgets\Badge;

echo Badge::widget([
    'label'   => 'New',
    'variant' => 'badge-primary',   // badge-secondary | badge-success | badge-error | ...
    'size'    => 'badge-sm',        // badge-xs | badge-sm | badge-md | badge-lg
    'outline' => true,
]);
```

#### Card

[](#card)

```
use iguazoft\daisyui\widgets\Card;

echo Card::widget([
    'title'   => 'Card Title',
    'image'   => '/img/photo.jpg',
    'body'    => 'Card body content.',
    'actions' => Button::widget(['label' => 'Buy', 'variant' => 'btn-primary']),
    'compact' => false,
    'shadow'  => true,
]);

// Begin/end mode for custom body content:
Card::begin(['compact' => true]);
echo 'Custom HTML inside the card body.';
Card::end();
```

#### Avatar

[](#avatar)

```
use iguazoft\daisyui\widgets\Avatar;

// Image avatar with ring and online indicator
echo Avatar::widget([
    'src'     => '/img/user.jpg',
    'size'    => 'w-16',
    'ring'    => 'ring-primary',
    'online'  => true,
    'rounded' => 'rounded-full',
]);

// Placeholder with initials
echo Avatar::widget([
    'placeholder' => 'JD',
    'color'       => 'bg-primary text-primary-content',
    'size'        => 'w-12',
]);

// Grouped avatars
echo Avatar::group([
    ['src' => '/img/1.jpg', 'size' => 'w-12'],
    ['src' => '/img/2.jpg', 'size' => 'w-12'],
    ['placeholder' => '+5', 'color' => 'bg-neutral text-neutral-content', 'size' => 'w-12'],
]);
```

#### Stat

[](#stat)

```
use iguazoft\daisyui\widgets\Stat;

echo Stat::widget([
    'vertical' => false,
    'items'    => [
        ['title' => 'Total Users',  'value' => '1,200', 'desc' => '↗︎ 22%'],
        ['title' => 'Revenue',      'value' => '$48K',  'desc' => 'Jan–Feb'],
        ['title' => 'Active Tasks', 'value' => '38',    'figure' => ''],
    ],
]);
```

#### Progress / Radial Progress

[](#progress--radial-progress)

```
use iguazoft\daisyui\widgets\Progress;
use iguazoft\daisyui\widgets\RadialProgress;

echo Progress::widget([
    'value'         => 75,
    'max'           => 100,
    'color'         => 'progress-primary',
    'showLabel'     => true,
    'indeterminate' => false,
]);

echo RadialProgress::widget([
    'value'     => 85,
    'color'     => 'text-primary',
    'size'      => '8rem',
    'thickness' => '8px',
    'label'     => '85%',
]);
```

#### Rating

[](#rating)

```
use iguazoft\daisyui\widgets\Rating;

// Display only
echo Rating::widget(['value' => 3.5, 'max' => 5, 'half' => true]);

// Interactive radio inputs
echo Rating::widget([
    'value'       => 4,
    'max'         => 5,
    'interactive' => true,
    'name'        => 'product_rating',
    'color'       => 'mask-star-2 bg-warning',
]);
```

#### Skeleton

[](#skeleton)

```
use iguazoft\daisyui\widgets\Skeleton;

// Custom shape
echo Skeleton::widget(['shape' => 'circle', 'size' => 'w-16 h-16']);
echo Skeleton::widget(['shape' => 'rect',   'size' => 'w-full h-4']);

// Presets
echo Skeleton::card();
echo Skeleton::list(rows: 5);
```

#### Chat Bubble

[](#chat-bubble)

```
use iguazoft\daisyui\widgets\ChatBubble;

echo ChatBubble::widget([
    'message' => 'Hello! How are you?',
    'name'    => 'Obi-Wan',
    'time'    => '12:45',
    'side'    => 'start',
]);

echo ChatBubble::widget([
    'message' => 'Doing great!',
    'side'    => 'end',
    'color'   => 'chat-bubble-primary',
    'status'  => 'Seen',
]);
```

#### Carousel

[](#carousel)

```
use iguazoft\daisyui\widgets\Carousel;

echo Carousel::widget([
    'arrows'      => true,
    'dots'        => true,
    'slideHeight' => 'h-64',
    'items'       => [
        ['src' => '/img/1.jpg', 'alt' => 'Slide 1'],
        ['src' => '/img/2.jpg', 'alt' => 'Slide 2'],
        ['content' => 'Custom'],
    ],
]);
```

#### Countdown

[](#countdown)

```
use iguazoft\daisyui\widgets\Countdown;

// Static
echo Countdown::widget(['hours' => 2, 'minutes' => 30, 'seconds' => 0]);

// Live countdown (JS)
echo Countdown::widget([
    'targetDate' => '2025-12-31T23:59:59',
    'showDays'   => true,
]);
```

#### Timeline

[](#timeline)

```
use iguazoft\daisyui\widgets\Timeline;

echo Timeline::widget([
    'items' => [
        ['start' => '2020', 'middle' => '★', 'end' => 'Founded',    'active' => true],
        ['start' => '2022', 'middle' => '●', 'end' => 'Series A',   'endDesc' => '$5M raised'],
        ['start' => '2024', 'middle' => '◆', 'end' => 'IPO'],
    ],
]);
```

#### Diff

[](#diff)

```
use iguazoft\daisyui\widgets\Diff;

echo Diff::widget([
    'first'       => '',
    'second'      => '',
    'height'      => 'h-64',
]);
```

#### KBD

[](#kbd)

```
use iguazoft\daisyui\widgets\Kbd;

echo Kbd::widget(['key' => 'Enter']);
echo Kbd::combo(['Ctrl', 'Shift', 'K']);
```

#### Tooltip

[](#tooltip)

```
use iguazoft\daisyui\widgets\Tooltip;

echo Tooltip::widget([
    'tip'      => 'Delete record',
    'content'  => Button::widget(['label' => 'Delete', 'variant' => 'btn-error']),
    'position' => 'tooltip-top',   // tooltip-bottom | tooltip-left | tooltip-right
    'color'    => 'tooltip-error', // tooltip-primary | tooltip-success | ...
]);

// Begin/end mode
Tooltip::begin(['tip' => 'Click me', 'color' => 'tooltip-primary']);
echo Button::widget(['label' => 'Action']);
Tooltip::end();
```

---

### Navigation

[](#navigation)

#### Navbar

[](#navbar)

```
use iguazoft\daisyui\widgets\Navbar;
use iguazoft\daisyui\widgets\ThemeSwitcher;
use yii\helpers\Html;

echo Navbar::widget([
    'brand'      => Html::a('MyApp', '/', ['class' => 'btn btn-ghost text-xl']),
    'center'     => ThemeSwitcher::widget(['mode' => ThemeSwitcher::MODE_TOGGLE]),
    'end'        => ThemeSwitcher::widget(['mode' => ThemeSwitcher::MODE_DROPDOWN])
                  . Button::widget(['label' => 'Login', 'variant' => 'btn-primary', 'size' => 'btn-sm']),
    'stickyTop'  => true,
]);
```

#### Menu

[](#menu)

```
use iguazoft\daisyui\widgets\Menu;

echo Menu::widget([
    'items' => [
        ['label' => 'Dashboard', 'url' => '/',          'active' => true],
        ['label' => 'Users',     'url' => '/users'],
        '-',
        [
            'label' => 'Settings',
            'items' => [
                ['label' => 'Profile',  'url' => '/settings/profile'],
                ['label' => 'Security', 'url' => '/settings/security'],
            ],
        ],
    ],
]);
```

#### Breadcrumbs

[](#breadcrumbs)

```
use iguazoft\daisyui\widgets\Breadcrumbs;

// Manual
echo Breadcrumbs::widget([
    'links' => [
        ['label' => 'Products', 'url' => '/products'],
        ['label' => 'Shoes'],
    ],
]);

// Auto from $this->params['breadcrumbs'] (set in Yii views)
echo Breadcrumbs::widget(['useViewParams' => true]);
```

#### Tabs

[](#tabs)

```
use iguazoft\daisyui\widgets\Tabs;

echo Tabs::widget([
    'type'  => Tabs::TYPE_LIFTED,  // TYPE_DEFAULT | TYPE_BORDERED | TYPE_BOXED
    'items' => [
        ['label' => 'Overview',  'content' => 'Overview content', 'active' => true],
        ['label' => 'Analytics', 'content' => 'Charts here'],
        ['label' => 'Settings',  'content' => 'Settings form'],
    ],
]);

// URL-based (server navigation)
echo Tabs::widget([
    'type'  => Tabs::TYPE_BOXED,
    'items' => [
        ['label' => 'Profile',  'url' => '/profile',  'active' => true],
        ['label' => 'Billing',  'url' => '/billing'],
        ['label' => 'Security', 'url' => '/security'],
    ],
]);
```

#### Steps

[](#steps)

```
use iguazoft\daisyui\widgets\Steps;

echo Steps::widget([
    'currentStep'    => 2,
    'completedColor' => 'step-primary',
    'items'          => [
        ['label' => 'Cart'],
        ['label' => 'Shipping'],
        ['label' => 'Payment'],
        ['label' => 'Confirm'],
    ],
]);
```

#### Bottom Navigation

[](#bottom-navigation)

```
use iguazoft\daisyui\widgets\BottomNav;

echo BottomNav::widget([
    'fixed' => true,
    'items' => [
        ['label' => 'Home',    'url' => '/', 'icon' => '', 'active' => true],
        ['label' => 'Search',  'url' => '#', 'icon' => ''],
        ['label' => 'Profile', 'url' => '#', 'icon' => ''],
    ],
]);
```

---

### Layout

[](#layout)

#### Drawer (Sidebar)

[](#drawer-sidebar)

```
use iguazoft\daisyui\widgets\Drawer;
use iguazoft\daisyui\widgets\Menu;

Drawer::begin([
    'id'          => 'main-drawer',
    'openOnLg'    => true,
    'sideContent' => Menu::widget(['items' => [
        ['label' => 'Dashboard', 'url' => '/', 'active' => true],
        ['label' => 'Users',     'url' => '/users'],
    ]]),
]);

// Main page content
echo 'Hello World';

Drawer::end();
```

Toggle button (anywhere in main content area):

```

    ☰ Menu

```

#### Hero

[](#hero)

```
use iguazoft\daisyui\widgets\Hero;

echo Hero::widget([
    'title'     => 'Welcome to MyApp',
    'subtitle'  => 'Build something amazing today.',
    'actions'   => Button::widget(['label' => 'Get Started', 'variant' => 'btn-primary'])
                 . Button::widget(['label' => 'Learn More',  'variant' => 'btn-ghost']),
    'minHeight' => 'min-h-screen',
    'bgImage'   => '/img/hero-bg.jpg',
    'overlayOpacity' => '60',
]);
```

#### Footer

[](#footer)

```
use iguazoft\daisyui\widgets\Footer;

echo Footer::widget([
    'columns' => [
        [
            'title' => 'Product',
            'items' => [
                ['label' => 'Features', 'url' => '#'],
                ['label' => 'Pricing',  'url' => '#'],
            ],
        ],
        [
            'title' => 'Company',
            'items' => [
                ['label' => 'About', 'url' => '#'],
                ['label' => 'Blog',  'url' => '#'],
            ],
        ],
    ],
    'copyright' => '© 2025 MyApp. All rights reserved.',
]);
```

#### Divider

[](#divider)

```
use iguazoft\daisyui\widgets\Divider;

echo Divider::widget(['label' => 'OR']);
echo Divider::widget(['label' => 'Section', 'color' => 'divider-primary']);
echo Divider::widget(['vertical' => true]);
```

#### Indicator

[](#indicator)

```
use iguazoft\daisyui\widgets\Indicator;
use iguazoft\daisyui\widgets\Badge;

echo Indicator::widget([
    'content'   => Button::widget(['label' => 'Inbox']),
    'indicator' => Badge::widget(['label' => '99+', 'variant' => 'badge-error']),
    'position'  => 'indicator-top indicator-end',
]);
```

#### Join

[](#join)

```
use iguazoft\daisyui\widgets\Join;

// Pagination buttons
echo Join::widget([
    'items' => [
        '«',
        '1',
        '2',
        '»',
    ],
]);

// Input + button group
echo Join::widget([
    'items' => [
        '',
        'Go',
    ],
]);
```

#### Mask

[](#mask)

```
use iguazoft\daisyui\widgets\Mask;

echo Mask::widget([
    'src'   => '/img/avatar.jpg',
    'shape' => 'mask-hexagon',   // mask-heart | mask-squircle | mask-star-2 | ...
    'size'  => 'w-24 h-24',
]);
```

#### Stack

[](#stack)

```
use iguazoft\daisyui\widgets\Stack;

echo Stack::widget([
    'items' => [
        'A',
        'B',
        'C',
    ],
]);
```

---

### Forms

[](#forms)

#### ActiveForm + ActiveField

[](#activeform--activefield)

```
use iguazoft\daisyui\form\ActiveForm;

$form = ActiveForm::begin(['id' => 'user-form']);

// Standard inputs (auto DaisyUI classes)
echo $form->field($model, 'name')->textInput(['placeholder' => 'Full name']);
echo $form->field($model, 'bio')->textarea(['rows' => 4]);
echo $form->field($model, 'avatar')->fileInput();
echo $form->field($model, 'country')->dropdownList($countries, ['prompt' => 'Select country']);

// DaisyUI-specific inputs
echo $form->field($model, 'active')->toggle();               // switch
echo $form->field($model, 'volume')->range(['min' => 0, 'max' => 100]);
echo $form->field($model, 'rating')->rating(['max' => 5]);   // star rating

// Checkboxes and radios
echo $form->field($model, 'agree')->checkbox();
echo $form->field($model, 'gender')->radio();

ActiveForm::end();
```

---

### Grid

[](#grid)

#### GridView

[](#gridview)

```
use iguazoft\daisyui\grid\GridView;

echo GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel'  => $searchModel,
    'card'         => true,
    'cardTitle'    => 'Users',
    'cardHeaderHtml' => Button::widget(['label' => '+ New User', 'variant' => 'btn-primary', 'size' => 'btn-sm', 'url' => '/users/create']),
    'zebra'        => true,
    'tableSize'    => 'table-sm',
    'columns'      => [
        'id',
        'name',
        'email:email',
        [
            'class'  => 'yii\grid\ActionColumn',
            'template' => '{view}{update}{delete}',
        ],
    ],
]);
```

---

### Theme Switcher

[](#theme-switcher)

```
use iguazoft\daisyui\widgets\ThemeSwitcher;

// Dropdown (in Navbar end)
echo ThemeSwitcher::widget([
    'mode'         => ThemeSwitcher::MODE_DROPDOWN,
    'label'        => 'Theme',
    'themes'       => ['light', 'dark', 'cupcake', 'dracula', 'cyberpunk'],
    'defaultTheme' => 'light',
    'storageKey'   => 'my-app-theme',
]);

// Light/Dark toggle
echo ThemeSwitcher::widget(['mode' => ThemeSwitcher::MODE_TOGGLE]);

// Full grid of swatches
echo ThemeSwitcher::widget(['mode' => ThemeSwitcher::MODE_GRID]);
```

The selected theme is persisted in `localStorage` and applied on every page load with no flash.

---

Complete Backend Layout Example
-------------------------------

[](#complete-backend-layout-example)

```
