Skip to Content

Code

A typography component that displays inline or block text using a monospaced font for code snippets. 

console.log()

Sizes

Use the code-{size} class to control the component size.

Size values can include:smmdlg.

For more information on all available font size utilities, visit Tailwind 

console.log()
console.log()
console.log()

Variants

Use the variant and palette classes to control the appereance of the component.

Variant values can include solidoutlinesurfacesubtleplain.
Color palettes can include primaryneutral. For extra palettes such as warning error and more, refer to the Colors section.

console.log()console.log()console.log()console.log()console.log()
console.log()console.log()console.log()console.log()console.log()

Customizing

globals.css
:root { --ex-code-font-size-sm: var(--text-2xs); --ex-code-font-size-md: var(--text-xs); --ex-code-font-size-lg: var(--text-sm); --ex-code-font-family-sm: var(--font-mono); --ex-code-font-family-md: var(--font-mono); --ex-code-font-family-lg: var(--font-mono); --ex-code-font-weight-sm: var(--font-weight-normal) --ex-code-font-weight-md: var(--font-weight-normal) --ex-code-font-weight-lg: var(--font-weight-normal) --ex-code-px-sm: calc(var(--spacing) * 1); --ex-code-px-md: calc(var(--spacing) * 1); --ex-code-px-lg: calc(var(--spacing) * 1); --ex-code-radius-sm: var(--radius-sm); --ex-code-radius-md: var(--radius-sm); --ex-code-radius-lg: var(--radius-sm); }

API

ElementSelector
Code.ex-code
PropTypeDefault
asElementTypecode
asChildbooleanfalse
Last updated on