Code Block

Displays a code block with an optional header and output area.

Import the component and piece the parts together.

CodeBlock.Content

height

string | number

maxHeight

string | number

wrap

prepre-wrap

CodeBlock.LineGroup

gutter

nonenumberscli

CodeBlock.Line

color

yellowredbluegreenfocused

Use the Output part to display the result of running the Code Block code.

Use the Header part to display related information, like the Code Block title and language.

The Code Block design can accommodate Tabs in the header.

Use gutter="cli" to display gutters that indicate a command line interface. The second and subsequent lines will indicate a multi-line input.

Use gutter="numbers" to display automatic line numbers in the gutters.

Use the color prop to highlight a code line.

Use the blue highlight when you need a more subtle call-out in the code block.

Green and red highlight colors automatically display plus and minus symbols in the gutter, indicating added and removed lines.

Use the maxHeight prop to limit the height of long code blocks and enable scrolling.

Use the height prop to set a fixed height for code blocks.

Admin Portal

2 variants found

CodeBlock in Iam Policyadmin-portal

/p/:portalSessionId/log-streams/:logStreamId/s3

CodeBlock in Iam Policyadmin-portal

/p/:portalSessionId/log-streams/:logStreamId/s3

Context

CodeBlock.Content
PropTypeDefaultRequired
height
string | numberno
maxHeight
string | numberno
wrap
"pre" | "pre-wrap"no
CodeBlock.LineGroup
PropTypeDefaultRequired
gutter
"none" | "numbers" | "cli"no
CodeBlock.Line
PropTypeDefaultRequired
color
"yellow" | "red" | "blue" | "green" | "focused"no

Usage

Used 40 times across 2 packages

Dashboard
23
Admin Portal
17

Variant Distribution

wrap

pre
100%

Where it's used

11 files

packages/dashboard/src/components/code-highlighter.tsx6
packages/dashboard/src/legacy-pages/[environmentId]/actions/test/index.tsx6
packages/admin-portal/src/components/saml-session-saml-request.tsx4
packages/admin-portal/src/components/saml-session-saml-response.tsx4
packages/dashboard/src/components/chromeless-codeblock/index.tsx2
packages/dashboard/src/components/configuration/custom-attributes/view-attributes-payloads-dialog.tsx2
packages/dashboard/src/components/flags/onboarding-card.tsx2

/code-editor

packages/dashboard/src/app/(private)/code-editor/demo.tsx5

/p/:portalSessionId/log-streams/:logStreamId/generic-https

packages/admin-portal/src/app/p/[portalSessionId]/log-streams/[logStreamId]/generic-https/event-structure.tsx4

/p/:portalSessionId/log-streams/:logStreamId/s3

packages/admin-portal/src/app/p/[portalSessionId]/log-streams/[logStreamId]/s3/iam-policy.tsx4

Show 1 more files