Code block
Style
A code block displays read-only and code-formatted text. Included are buttons to copy the code text or toggle how it is displayed in the container.
Anatomy
- Line numbers
- Code text
- Expand/collapse button
- Copy to clipboard button
- Toggle overflow button
- Toggle word wrapping button
Color scheme
Code block is available for both light and dark color schemes.
Light scheme
Dark scheme
Variants
Line numbers
A code block may or may not show line numbers.
Fixed width
A code block can adhere to the width of code text or be a fixed width.
Compact size
The Large size is the default and there is a Compact size for smaller use cases like mobile.
Syntax highlighting
Code text can be highlighted with various colors to enhance readability.
Space
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.