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.

Changes to CodeSnippet. The full components changelog also lists package-wide and cross-cutting entries.

3.11.3

Updates

  • Fixed a crash when copying code in environments that block clipboard access, such as embedded pages. (APPDEV-19495)
  • Fixed function names with trailing digits being incorrectly highlighted as number literals when rendering DQL syntax. (APPDEV-19541)

3.10.0

Updates

  • Fixed the freeze that occurred when syntax highlighting a DQL code snippet containing a triple-quoted string with many escaped quotes. (APPDEV-18665)

3.8.0

Updates

  • Introduced a fullHeight prop that allows the component to fill the height of its parent container. (APPDEV-17851)

3.6.0

Updates

  • Null literals are now syntax-highlighted when using the dql language. (APPDEV-17731)
  • With the DQL language, a query between at least two triple-quoted strings in one line is no longer highlighted as a string. (APPDEV-17719)
  • With the DQL language, a single-line comment containing consecutive double-quote characters is now correctly highlighted as a comment to the end of the line. (APPDEV-17719)

3.5.0

Updates

  • Keyword highlighting for DQL language no longer highlights non-keywords, matching the behavior of the DQLEditor. (APPDEV-11154)
  • Syntax highlighting for DQL language no longer highlights the colon of a parameter. (APPDEV-11154)
  • Number literals followed by a duration or calendar duration unit suffix are now highlighted when using the dql language. (APPDEV-17380)
  • Boolean literals are now syntax-highlighted when using the dql language. (APPDEV-17379)
  • Added log-language highlighting support for 16-character hex IDs (letter-leading and digit-leading). (APPDEV-11851)

3.4.0

Updates

  • Kotlin, Swift, and Groovy are now supported languages. (APPDEV-12954)

3.2.0

Updates

  • No longer crashes on very large inputs. Syntax highlighting is now limited to the first 100,000 characters; content beyond that is rendered as plain text without syntax highlighting or dynamic line breaks. (APPDEV-16797)
  • Added data-dt-name attribute to the copy button. (APPDEV-16670)
Still have questions?
Find answers in the Dynatrace Community