Code Snippet

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

#

#

#

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.

#

#

#

#

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.

On this page

  • Example
  • Usage
  • Variants
  • With label
  • Without label
  • Without copy button
  • Props