Code block
On this page
Guidelines
Use a code block to visually separate code text from other content on the page.
Writing content
The length of code and number of lines will change the width and height of a code block.
Warning
The toggle overflow/toggle word wrapping and expand/collapse buttons are not visible when there is minimal amounts of code text.
Behavior
Expanding/collapsing
When the expand/collapse button is selected, a code block expands to reveal the rest of the code text in its entirety. A code block must include at least 5 lines of code text in order for this feature to be activated.
Helpful tip
A code block is collapsed by default when the expand/collapse button becomes visible.
Responsive design
A code block switches to the Compact size on mobile breakpoints.
Best practices
Customizing code text
Customize code text using syntax highlighting only.
Do not change other code block styles.
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.