web/lib/opal/src/components/code/README.md
A block code snippet with an optional hover-reveal copy button.
Uses Hoverable.Root / Hoverable.Item so the copy button appears on hover without any manual CSS — fully consistent with Opal hover patterns.
import { Code } from "@opal/components";
// With copy button (default)
<Code>npm install @onyx/sdk</Code>
// Without copy button
<Code showCopyButton={false}>{"const x = 1;"}</Code>
| Prop | Type | Default | Description |
|---|---|---|---|
children | string | — | Required. The code text to display. |
showCopyButton | boolean | true | Show the hover-reveal copy-to-clipboard button. |
All other HTMLElement attributes (except style and className) are forwarded to the inner <code> element.
font-secondary-mono (12px DM Mono, consistent with the Opal design system).background-tint-00 / border-01 tokens.break-all to prevent horizontal overflow.Hoverable.Item variant="appear-on-hover".