motion-code-inline
Inline <code> tag with a styled background, monospace font, and an optional copy button. The accent, background, and icon colours are all controllable via CSS custom properties.
Preview
Run
Import
Usage
Copy on hover
Add copy — a copy icon appears on hover and copies the text content on click. The icon briefly switches to a checkmark as feedback.
Always visible copy
Use copy-visible to keep the copy button always visible — no hover required.
Properties
| Attribute | Property | Type | Default | Description |
|---|---|---|---|---|
| | | boolean | false | Show a copy button on hover. Copies text content on click and shows a checkmark briefly. |
| | | boolean | false | Keep the copy button always visible instead of only on hover. |
CSS variables
| Variable | Type | Default | Description |
|---|---|---|---|
| | color | #2563eb | Text colour and icon hover colour |
| | color | #2563eb18 | Background fill behind the code text |
| | color | #60608a | Copy icon default colour |
Theming
All colours are CSS custom properties that pierce the Shadow DOM. Override them on any parent to match your brand.
Import
Run
Accessibility
No motion or animation — the component is purely visual and fully functional with all accessibility settings. Respects system colours via CSS custom properties.