Skip to main content

CodeSnippet

Use the CodeSnippet to display a code block in a read-only context. By default, the code is formatted but not highlighted.

CodeSnippetProps

Signature:

export declare type CodeSnippetProps = & & & & & & & { /** * Code language to be used to run highlighting on the given code. */ language?: ; /** * Whether the copy button should be displayed. * @defaultValue true * @deprecated Will be removed. Use instead */ allowCopy?: ; /** * Whether the copy button should be displayed. * @defaultValue true */ showCopyAction?: ; /** * Whether line s should be shown. * @defaultValue true */ showLineNumbers?: ; /** * Whether the content breaks into new lines automatically or not. * @defaultValue false */ lineBreaks?: ; /** * Callback fired when copy button is clicked and the code snippet was copied. */ onCopy?: () => ; /** * CodeSnippet layout size, for standard spacing and for reduced font size, padding and margins. * @defaultValue */ size?: | ; /** * Called when the component receives focus. */ onFocus?: (e: <>) => ; /** * Called when the component loses focus. */ onBlur?: (e: <>) => ; /** * Handler that is called when the element's focus status changes. * @deprecated Use onFocus/onBlur instead. */ onFocusChange?: (isFocused: ) => ; };
Still have questions?
Find answers in the Dynatrace Community