I am working with Open edX Sumac 3 and noticed a difference in how the theme toggle button is implemented between the classic LMS (Indigo theme) and the MFEs.
In the LMS (Tutor Indigo), the toggle appears inside a <div id="toggle-switch">…</div>.
In the Learner Dashboard MFE (e.g. https://apps.edx.io/learner-dashboard/), the theme toggle appears inside a <div class="toggle-switch">…</div>.
I have already checked both openedx/frontend-component-header and edx/frontend-component-header-edx, but neither of these repositories includes a ThemeToggle or ToggleSwitch component.
So my questions are:
Which repository actually contains the code for the .toggle-switch button in the MFEs?
Is this implemented as part of the core Open edX MFEs, or is it usually injected via the Frontend Plugin Framework (slots/branding overrides)?
If it’s a plugin, could anyone point me to an example repo or implementation pattern that adds the theme toggle in MFEs?
Hi @lexuandaibn123
If you are referring specifically to the Dark Mode theme toggle, then as far as I’m aware this particular toggle is exclusive to the Indigo theme: Code search results · GitHub
I can find some reference to a darkmode in frontend platform which might be helpful, but I have not directly used this myself so can’t provide any real-world feedback on it’s implementation, though the docs do appear fairly comprehensive at least…
I’m still looking into this and could use a pointer.
While debugging, I found the MFE theme toggle is actually rendered by a component named ThemeToggleButton. Here’s the exact snippet I’m seeing at runtime:
What’s confusing is I can’t find this component (or anything similar) in either openedx/frontend-component-header or edx/frontend-component-header. It relies on INDIGO_ENABLE_DARK_TOGGLE and the indigo-toggle-dark cookie, which lines up with Tutor Indigo’s build-time config patch here:
I cloned and customized Tutor Indigo and rebuilt the MFEs, but the toggle’s behavior didn’t change—so it seems this button isn’t coming from the Tutor Indigo source directly. It looks more like it’s shipped via a prebuilt package or injected via the header/slots system.