Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Darkmode Toggle

Laravel Darkmode Toggle Laravel Package

jeremykenedy/laravel-darkmode-toggle

jeremykenedy/laravel-darkmode-toggle provides a simple, ready-to-use dark mode toggle for Laravel applications. Add a Blade component, configure its appearance, and let users switch between light and dark themes with their preference persisted across visits. Lightweight and easy to integrate.

View on GitHub
Deep Wiki
Context7

A standalone, framework-agnostic dark mode toggle component for Laravel. Supports Tailwind CSS, Bootstrap 5, and Bootstrap 4, with Blade, Livewire, Vue, React, and Svelte frontend options.

Frequently asked questions about Laravel Darkmode Toggle
How do I install jeremykenedy/laravel-darkmode-toggle in a Laravel app?
Install the package with Composer, publish its config and view tags, then drop the Blade component tag into your layout. There is no manual service provider registration because the package relies on Laravel's package discovery. Once published, you can adjust appearance and persistence options in the config file or through environment variables.
Which CSS frameworks and Laravel versions does this dark mode toggle support?
The component ships styled variants for Tailwind CSS, Bootstrap 5, and Bootstrap 4, and the v2 release brings view parity across all three. composer.json still declares Laravel 10 and 11 support, but Composer will not resolve those branches because of CVE-2026-48019 with no patched release, so in practice you need Laravel 12 or 13 on PHP 8.2 or newer.
Does the dark mode toggle work with Livewire, Vue, React, and Svelte?
Yes. The package ships a Blade component plus dedicated Livewire, Vue, React, and Svelte components that all read and write the same stored preference. You can use whichever frontend layer your layout already uses without rewriting the persistence logic yourself.
How is the user's dark mode preference persisted between visits?
The toggle stores the preference in a single configured field controlled by the persist_field config key, and the Livewire component honors persist_to_server before writing to the server. Because the field is configurable, you are not locked into a hardcoded dark_mode column. The value is read back on load so the theme stays consistent across visits.
Can I configure the toggle with environment variables instead of editing the config file?
Yes, every config key in v2 has an environment variable equivalent, which removes the usual per-environment config file drift. The darkmode:switch and darkmode:update commands write DARKMODE_* keys when those take precedence, so expect .env diffs in environments that previously reported success while doing nothing.
Is version 2.0.0 a breaking change I need to worry about?
The major version mainly reflects a tightened platform floor rather than an API break. Config keys, class names, properties, Blade aliases, view names, publish tags, and command signatures are pinned by a backwards-compatibility contract test, and new config options ship disabled. However the rendered markup changed, so app-level CSS overrides, snapshot tests, or E2E selectors keyed to the old DOM should be reviewed.
What changed in the v2 markup and ARIA attributes?
v2 reworks the toggle into an ARIA menu-button pattern with role=menu, aria-checked, focus management, and aria-hidden icons. That output changes on Tailwind, Bootstrap 4, Bootstrap 5, and Livewire alike, and those DOM changes are not covered by the published compatibility contract. Review any custom styling or test selectors that target the old structure.
Is this package safe for production given it has a single maintainer?
It is a lightweight presentation-layer package that only touches one configured preference column, so its blast radius is small. It is maintained by a single author, though, and it now sits in the theming path of every page, so it is worth documenting a fork and patch posture. Confirm the CVE that justifies the platform floor against the advisory database before forcing framework upgrades.
Do I need a CSS framework to use this dark mode toggle?
No. The package is CSS-framework agnostic and ships ready-made views for Tailwind CSS, Bootstrap 5, and Bootstrap 4, but the underlying toggle is a standalone component. You add it to a layout, configure its appearance, and it handles the light/dark switching and persistence.
What are good alternatives to jeremykenedy/laravel-darkmode-toggle?
Alternatives include hand-rolling a small Alpine.js or vanilla JavaScript toggle, or using a theme-switching package from the wider ecosystem. This package's differentiator is the bundled Blade, Livewire, Vue, React, and Svelte components with a persisted preference and env-var-driven config. Choose it if you want the toggle ready-made rather than writing the persistence and ARIA wiring yourself.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo