Root Props
| Prop | Type | Default |
|---|---|---|
size | TextSize | — |
Defines the font size of the code element. Inherits from the typography system’s TextSize type. | ||
ref | Ref<HTMLElement> | — |
Ref forwarded to the native <code> HTML element. Enables direct access for focus, measurement, or custom logic. | ||
asChild | boolean | — |
If true, renders the text as a child component using Slot. Useful for compatibility with native elements or other components. | ||
fontWeight | 400 | 500 | 600 | 700 | 900 | — |
| Font weight applied to the text. Common values: 400: Regular; 500: Medium; 600: Semi-bold; 700: Bold; 900: Extra bold | ||
Also accepts all <span> attributes.
Child Parts
- None.
Codeis a single exported primitive.
Types
CodeProps
State Model
Codehas no controlled state.- Visual presentation is static unless parent content or styles change.