Skip to content

[ShadcnAdminUi] Add an auto mode to the theme switcher - #411

Merged
loic425 merged 1 commit into
Sylius:shadcn-admin-uifrom
loic425:feat/shadcn-admin-ui-theme-auto-mode
Nov 18, 2026
Merged

loic425 merged 1 commit into
Sylius:shadcn-admin-uifrom
loic425:feat/shadcn-admin-ui-theme-auto-mode

Conversation

@loic425

@loic425 loic425 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member
Q A
Branch? shadcn-admin-ui
Bug fix? no
New feature? yes
BC breaks? no
Related tickets port of #407
License MIT

The BootstrapAdminUi theme switcher got an auto mode in #407, but the ShadcnAdminUi one still only toggles between light and dark: once clicked, the OS preference is ignored for good.

The button now opens a shadcn DropdownMenu with three radio items:

  • Light and Dark force the theme, as before.
  • Auto follows prefers-color-scheme, live when the OS switches and across open tabs.
  • The button shows the icon of the selected mode (sun, moon or monitor), and the selected item is checked.

Same storage as Bootstrap: Auto is the default and removes the sylius-theme key, so admins who never picked a theme see no change and those who did keep their choice. The inline script sets data-theme-mode on <html> before the stylesheet, so there is no flash and the right icon shows before Stimulus connects. The toggle action is kept for overridden templates.

Labels reuse the sylius.ui.theme_* keys added to UiTranslations in #407. lucide:monitor was added to the test app's locked icons.

Light Dark
Theme switcher with Light selected Theme switcher with Dark selected
Auto (OS light) Auto (OS dark)
Theme switcher with Auto selected and a light OS Theme switcher with Auto selected and a dark OS

Port of the BootstrapAdminUi auto mode (Sylius#407): the switcher opens a
Light / Dark / Auto menu, Auto follows prefers-color-scheme live and
across tabs, and is the default (no stored sylius-theme key).
@loic425 loic425 mentioned this pull request Nov 17, 2026
4 tasks done
@loic425
loic425 merged commit 69ae71e into Sylius:shadcn-admin-ui Nov 18, 2026
5 checks passed
@loic425
loic425 deleted the feat/shadcn-admin-ui-theme-auto-mode branch November 18, 2026 07:45
loic425 added a commit that referenced this pull request Nov 18, 2026
The main PR with the work from @rem42 @camilleislasse and myself.

Sub tasks:
- [x] #403
- [x] #409
- [x] #410
- [x] #411
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants