Code visually marks technical text in a monospace font family, alternate colors, and responsive font size.
| # | Required | Element | Description |
|---|---|---|---|
| 1 | Text | Monospace text with distinct colors used to stand out from body text. |
Code, built on top of Text, is a typographic component used to visually mark short, technical references apart from surrounding body text. Use cases include, but are not limited to, the following forms:
email, customer_id<table>, opacity{{snippets.name}}Avoid using Code for non-technical items or items that would be better served being written as plain body text.
Code and CodeBlock are both used to display technical text. However, it's important to understand the difference as they are not fully interchangeable:
Code uses a relative font size of 90%, allowing it to remain visually proportional to its parent text block.
email attributestimezone valueUse the customer_id attribute to identify profiles.
form_submitCode adapts to the font size of its surrounding text, maintaining visual proportion at every level.
Code should contain the exact technical text a user would encounter in their codebase, API, or data model. Avoid reformatting or shortening terms to prevent confusion.
Add the anonymous_id attribute to your identify call.
Add the Anonymous ID attribute to your identify call.
Code is designed to co-exist with other text in a sentence or phrase instead of standing alone. Use surrounding body copy to help provide context for what the technical reference means or does.
Set the timezone attribute to override the workspace default.
timezoneCode is best kept short and to a singular reference per Code component. For longer technical text that may require multi-line support, use CodeBlock instead.
The form_submit event fires when a visitor completes the form.
The form_submit event fires when a visitor completes the form.