Files
WorkRoot-WRNexusJSComponent/app/pages/dark-mode.wrn
T

24 lines
2.8 KiB
Plaintext

page DarkModeGuide {
layout = "showcase"
seo {
title = "Dark mode"
description = "Choose light, dark, or system mode. The selection persists and updates every preview."
}
view {
<article class="page-docs guide-page">
<nav class="docs-breadcrumbs" aria-label="Breadcrumb"><a href="/docs">Docs</a><span aria-hidden="true">/</span><span>Dark mode</span></nav>
<header class="docs-intro"><span class="showcase-eyebrow">Customization</span><h1>Dark mode</h1><p>Choose light, dark, or system mode. The selection persists and updates every preview.</p></header>
<section class="guide-section guide-example"><h2>Configure and use it</h2><p>This is the smallest useful starting point. Copy it into the indicated application file or run it from the project root, then adjust the documented values for your product.</p><pre><code>theme: <span>&#123;</span>
default: "system",
palette: "violet",
<span>&#125;</span></code></pre><h3>What changes after this</h3><p>The initial server document and hydrated client agree on light, dark, or system mode without a theme flash.</p></section>
<section class="guide-section"><h2>Choose a default</h2><p>Set light, dark, or system in wrnexus.config.ts. System mode follows the operating-system preference until the user selects an explicit value.</p></section><section class="guide-section"><h2>Persist preference</h2><p>Use PreferenceSwitcher or your own control to update the document theme. The selected value persists and is applied before interactive components hydrate.</p></section><section class="guide-section"><h2>Author with tokens</h2><p>Use semantic --wire-* variables instead of hard-coded light colors. Tokens switch surfaces, text, borders, focus, and status colors together.</p></section><section class="guide-section"><h2>Test both modes</h2><p>Check content, overlays, charts, disabled controls, focus rings, and browser autofill in both modes. Do not treat dark mode as a simple color inversion.</p></section>
<section class="guide-section"><h2>Verify the result</h2><p>Type-check the application, inspect the resolved package and styles, and build the production artifact. Test the page at a narrow viewport, with keyboard navigation, and in both color modes before shipping.</p><pre><code>bunx wrnexus typecheck .
bunx wrnexus inspect packages .
bunx wrnexus inspect styles .
bunx wrnexus build .</code></pre><h3>Expected result</h3><p>The commands exit successfully, the build reports the installed UI components and active theme, and the rendered page remains usable before and after hydration.</p></section>
<nav class="guide-next"><a href="/components/button">Explore components <span aria-hidden="true">→</span></a><a href="/block-library">Browse blocks <span aria-hidden="true">→</span></a></nav>
</article>
}
}