CodeBlock
A code block component with syntax highlighting.
Note: This component is only supported as a React Server Component, meaning it can not be re-rendered on the client.
Props
code
: The code to display.language
: The language of the code (such asjavascript
). If not given, no syntax highlighting will be applied.lineNumbers
: Whether to display line numbers. Defaults tofalse
.theme
: The theme to use for syntax highlighting. One ofauto
(using Joy UI's theme setting),dark
,light
,inverted
. Defaults toauto
.disableBorder
: Whether to disable the border. Defaults tofalse
.
A more technical prop,
codeProps
, is available for advanced customizations.