Skip to main content Home
About About the Design SystemRoadmap
Get started OverviewDesignersDevelopers
Foundations OverviewColorGridIconographyInteractionsSpacingTypography
Tokens Overview Global colorbox shadowTypographyborderopacityspacelengthIconBreakpointsMedia Queries
Elements All elements Accordion Alert Announcement Audio player Avatar Back to top Badge Blockquote Breadcrumb Button Card Chip Code block Call to action Dialog Disclosure Footer Health index Icon Jump links Navigation (primary) Navigation (secondary) Pagination PopoverPlanned Progress stepsPlanned Site status Skip link Spinner Statistic Subnavigation Surface Switch Table Tabs Tag Tile Timestamp Tooltip Video embed
Theming OverviewColor PalettesCustomizingDevelopers
Patterns All PatternsCardTabsFilterFormLinkLink with iconLogo wallSearch barSkip navigationSticky bannerSticky cardTileVideo thumbnail
Personalization All Personalization PatternsAnnouncement
Accessibility FundamentalsAccessibility toolsAssistive technologiesCI/CDContentContributorsDesignDevelopmentManual testingResourcesScreen readers
Design/code status Release notes Get support

Code block

OverviewStyleGuidelinesCodeAccessibilityDemos
StyleColor schemeSpaceInteraction statesStyleColor schemeSpaceInteraction states

Style

A code block displays read-only text with code formatting within a light gray container.

Anatomy

Image of code block anatomy showing two annotations
  1. Code text
  2. Container

Color scheme

Code block is available for both light and dark color schemes.

Light theme

Image of light theme code block

Dark theme

Image of dark theme code block

Configuration

Code block text is always horizontally and vertically centered.

Image of a code block showing alignment and border radius specs

Space

Container spacing reduces as breakpoints get smaller.

Image of a code block spacing for all breakpoints

Interaction states

A code block includes only text and is not interactive right now.

© 2021-2025 Red Hat, Inc. Deploys by Netlify