Important note: to format code exactly as it is, you should use String.raw`your code here`.
Using String.raw`` will keep all the special characters like \n
or \t
.
Examples
Basic
apiVersion: helm.openshift.io/v1beta1/
kind: HelmChartRepository
metadata:
name: azure-sample-repo0oooo00ooo
spec:
connectionConfig:
url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs
Expandable
apiVersion: helm.openshift.io/v1beta1/
kind: HelmChartRepository
metadata:
name: azure-sample-repo
Props
CodeBlock
Name | Type | Default | Description |
---|---|---|---|
actions | React.ReactNode | null | Actions in the code block header. Should be wrapped with CodeBlockAction. |
children | React.ReactNode | null | Content rendered inside the code block |
className | string | Additional classes passed to the code block wrapper |
CodeBlockAction
Name | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | null | Content rendered inside the code block action |
className | string | Additional classes passed to the code block action |
CodeBlockCode
Name | Type | Default | Description |
---|---|---|---|
children | React.ReactNode | null | Code rendered inside the code block |
className | string | Additional classes passed to the code block pre wrapper | |
codeClassName | string | Additional classes passed to the code block code |
CSS variables
Expand or collapse column | Selector | Variable | Value | |
---|---|---|---|---|
.pf-v6-c-code-block | --pf-v6-c-code-block--BackgroundColor | (In light theme) #f2f2f2 | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block--BorderRadius | 16px | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__header--BorderBlockEndWidth | 1px | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__header--BorderBlockEndColor | (In light theme) #c7c7c7 | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__header--PaddingBlockStart | 0.25rem | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__header--PaddingBlockEnd | 0.25rem | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__header--PaddingInlineEnd | 0.5rem | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__header--PaddingInlineStart | 0.5rem | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__content--PaddingBlockStart | 1rem | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__content--PaddingInlineEnd | 1rem | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__content--PaddingBlockEnd | 1rem | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__content--PaddingInlineStart | 1rem | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__pre--FontFamily | "Red Hat Mono", "RedHatMono", "Courier New", Courier, monospace | ||
| ||||
.pf-v6-c-code-block | --pf-v6-c-code-block__pre--FontSize | 0.75rem | ||
|