Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Actions

ThemeSwitch <pm-theme-switch>

Light / dark / system switch.

Full screen

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/theme-switch'; </script> <pm-theme-switch></pm-theme-switch> <pm-theme-switch variant="toggle"></pm-theme-switch>

Variants

Set with the variant attribute.

variant="segmented"
variant="toggle"

Sizes

Set with the size attribute; controls keep touch-sized targets on phones.

size="sm"
size="md"

Tones

Set tone on the element, or data-tone on any ancestor to tone a whole area.

tone="accent"
tone="secondary"
tone="neutral"
tone="success"
tone="warning"
tone="danger"
tone="info"

Overview

On its own it sets data-mode on <html> and saves the choice where the no-flash script and ThemeController read it. Give it a controller (a ThemeController) to stay in sync with the rest of your app and across tabs.

variant="toggle" is one button that flips between light and dark; the default shows all three choices.

Attributes

AttributeTypeDefaultDescription
variant'segmented' | 'toggle'—segmented (default: light, dark, system) or toggle (one button, light ↔ dark).
size'sm' | 'md'—sm or md (default): the height of a button of the same size, in both variants.
labelstring—Accessible name (default "Colour mode").
show-labels
prop: showLabels
boolean—Show the words next to the icons.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-changeonPmChangeThe mode changed.

Used in templates

Overview dashboardTraffic analyticsOrdersCustomer 360InboxTeam chatAI assistantNotificationsProject boardTeam and rolesBilling and invoicesUser profileAccount settingsSign inCreate accountTwo-step verificationForgot passwordChoose a new passwordPricing plansProduct pageShopping cartCheckoutLanding pageArticleChangelogHelp centreContactComing soonNot found (404)Server error (500)Onboarding wizardAppointment bookingFeedback survey