@fusion.dev/helix-docs 0.241.3 → 0.242.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,7 +54,7 @@ names the tag to define.
54
54
 
55
55
  [//]: # (renders)
56
56
 
57
- **52 of the 119 headless families interpolate another family's tag**, across 30 distinct children.
57
+ **52 of the 121 headless families interpolate another family's tag**, across 30 distinct children.
58
58
 
59
59
  | Family | Renders |
60
60
  |---|---|
@@ -43,6 +43,23 @@ Because `color-scheme` inherits, **the attribute works on any element**:
43
43
  The theme builder uses the same attribute to show a component in light and dark
44
44
  mode side by side in one document.
45
45
 
46
+ ## Switch the mode from the page
47
+
48
+ `Theme Toggle` is a button that switches the page between light and dark. A
49
+ press spreads the new mode in a circle from the button, and `transition` picks
50
+ `wipe`, `fade`, or `none` instead. To switch from your own code, call
51
+ `setColorMode`, which takes the same transitions:
52
+
53
+ ```js
54
+ import { colorMode, setColorMode } from '@fusion.dev/helix-core'
55
+
56
+ setColorMode(colorMode() === 'dark' ? 'light' : 'dark', { transition: 'fade' })
57
+ ```
58
+
59
+ Both write `data-color-mode` on the document element, and change it at once
60
+ under reduced motion. To keep a reader's choice across visits, listen for the
61
+ toggle's `change` event and write the mode into the page you serve next.
62
+
46
63
  ## Follow the operating system
47
64
 
48
65
  When you do not set a mode, `:root` declares `color-scheme: light dark`, and the