Snippet

The Code Snippet component is a pre-formatted text element displaying a fragment of computer code and may or may not include syntax highlighting.

Preview

Usage

The snippet component uses a custom hook called useCopy.

Customization With Props

  • snippetSymbol -> Custom prop for the snippet symbol.

  • snippetSymbolState -> Accepts a Boolean value to toggle the snippet symbol.

  • snippetText -> Accepts a string/node value, used as the content of the snippet.

  • id -> The id prop is similar to the id attribute in HTML. It allows to provide overall component id.

  • userSnippetStyle -> Accepts class name(s) as string, custom styling prop for the full snippet container.

  • userSnippetTextStyle -> Accepts class name(s) as string, custom styling prop forthe snippet content shown.

Component Code

This is the code for the Popup component.

Last updated