UI Components

Theme Widget

Feature Docs

A flexible theme switcher widget supporting light, dark, and system-preference modes. Available in multiple display types: floating button, dropdown menu, toggle switch, and segmented control.

Floating Button (Default)

Fixed position floating button, typically in the corner of the screen.

Code
<?php echo ThemeWidget::widget(); ?>
Live Demo
☀️ Light
🌙 Dark
💻 System

Dropdown Menu

Bootstrap dropdown menu style, great for headers and navbars.

Code
<?php echo ThemeWidget::widget([ 'type' => 'dropdown', 'showLabels' => true, ]); ?>
Live Demo

Toggle Switch

Simple toggle between light and dark modes (no system option).

Code
<?php echo ThemeWidget::widget([ 'type' => 'toggle', 'showLabels' => true, ]); ?>
Live Demo

Segmented Control

iOS-style segmented control showing all three options.

Code
<?php echo ThemeWidget::widget([ 'type' => 'segmented', 'showLabels' => true, ]); ?>
Live Demo

Configuration Options

OptionTypeDefaultDescription
typestringfloatingDisplay type: floating, dropdown, toggle, segmented
positionstringbottom-rightPosition for floating type: bottom-right, bottom-left, top-right, top-left
sizestringmediumSize: small, medium, large
shapestringcircleShape for floating: circle, square, rounded
showLabelsbooltrueShow text labels alongside icons
iconsarray['light' => '☀️', ...]Custom icons per theme
labelsarray['light' => 'Light', ...]Custom labels per theme