Code block
Style
A code block displays read-only code-formatted text within a flexible container.
Anatomy
- Line numbers
- Code text
- Copy button
- Wrap button
- Expand/collapse
- Container
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.
Property | Light Scheme | Dark Scheme |
---|---|---|
Line numbers text color | --rh-color-text-secondary |
--rh-color-text-secondary |
Line numbers border | --rh-color-border-subtle |
--rh-color-border-subtle |
Expand or collapse
A code block may expand or collapse to display more or less code. There must be at least 5 lines of code in order to display this feature.
Helpful tip
A code block is always collapsed by default if there are at least 5 lines of code.
Space
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.