Snippet

The Snippet component is used to display a code snippet with syntax highlighting. It can be customized with a symbol before the content and a language for syntax highlighting. The component is also copyable with a CopyButton included by default.

import { Snippet } from '@lobehub/ui';

Default

$ pnpm install @lobehub/ui

APIs

NameDescriptionTypeDefault
childrenThe content to be displayed inside the Snippet componentstring(required)
copyableWhether the Snippet component is copyable or notbooleantrue
languageThe language of the content inside the Snippet componentstring"tsx"
spotlightWhether add spotlight backgroundbooleanfalse
symbolThe symbol to be displayed before the content inside the Snippet componentstring--
typeThe type of the Snippet component"ghost"|"block""ghost"