Props
You can pass props into the component. Here is a table of all the props you can pass, along with their explanations.
Table
Prop | Default | Optional | Type |
---|---|---|---|
tag | div | true | string |
language | PlainText | true | Language |
theme | Default | true | Theme |
copy | false | true | boolean |
copyBtnTheme | Light | true | Light or Dark |
children | " " | false | string |
Explanation
- tag: The tag name of the code block.
- language: the language to highlight code in. View all available languages.
- theme: the theme to use for highlighting. View all available themes.
- copy: whether to show the copy button.
- copyBtnTheme: the theme to use for the copy button.
- children: this is where you pass your code text. You must pass it inside the component like this:
<ReactHighlightSyntax>
{children}
</ReactHighlightSyntax>