docs(theme): add description, update carbon theme link [ci skip]

This commit is contained in:
Eric Y Liu 2021-07-10 15:42:09 -07:00
commit 7457edf60d
6 changed files with 19 additions and 14 deletions

View file

@ -4212,15 +4212,15 @@ export type CarbonTheme = "white" | "g10" | "g80" | "g90" | "g100";
### Props ### Props
| Prop name | Kind | Reactive | Type | Default value | Description | | Prop name | Kind | Reactive | Type | Default value | Description |
| :--------- | :--------------- | :------- | :------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | :--------- | :--------------- | :------- | :------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| theme | <code>let</code> | Yes | <code>CarbonTheme</code> | <code>"white"</code> | Set the current Carbon theme | | theme | <code>let</code> | Yes | <code>CarbonTheme</code> | <code>"white"</code> | Set the current Carbon theme |
| tokens | <code>let</code> | No | <code>{ [token: string]: any; }</code> | <code>{}</code> | Customize a theme with your own tokens<br />https://carbondesignsystem.com/guidelines/themes/overview#tokens | | tokens | <code>let</code> | No | <code>{ [token: string]: any; }</code> | <code>{}</code> | Customize a theme with your own tokens<br />https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme |
| persist | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to persist the theme using window.localStorage | | persist | <code>let</code> | No | <code>boolean</code> | <code>false</code> | Set to `true` to persist the theme using window.localStorage |
| persistKey | <code>let</code> | No | <code>string</code> | <code>"theme"</code> | Specify the local storage key | | persistKey | <code>let</code> | No | <code>string</code> | <code>"theme"</code> | Specify the local storage key |
| render | <code>let</code> | No | <code>"toggle" &#124; "select"</code> | -- | Render a toggle or select dropdown to control the theme | | render | <code>let</code> | No | <code>"toggle" &#124; "select"</code> | -- | Render a toggle or select dropdown to control the theme |
| toggle | <code>let</code> | No | <code>import("../Toggle/Toggle").ToggleProps & { themes?: [labelA: CarbonTheme, labelB: CarbonTheme]; }</code> | <code>{ themes: ["white", "g100"], labelA: "", labelB: "", labelText: "Dark mode", hideLabel: false, }</code> | Override the default toggle props | | toggle | <code>let</code> | No | <code>import("../Toggle/Toggle").ToggleProps & { themes?: [labelA: CarbonTheme, labelB: CarbonTheme]; }</code> | <code>{ themes: ["white", "g100"], labelA: "", labelB: "", labelText: "Dark mode", hideLabel: false, }</code> | Override the default toggle props |
| select | <code>let</code> | No | <code>import("../Select/Select").SelectProps & { themes?: CarbonTheme[]; }</code> | <code>{ themes: themeKeys, labelText: "Themes", hideLabel: false, }</code> | Override the default select props | | select | <code>let</code> | No | <code>import("../Select/Select").SelectProps & { themes?: CarbonTheme[]; }</code> | <code>{ themes: themeKeys, labelText: "Themes", hideLabel: false, }</code> | Override the default select props |
### Slots ### Slots

View file

@ -11591,7 +11591,7 @@
{ {
"name": "tokens", "name": "tokens",
"kind": "let", "kind": "let",
"description": "Customize a theme with your own tokens\nhttps://carbondesignsystem.com/guidelines/themes/overview#tokens", "description": "Customize a theme with your own tokens\nhttps://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme",
"type": "{ [token: string]: any; }", "type": "{ [token: string]: any; }",
"value": "{}", "value": "{}",
"isFunction": false, "isFunction": false,

View file

@ -105,7 +105,10 @@
{:else if type.startsWith("(")} {:else if type.startsWith("(")}
<code>{type}</code> <code>{type}</code>
{:else} {:else}
<InlineSnippet code="{type}" /> <InlineSnippet
code="{type}"
style="white-space: pre-wrap"
/>
{/if} {/if}
</div> </div>
{/each} {/each}

View file

@ -3,6 +3,8 @@
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
</script> </script>
This utility component dynamically updates the Carbon theme on the client-side using CSS variables.
### Default ### Default
<FileSource src="/framed/Theme/Theme" /> <FileSource src="/framed/Theme/Theme" />
@ -15,7 +17,7 @@ Set `persist` to `true` to persist the theme locally using the [Window.localStor
### Custom theme ### Custom theme
Define keys and values in the `tokens` prop that override default Carbon theme tokens. Define keys and values in the `tokens` prop that override default Carbon theme tokens. Refer to the [Carbon website](https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme) for guidance on customizing a theme using token values.
<FileSource src="/framed/Theme/ThemeTokens" /> <FileSource src="/framed/Theme/ThemeTokens" />

View file

@ -18,7 +18,7 @@
/** /**
* Customize a theme with your own tokens * Customize a theme with your own tokens
* https://carbondesignsystem.com/guidelines/themes/overview#tokens * https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme
* @type {{ [token: string]: any; }} * @type {{ [token: string]: any; }}
*/ */
export let tokens = {}; export let tokens = {};

View file

@ -12,7 +12,7 @@ export interface ThemeProps {
/** /**
* Customize a theme with your own tokens * Customize a theme with your own tokens
* https://carbondesignsystem.com/guidelines/themes/overview#tokens * https://carbondesignsystem.com/guidelines/themes/overview#customizing-a-theme
* @default {} * @default {}
*/ */
tokens?: { [token: string]: any }; tokens?: { [token: string]: any };