Code Snippet

Text container in a style that is best fit for a monospace font.

Published Last updated: 4.2.0 Change log Github NPM
Twig Usage
  {% include "@bolt-components-code-snippet/code-snippet.twig" with {
  display: "block",
  lang: "html",
  content: "Some code snippet"
} only %}
Schema
Note: when assigning component props as HTML attributes on a web component, make sure to use kebab-case.
Prop Name Description Type Default Value Option(s)
display

Defines if the code text is inline or block.

string block
  • block or inline
lang

Language of the code text.

string html
  • css, html, js, scss, twig
syntax

Toggle between a light and dark syntax highlighting, or turn it off. Separate from Bolt theming.

string light
  • light, dark, none
Install Install
  npm install @bolt/components-code-snippet
Dependencies @bolt/core-v3.x @bolt/lazy-queue prismjs