Code Block
Numbered Lines
A code block with line numbers that stay out of the clipboard when the code is copied. Suits documentation. Change the code, the language and the file label.
What you can change
- the code and its highlighting through the lines array, where a token carries kind
- the block heading through title
- the first number through start when you show a fragment from the middle of a file
A link for your AI agent: preview, code and instructions.
Preview
Use it with AI
- 1. Copy the link.
- 2. Write to your agent in your own words and drop the link into the sentence.
- 3. The agent opens the link and installs the component from the registry.
put this on the home page as the hero:
https://vibeui.ru/c/codeblock-001?lang=en&theme=dark
Not sure where to paste it? Step-by-step guide
Show the full instructions
What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.
Loading…
For developers
The install command lives in the “Component source” block below — a signed link that stays valid for 24 hours.
Technical notes
The component is self-contained: one file, zero dependencies, its own palette in the local --vibeui-codeblock-001-* variables. Server component: no hooks. Every line is a span with display: block inside pre > code; the number is printed by ::before through counter-increment, so it is not part of the selection and does not end up in the clipboard. The start of the numbering is passed into counter-reset through a variable computed from the start prop. The theme comes from the surrounding color-scheme through light-dark(): the block has no surface by default, and the border and the header rest on translucent overlays, so the block reads on a light page as well as on a dark one. The highlighting is done with markup rather than a parser: the lines arrive as an array of tokens with a kind field, and the colours are attached by [data-token] selectors.
Tags
- code
- line-numbers
- counter
- syntax
Component source
The same file your agent installs. Here in case you would rather copy it by hand.
Loading…