Skip to content

code/HighlightedCode

import { … } from 'zidane-ui'ui/src/code/HighlightedCode.tsx

Components#

HighlightedCodeComponent#

Highlighted code with a copy button, plain until it nears the viewport. The highlighter and theme come from the enclosing CodeHighlightProvider.

TypeScript
function HighlightedCode(props: HighlightedCodeProps): Element
Parameters
NameTypeDescription
propsHighlightedCodeProps

The HighlightedCodeProps.

Element
HighlightedCode props
NameTypeDescription
actions?(buttonClass: string) => ReactNode

Extra controls before Wrap and Copy: CodeFrameProps.actions.

className?string

Extra classes on the root element.

codestring

The code to show, without the closing newline.

copyLabel?string

Accessible name of the copy button. Defaults to the frame's.

languagestring

A language name or alias (plaintext when the code names none).

style?CSSProperties

Inline styles on the root element, merged after the component's own.

ui/src/code/HighlightedCode.tsx:43

Interfaces#

HighlightedCodePropsInterface#

Props of HighlightedCode.

TypeScript
interface HighlightedCodeProps
HighlightedCodeProps properties
NameTypeDescription
actions?(buttonClass: string) => ReactNode

Extra controls before Wrap and Copy: CodeFrameProps.actions.

className?string

Extra classes on the root element.

codestring

The code to show, without the closing newline.

copyLabel?string

Accessible name of the copy button. Defaults to the frame's.

languagestring

A language name or alias (plaintext when the code names none).

style?CSSProperties

Inline styles on the root element, merged after the component's own.

ui/src/code/HighlightedCode.tsx:22