Components/Media
Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/codesnippet
CodeSnippet displays a piece of code or a terminal command and lets users copy it to the clipboard in a single click. Use it in documentation, onboarding flows, and developer-facing surfaces where people need to read or reuse exact code.
<Text/> instead.<Input/> instead.inline - code inside running textsingleline - one command in a copyable boxmultiline - a multi-line code blocktinysmall (default for singleline / multiline)mediumFor inline, size inherits from the surrounding text unless set explicitly.
By default the multiline variant scrolls horizontally when a line overflows. Set wrapText to wrap long lines onto the next line instead.
__
Applies only to multiline.
Customize the copy tooltip with copyTooltipText (idle) and copiedTooltipText (right after a successful copy).
Set disableCopy to hide the copy button (for singleline / multiline) or render inline code as static, non-interactive text.
The copy action writes the displayed code to the clipboard by default. Use copyText to copy something different from what's shown.
onCopy fires after a successful clipboard write and receives the copied value.
Surface the package install command at the top of documentation.
Show a copy-ready quick-start block.
Use the inline variant to mark up specific text without breaking the flow.
Pair it with a Card to present an install or setup step as a self-contained block.
Drop an inline snippet into a SectionHelper to call out an exact command inside a tip.
Use a FormField label to present a copyable, read-only value such as an API key or ID.
| Name | Type | Default | Description |
|---|---|---|---|
ariaLabel | string | — | Adds an aria-label to the root element. |
code (required) | string | — | Code to render inside the snippet. |
copiedTooltipText | string | — | Tooltip label shown right after a successful copy. Auto-reverts to copyTooltipText after 3 seconds. Defaults to 'Copied to clipboard'. |
copyText | string | — | Text written to the clipboard when the copy action is triggered. Defaults to code. |
copyTooltipText | string | — | Tooltip label shown while idle (before the user copies). Defaults to 'Copy to clipboard'. |
dataHook | string | — | Applies a data-hook HTML attribute that can be used in tests. |
disableCopy | boolean | false | Disables copy functionality across all variants. For inline the code renders as static, non-interactive text; for singleline / multiline the copy button is hidden. |
onCopy | (copiedValue: string) => void | — | Fires after a successful clipboard write. Receives the value that was copied. |
size | "small" | "tiny" | "medium" | — | Controls the typography size. Defaults to 'small' for singleline and multiline; for inline, inherits from the surrounding text when omitted. |
tooltipProps | Omit<Partial<TooltipProps>, "content"> | — | Accepts props to forward to the <Tooltip/> that wraps the copy trigger, for example placement or delays. The snippet sets content itself, so use copyTooltipText and copiedTooltipText to customize the labels. |
variant | "inline" | "singleline" | "multiline" | 'singleline' | Visual variant of the snippet. |
wrapText | boolean | — | Wraps lines instead of using a horizontal scrollbar. Applicable only to the multiline variant. |
Import the driver matching your test environment:
| Method | Description |
|---|---|
exists | — |
getCode | — |
isCopyable | — |
copyContent | — |
getCopyButtonAriaLabel | — |
getAriaLabel | — |
element | Gets the component root element. |
click | Clicks on the component root element. |
base | Returns UniDriver for the base element. |
Last updated: 21 October 2026