Snippet

Display a snippet of copyable code for the command line.

General

Basic usage.

width

Specify width manually.

types

Show different states with colors.

Multi Line

without copy

Hide icon for copy. (disable copy)

custom symbol

custom toast

filled

APIs

Snippet.Props

AttributeDescriptionTypeAccepted valuesDefault
textcode snippetstring string[]--
typesnippet typesSnippetTypesSnippetTypesdefault
filledfilled styleboolean-false
widthset CSS stringstring-initial
copyfunction of copy buttonCopyTypesCopyTypesdefault
symbolsymbol snippetstring-$
toastTexttoast textstring-Copied to clipboard!
toastTypetoast typeToastTypesToastTypessuccess
...native propsHTMLAttributes'id', 'name', 'className', ...-

SnippetTypes

type SnippetTypes =
  | 'default'
  | 'secondary'
  | 'success'
  | 'warning'
  | 'error'
  | 'dark'
  | 'lite'

CopyTypes

type CopyTypes = 'default' | 'silent' | 'prevent'

SnippetTypes

type SnippetTypes = 'default' | 'secondary' | 'success' | 'warning' | 'error'

ToastTypes

type ToastTypes = 'default' | 'secondary' | 'success' | 'warning' | 'error'