npm install @geoffcox/sterling-svelte
yarn add @geoffcox/sterling-svelte
<script> import Button from '@geoffcox/sterling-svelte/Button.svelte'; import { Checkbox } from '@geoffcox/sterling-svelte'; </script> <div> <Button>Hello sterling-svelte</Button> <Checkbox>Ready</Checkbox> </div>
If you don't have your own theme for sterling-svelte, it is recommended to use the Sterling theme.
npm install @geoffcox/sterling-svelte-themes
yarn add @geoffcox/sterling-svelte-themes
import '@geoffcox/sterling-svelte-themes/sterling.css';
<html class="light-mode"></html>
import { applyLightDarkMode } from '@geoffcox/sterling-svelte'; // TODO: Provide UI to toggle this between auto, light, or dark. let mode = $state('auto');
Recommended: Specify atDocumentRoot: true
to apply the class at the root of the HTML
document. This ensure styles are applied to floating UI appending to the body element's children.
<div use:applyLightDarkMode={{atDocumentRoot: true, mode}}> ... </div>
<svelte:head> <link href="https://unpkg.com/@geoffcox/sterling-svelte-themes/css/sterling.css" rel="stylesheet"> </svelte:head>