Primer

IDE

Use the IDE to showcase a simulated integrated developer environment, complete with a code editor and AI chat that's intended to enhance code representation in marketing contexts.
import {IDE} from '@primer/react-brand'

Examples

Default

The IDE does not automatically apply syntax highlighting to code snippets. Usage of this component in GitHub.com is expected to use the proprietary tokenizer and highlighter, the output of which can be passed directly into IDE as a parameter.

See Storybook for examples of IDE using highlight.js syntax highlighter.

See syntax highlighter examples

Animations

Line-by-line animations can be enabled using pre-formatted prop values. A replay button is enabled by default.

GitHub Copilot suggestions

Simulate GitHub Copilot suggestions using the suggestedLineStart property.

GitHub Copilot chat

Simulate GitHub Copilot Chat using the IDE.Chat sub-component. The script is fully customizable, and code snippets will require pre-formatting to enable syntax highlighting.

See Storybook for a comprehensive example of the Chat feature, inclusive of syntax highlighting.

See Chat example in Storybook

Glass variant

A glass variant is available to simplify placement of the IDE on background images. This variant adds alpha transparency and background blurring.

Accessibility

The full contents of IDE.Chat and IDE.Editor are intentionally not made available to users of assistive technologies. Summaries of the content — which must be provided using the alternativeText prop — are made available instead.

When writing alternativeText, consider the following:

  • The IDE.Chat script should be summarized in a way that conveys the essential information of the conversation.
  • The IDE.Editor code should be summarized in a way that conveys the essential information of the code snippet, specifically noting any suggestions made by Copilot.

In both cases, the goal is to provide a meaningful summary of the content that will allow users of assistive technologies to understand the purpose and scope of the conversation or code snippet, without needing to understand the full content.

Component props

IDE Required

nametypedefaultrequireddescription
heightnumber800falseThe optionally configurable height of the IDE
variant'default'
'glass'
defaultfalseAlternative presentation of the IDE

IDE.Editor

nametypedefaultrequireddescription
activeTabnumberfalseActive tab index
filesIDEEditorFile[]trueArray of editor files
showLineNumbersbooleanfalseShow line numbers in the editor
size'small'
'medium'
'large'
falseControls editor text size
triggerAnimationbooleanfalseTrigger animation externally
showReplayButtonbooleanfalseShow replay button

Supported file extensions in the editor include: py, ts, js, jsx, hs, html, css, scss, json, md, yml, yaml, txt, sh, sql

IDE.Chat

nametypedefaultrequireddescription
scriptIDEChatMessage[]trueArray of chat messages
alternativeTextstringtrueAlternative description of the chat script for users of assistive technologies
animationDelaynumber3000falseDelay for the chat animation