• Start
  • Blogg
  • Kom igång
  • Riktlinjer
  • Komponenter
  • Changelog
  • Tillgänglighet
  • Inställningar

Komponenter

Komponenter

​
​

Inga resultat hittade, prova med andra sökvillkor.

Code Block

Code Block

0.2.2

The Code Block component displays a piece of code.

Demo
Props
Installation
Länkar
Change log
Statistik

Demo

Props

Se fullständing dokumentation(öppnas i ny flik)
NamnTypBeskrivning

code *

stringThe code string to display and copy.

color

"light" | "dark" | "auto"Controls the visual appearance of the block. - "light" — always renders the light variant. - "dark" — always renders the dark variant. - "auto" — follows the active theme mode automatically.

customAttribute

{ attribute: string; value: string | number }Used for tests. Clickable and requested subcomponents will be suffixed with "-[ComponentName]".

hasCopyCodeButton

booleanToggles the copy-code button visibility.

hasSkipCodeButton

booleanToggles the skip-code-block button visibility.

lang *

"sv" | "en"Language used for internal translations.

language

stringSyntax language for highlighting. Accepts any Prism-supported language. Common values: "typescript", "javascript", "json", "bash", "css", "html".

Installation

Kodexempel
npm install @sj-ab/component-library.ui.code-block

Länkar

  • Storybook

  • Figma

  • Bit.cloud

Change log

  • Add wrapLongLines prop to CodeBlock component

    0.2.2
  • Add option to toggle CodeBlock buttons

    0.2.0
  • Add new code block component

    0.1.0

Statistik