Skip to main content

Dimmer

v1.2.0
4
62

Light / Dark / System mode switcher for Laravel.

  • laravel
  • blade
  • laravel-package
Dimmer thumbnail

Installation

You can install the package via composer:

composer require awcodes/dimmer

Next, you need to add the views to your tailwind.config.js file:

content: [
    './vendor/awcodes/dimmer/resources/views/**/*.blade.php',
]

Optionally (not recommended), you can publish the views using

php artisan vendor:publish --tag="dimmer-views"

You can also update the translations by publishing the lang files:

php artisan vendor:publish --tag="dimmer-translations"

Usage

Just include the dimmer component in your layout or anywhere you would to use it.

<x-dimmer::controls />

Forcing a default mode

Should you wish to force a default mode for when a user first visits the site, you can do so by setting the force-mode attribute on the dimmer component. Without this attribute set, the default mode will be determined by the user's system preferences.

<x-dimmer::controls force-mode="dark" />