Garden 9 is now available.
The website has been updated to the latest major version. View previous versions
Skip to main content
Design
Components
Patterns
    • Introduction
      • Overview
    • Foundations
      • Bedrock CSS
      • Design tokens
      • Containers
      • Theming
      • Versions
    • Components
      • Accordion
      • Anchor
      • Avatar
      • Breadcrumbs
      • Buttons
      • Chrome
      • Code block
      • Color picker
      • Color swatch
      • Date picker
      • Draggable
      • Drawer
      • Forms
      • Grid
      • Loaders
      • Menu
      • Modal
      • Notification
      • Pagination
      • Pane
      • Sheet
      • Status indicator
      • Stepper
      • Table
      • Tabs
      • Tags
      • Tiles
      • Timeline
      • Tooltip
      • Tooltip dialog
      • Typography
        • Code
        • Lists
        • Paragraph
        • Span
        • Typography
      • Well
    Table of Contents
    • How to use it
      • Default
      • Color
      • Size
    • Configuration
    • API
      • Code

    Code

    Use Code to style and format inline fragments of computer code.


    Table of Contents
    • How to use it
      • Default
      • Color
      • Size
    • Configuration
    • API
      • Code

    How to use it

    Default

    Use Code to style and format <code> elements.

    Toggle dark mode
    Set primary hue
    Toggle RTL
    Open in CodeSandbox
    Copy code
    View code

    Color

    You can also change background and text color.

    Toggle dark mode
    Set primary hue
    Toggle RTL
    Open in CodeSandbox
    Copy code
    View code

    Size

    Code comes in small, medium, and large. By default, size is inherited from the parent element.

    Toggle dark mode
    Set primary hue
    Toggle RTL
    Open in CodeSandbox
    Copy code
    View code

    Configuration

    • Name9.5.3•View source•View on npm
    • Installnpm install @zendeskgarden/react-typography
    • Depsnpm install react react-dom styled-components @zendeskgarden/react-theming
    • Importimport { Code } from '@zendeskgarden/react-typography'

    API

    Code

    Extends HTMLAttributes<HTMLElement>

    Prop nameTypeDefaultDescription
    hue
    'grey' | 'red' | 'green' | 'yellow'
    'grey'

    Applies color to the background and the text

    size
    'small' | 'medium' | 'large' | 'inherit'
    'inherit'

    Adjusts the font size. By default font size is inherited from the surrounding text.

    Garden is the design system by Zendesk.
    BlogGitHubVersions
    © Zendesk 2025