Content
Code Block
Presents named code samples with accessible preformatted text and an optional copy action.
idle
Usage
Anatomy
The parts and how they nest, taken from the preview above.
Examples
Terminal command
A short shell command with Copy floating in the corner.
Longer file
Long code scrolls inside the block.
Recommendations
| Guidance | Practice |
|---|---|
| Do | Name the file or language and include the imports needed to use the example. Copy the same text that is displayed. |
Usage boundaries
| Guidance | Boundary |
|---|---|
| Scope | Code Block presents text and an optional copy action. It does not execute code or provide syntax highlighting. |
API reference
Public props from @mizen-labs/ui. Use exported prop types for the complete TypeScript contract.
| Prop | Type | Default | Description |
|---|---|---|---|
| | <figure> | Groups the label, preformatted source, and optional copy control. |
| | <figcaption> | Contains the sample title and its copy action. |
| | <span> | Names the code sample. |
| | <pre><code> | Renders caller-provided source with a required accessible name. |
| | — | Copies the explicitly provided source and reports the result politely. |