diff --git a/docs/src/_includes/partials/sidebar.njk b/docs/src/_includes/partials/sidebar.njk index 47e7d44..8b857e8 100644 --- a/docs/src/_includes/partials/sidebar.njk +++ b/docs/src/_includes/partials/sidebar.njk @@ -105,6 +105,7 @@ { label: "Table", url: "/components/table", attrs: link_attrs }, { label: "Tabs", url: "/components/tabs", attrs: link_attrs }, { label: "Textarea", url: "/components/textarea", attrs: link_attrs }, + { label: "Theme Switcher", url: "/components/theme-switcher", attrs: link_attrs }, { label: "Toast", url: "/components/toast", attrs: link_attrs }, { label: "Tooltip", url: "/components/tooltip", attrs: link_attrs } ]} diff --git a/docs/src/components/theme-switcher.njk b/docs/src/components/theme-switcher.njk index f54e4dd..83798df 100644 --- a/docs/src/components/theme-switcher.njk +++ b/docs/src/components/theme-switcher.njk @@ -5,49 +5,107 @@ description: A component that allows the user to switch between light and dark m toc: - label: Usage id: usage - - label: Examples - id: examples children: - - label: Default - id: example-default - - label: Right - id: example-right - - label: Bottom + Start - id: example-bottom-start + - label: HTML + JavaScript + id: usage-html-js + children: + - label: "Step 1: Include the JavaScript script" + id: usage-html-js-1 + - label: "Step 2: Add your switcher" + id: usage-html-js-2 + - label: JavaScript events + id: usage-html-js-3 --- +
Instead, we offer a short JavaScript <script> block you can insert in the <head> of your page.
On any element, set the value of the data-tooltip attribute to the text you want to display in the tooltip. Additionally, you can set:
data-side attribute to top, bottom, left, or right to change the side of the tooltip.data-align attribute to start, center, or end to change the alignment of the tooltip.Insert the following JavaScript block right at the beginning of the <head> your page. We do this instead of using a separate file to ensure the theme is defined before the page loads, avoiding a flash of unstyled or mist-styled content.
To change the theme, you need to dispatch a basecoat:theme event:
basecoat:themeBy default, the event will toggle the theme, but you can also add a mode to the detail to set the theme explicitly: