How to set to light mode by default?

default discord avatar
5 months ago

Themes = "light" | "system" | "dark"

I think theme is set to "system" by default in pref right? Is there any way to define that I want light mode to be default for all?

  • default discord avatar
    5 months ago

    I don't think there is an easy way to set the default theme at the moment. Here you can find the main logic:

    I'd probably bypass this problem using:

    1. Custom provider

    2. useTheme hook which you can import like that:

    import { useTheme } from 'payload/dist/admin/components/utilities/Theme';

    You should be able to set the theme in useEffect using


    function. It's my first idea and maybe there is a better way. If you will go with this solution remember to call


    only once (to allow users to change theme in dashboard settings,


    can be problematic and may require additional flag in localStorage)

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!


Connect with the Payload Community on Discord



Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.