Surfaces and display
Code block and key
Code, commands and other text to copy. .kui-codeblock has a head with the language and a <kui-copy> button; .kui-kbd shows a key to press; .kui-code marks code in a sentence.
Examples
With a head and a copy button
Press Copy: the text goes to the clipboard, the button says “Copied” for two seconds, and a screen reader hears it.
Terminal
curl -s https://example.com/api/invoices?month=2026-11 \
-H "Authorization: Bearer ${TOKEN}" | jq '.[] | .amount'
HTML
<div class="kui-codeblock">
<div class="kui-codeblock__head"><span>Terminal</span><kui-copy for="codeblock-cmd"></kui-copy></div>
<pre tabindex="0" aria-label="Command"><code id="codeblock-cmd">curl -s https://example.com/api/invoices?month=2026-11 \
-H "Authorization: Bearer ${TOKEN}" | jq '.[] | .amount'</code></pre>
</div>
Plain, with the button in the corner
--plain has no head; the copy button sits in the top corner.
RS35 1050 0812 3123 1231 73
HTML
<div class="kui-codeblock kui-codeblock--plain">
<kui-copy for="codeblock-iban"></kui-copy>
<pre tabindex="0" aria-label="Account number"><code id="codeblock-iban">RS35 1050 0812 3123 1231 73</code></pre>
</div>
Keys and inline code
Press Ctrl + K to open the commands, or Esc to close them. The setting is data-kui-theme="ocean".
HTML
<p>Press <kbd class="kui-kbd">Ctrl</kbd> + <kbd class="kui-kbd">K</kbd> to open the commands, or <kbd class="kui-kbd">Esc</kbd> to close them. The setting is <code class="kui-code">data-kui-theme="ocean"</code>.</p>
States
Every state
Copied: the button turns green and says “Copied”. Could not copy: it says “Could not copy”. A long line scrolls sideways inside the block; the block can be focused so the keyboard scrolls it. Code with Cyrillic or Chinese keeps the monospace width as far as the font allows.
JSON
{"naziv": "Ђорђевић д.о.о.", "grad": "Крагујевац", "napomena": "这是一个很长的行,它在代码块内部横向滚动,而不会让整个页面横向滚动。", "iznos": 184500}
HTML
<div class="kui-codeblock">
<div class="kui-codeblock__head"><span>JSON</span><kui-copy text="{"naziv": "Ђорђевић д.о.о."}"></kui-copy></div>
<pre tabindex="0" aria-label="JSON example"><code>{"naziv": "Ђорђевић д.о.о.", "grad": "Крагујевац", "napomena": "这是一个很长的行,它在代码块内部横向滚动,而不会让整个页面横向滚动。", "iznos": 184500}</code></pre>
</div>
Classes and attributes
.kui-codeblock- The block. --plain has no head.
.kui-codeblock__head- The language or file name, and the copy button.
pre[tabindex="0"]- The code; focusable so it can be scrolled. Give it an aria-label.
kui-copy for="ID"- A copy button for the text of the element with that id. text="…" copies that text instead.
.kui-kbd- A key, in a
<kbd>. .kui-code- Code inside a sentence.
Keyboard
- Tab
- Moves to the copy button, then into the code.
- Enter or Space
- Copies.
- Arrow Left or Arrow Right
- Scroll a focused code block sideways.
Accessibility
- The copy button’s words come from the kit’s keyed words: Copy, Copied, Could not copy.
- The result is announced to screen readers, not only shown.
- A scrolling pre is focusable and named, so keyboard users can scroll it.
- Use
<kbd>for keys and<code>for code, so they are read as such.
Do and do not
Do
- Copy exactly what a person needs to paste, without a prompt sign.
- Name the language or the place to paste it in the head.
- Write secrets as a placeholder, ${TOKEN}.
Do not
- Do not wrap long lines of code; it changes what is copied.
- Do not show code as an image.
- Do not put a real key or password in an example.