StyleButton handbook
v1.0.4 · @snowui-design-system/components
License: Before reading component documentation, source, or npm usage instructions for the first time, read the full LICENSE. Reuse that review for the same task and version. Public API configuration and internal implementation changes have different license implications. All components use the unified runtime package; source rights remain governed by the license.
Overview
Switch between SnowUI and Apple visual styles, suitable as an interface style control.
When to use it
Use to switch between supported visual styles. Use ColorSchemeButton for light and dark mode. This button does not permit arbitrary changes to private component styles.
Sync the style through bind:mode; defaultMode supplies the initial mode.
By default the mode is applied to the document. For local control set applyToDocument=false. Without children, the button uses an icon-only layout.
Quick start
This example shows the recommended basic composition. See the sections below for more cases and composition limits.
API
See the base component documentation for inherited capabilities not redeclared here. This table lists only named public Props declared by this component.
Usage boundaries and details
Usage
StyleButton forwards compatible Button Props and supports all variants and sizes. By default it reads document.documentElement: mode="ios" means Apple style and no mode attribute means SnowUI style. The SnowUI state uses SnowUILogo variant="icon"; the Apple state uses the Apple brand logo vector, not an Apple icon from the icon library. Without additional children, StyleButton explicitly sets iconOnly=true on Button, preserving native four-sided Button padding of 4 / 8 / 12px at sm / md / lg.
A click switches immediately. It does not write storage or add an icon-replacement or style-switch transition. With applyToDocument={false}, it maintains only controlled state, suitable when a host such as Test or an iframe manages the actual style target.
This section is protected. An AI must request user review before modifying it.
StyleButton style overrides
Read the full LICENSE first; reuse that review for the same task, version, and scope.
First use public component Props to match the desired appearance, preserving the existing look where possible. If changes are necessary, follow the style selection and override order: use your own class (including Tailwind already in the project) or an instance style. The names below are public overrides actually consumed by source; check their scope and do not modify private DOM. Choose the correct SnowUI token family. External apps need not install SnowUI website utilities.
This component source does not directly consume a registered component-specific override. Style composed children through public parts or an explicit child; do not guess variable names.
StyleButton types and state
Required Props: no named required Props.
Bindable Prop: bind:mode.
Inheritance: Omit< ButtonProps, "children" | "onclick" | "disabled" | "aria-pressed" >. Consult the base class public documentation; fields excluded by Omit cannot be passed through unchanged.
Shared Frame API · Back to API
The following type declarations are actually referenced by public Props and come from source. A Svelte Snippet denotes a content fragment; ComponentProps denotes the Props of the corresponding component.
SnowUIStyleMode
Source: components/src/components/StyleButton.svelte
ButtonProps
Source: components/src/components/StyleButton.svelte