Skip to content
Search
Search the documentation
Do & Don't
GitHub
1 min read

Do & Don't

Show the right way and the wrong way side by side, for design guidelines.

Do and Dont are panels for design guidelines: what to do, and what to avoid. Each has a coloured top edge and a label in words, with a tick or a cross, so it reads without colour vision. Inside goes anything: text, an image or a live component. Set a pair side by side with Columns.

Do

Stable Beta

Use one word that names the state.

Don't

This is ready to use now

Write a sentence in a badge. It wraps, and nobody reads it.

Do

Write a shortcut as the keys a reader presses: Ctrl K.

Don't

Write a shortcut as code, like Ctrl+K, which reads as something to type.

Usage

Leave blank lines around the content so mdsvex reads the markdown inside.

			<script>
	import { Columns, Do, Dont } from 'svelte-docsmith';
</script>

<Columns>
<Do>

![A button labelled Save changes](./save-changes.png)

Name the action the button takes.

</Do>
<Dont>

![A button labelled OK](./ok.png)

Write a label that could mean anything.

</Dont>
</Columns>
		

The labels default to “Do” and “Don’t”. Pass label for other words, such as label="Avoid" or the words of a site in another language.

Colours

The panels use two theme tokens, --docsmith-do and --docsmith-dont. By default they are a green and your theme’s --destructive, each mixed a little toward the text colour so the label stays readable in both colour modes. Set either in your stylesheet to change it:

			:root {
	--docsmith-do: oklch(0.55 0.15 160);
}
		

API reference

Do

Do
label string default 'Do'
The word above the panel.
children required Snippet
What to do: text, an image or a live component.

Dont

Dont
label string default "Don't"
The word above the panel.
children required Snippet
What not to do: text, an image or a live component.

Was this page helpful?