--- import DefaultLayout from '@shared/layouts/DefaultLayout.astro' import Card from '@ui/Card.astro' import CardBody from '@ui/CardBody.astro' import CardTitle from '@ui/CardTitle.astro' import CardSubtitle from '@ui/CardSubtitle.astro' import DocsLink from '@ui/DocsLink.astro' import CodeBlock from '@ui/CodeBlock.astro' const install = `npm install @tabler/core pnpm add @tabler/core yarn add @tabler/core` const config = `{ "name": "my-dashboard", "dependencies": { "@tabler/core": "^1.6.0" } }` const script = `import { Clipboard } from '@tabler/core' const button = document.querySelector('#share') const clipboard = Clipboard.getOrCreateInstance(button, { text: window.location.href, }) button.addEventListener('copied.bs.clipboard', () => { console.log('Link copied') }) clipboard.copy()` const markup = `` const command = 'curl -X POST https://api.example.com/v1/projects/42/deployments -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d \'{"branch": "main", "environment": "production"}\'' ---
Basic A .code-block around a pre. The copy button sits in the top right corner.
With header A title or a file name and a language label. The copy button moves into the header.
Line numbers and highlighted lines Add .code-block-numbered and mark the lines to point out with .code-line-highlight.
Max height Add .code-block-scroll to scroll long code vertically. Change the height with --tblr-code-block-max-height.
Header variants The header can hold only a title, only a language, or both.
Markup Any text works, also HTML. The copy button copies the code as written.
Long lines Lines that do not fit scroll horizontally with the themed scrollbar. The page does not scroll.
Without copy button Set copy={'{false}'} on the component, or leave the button out of the markup.