UI Kit 2 components
UI Kit 2 hooks
Product bridge APIs
Jira bridge APIs
Upgrade to latest UI Kit 2
Previous versions

Code

To add the Code component to your app:

1
2
import { Code } from '@forge/react';

Description

Code highlights short strings of code snippets inline with body text.

Props

NameTypeRequiredDescription
childrenstringNoContent to be rendered in the inline code block.

Examples

Inline code

Formatted code can appear in a variety of contexts, increasing the legibility and contrasting it against default paragraph text.

Use inline code when you wish to highlight a short code snippet from the surrounding default text, such as when referencing variable names.

Example image of inline code

1
2
const CodeDefaultExample = () => {
  return (
    <Text>
      To start creating a changeset, run <Code>yarn changeset</Code>. Then
      you'll be prompted to select packages for release.
    </Text>
  );
};

Rate this page: