Skip to content
hightouchUI

Design system

v40.6.0

Code snippet

Code snippet is used to display code or commands for user to copy and paste.

Example

Usage

Variants

The default variant, base, renders on a light gray background.

Use the white variant to add contrast against a gray background. Typically used with forms.

With label

Without label

Without copy button

Guidelines

When to use

  • When displaying a block of code or a command for user to copy and paste.

When not to use

  • If referencing a code term inside a sentence, use a code component instead.

Props

NameDefaultDescription
variant"base""base" | "white"

The variant determines the background color of the code snippet.

code

string

Code snippet.

label

string

Label to show above the code snippet.

hasCopyButtontrueboolean

Whether to show a copy button.