Skip to content
BigBang

Popular

    ↑↓Navigate↵OpenEscClose
    TR

    Components

    CodeBlock

    Shows code in the mono type with an optional header, line numbers and a copy button.

    Storybook
    Storybook
    Source
    Source

    The example below loads live from Storybook; you can open the controls there.

    Live example, StorybookOpen in Storybook

    title shows a file name or short title and names the scroll region; language writes the language in the header. lineNumbers adds line numbers.

    Live example, StorybookOpen in Storybook

    highlightLines marks the given lines with the selected surface colour.

    Live example, StorybookOpen in Storybook

    Without a header, the copy button sits in the top end corner.

    Live example, StorybookOpen in Storybook

    wrap breaks long lines instead of scrolling sideways. Use it for command lines.

    Live example, StorybookOpen in Storybook

    CodeBlock takes its colours from the surface and text tokens; neither mode needs extra setup.