Production default
Balanced spacing, hierarchy, and content for the most common product workflow.
<PreferenceSwitcher
themeLabel="Preference Switcher"
colorLabel="Preference Switcher"
languageLabel="Preference Switcher"
compact="false"
/>
// Generated by scripts/generate-showcase.mjs. Do not edit directly.
page PreferenceSwitcherDetail {
layout = "showcase"
state playground_size = ctx.url.searchParams.get("pg_size") ?? "default"
state playground_color = ctx.url.searchParams.get("pg_color") ?? "primary"
state playground_themeLabel = ctx.url.searchParams.get("pg_themeLabel") ?? "Preference Switcher"
state playground_colorLabel = ctx.url.searchParams.get("pg_colorLabel") ?? "Preference Switcher"
state playground_languageLabel = ctx.url.searchParams.get("pg_languageLabel") ?? "Preference Switcher"
state playground_languages = ctx.url.searchParams.get("pg_languages") ?? ""
state playground_colors = ctx.url.searchParams.get("pg_colors") ?? ""
state playground_compact = (ctx.url.searchParams.get("pg_compact") ?? "false") === "true"
state playground_class = ctx.url.searchParams.get("pg_class") ?? "showcase-instance showcase-instance--1"
seo {
title = "Preference Switcher"
description = "Reusable preference switcher component."
}
view {
Reusable preference switcher component. Change any prop and inspect the server-rendered component immediately.Preference Switcher
Configure Preference Switcher
<PreferenceSwitcher
themeLabel="Preference Switcher"
colorLabel="Preference Switcher"
languageLabel="Preference Switcher"
compact="false"
/>payload.
Compare configurations and resize the browser to check responsive behavior.
Balanced spacing, hierarchy, and content for the most common product workflow.
<PreferenceSwitcher
themeLabel="Preference Switcher"
colorLabel="Preference Switcher"
languageLabel="Preference Switcher"
compact="false"
/>
A tighter variation for dashboards, side panels, tables, and operational interfaces.
<PreferenceSwitcher
size="sm"
themeLabel="Compact example"
colorLabel="Compact example"
languageLabel="Compact example"
/>
A more expressive variation using additional data, stronger emphasis, and optional states.
<PreferenceSwitcher
size="lg"
themeLabel="Advanced example"
colorLabel="Advanced example"
languageLabel="Advanced example"
compact="false"
/>
Use declarative output handlers in .wrn files or register a direct output handler from JavaScript. The canonical API exposes payload and does not require event.detail.
@themeFires when the component emits the theme event.@colorFires when the component emits the color event.@languageFires when the component emits the language event.<PreferenceSwitcher
@theme='console.log(payload)'
@color='console.log(payload)'
@language='console.log(payload)'
/>import { registerOutputHandler } from "@wrnexus/csr/outputs"
const component = document.querySelector("[data-ui-component=\"PreferenceSwitcher\"], [data-component=\"PreferenceSwitcher\"]")
if (component) registerOutputHandler(component, "theme", (payload) => {
console.log("theme", payload)
})
if (component) registerOutputHandler(component, "color", (payload) => {
console.log("color", payload)
})
if (component) registerOutputHandler(component, "language", (payload) => {
console.log("language", payload)
})All content and behavior shown above is supplied through these props and slots.
| Prop | Type | Default | Required |
|---|---|---|---|
size | string | "default" | No |
color | string | "primary" | No |
themeLabel | string | "Theme" | No |
colorLabel | string | "Accent color" | No |
languageLabel | string | "Language" | No |
languages | string | [ | No |
colors | string | [ | No |
compact | boolean | true | No |
class | string | "" | No |