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.
Snippet
import { Snippet } from '@lobehub/ui';
Default
$ pnpm install @lobehub/ui
APIs
Name | Description | Type | Default |
---|---|---|---|
children | The content to be displayed inside the Snippet component | string | (required) |
copyable | Whether the Snippet component is copyable or not | boolean | true |
language | The language of the content inside the Snippet component | string | "tsx" |
spotlight | Whether add spotlight background | boolean | false |
symbol | The symbol to be displayed before the content inside the Snippet component | string | -- |
type | The type of the Snippet component | "ghost"|"block" | "ghost" |