Code Block

Inline Code

Inline code inside a paragraph: the command, the path and the key each get their own chip, and the chip background survives a line break.

  • inline
  • code
  • prose
  • kbd

Preview

1440pxHost theme

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.

put this in the header: https://vibeui.ru/c/codeblock-010?lang=en

How to install the component

Выполните npx shadcn@latest add codeblock-010 — файл ляжет в components/vibeui/codeblock-010.tsx и сразу заработает.

Терминал открывается по Ctrl + `; если команда не найдена, проверьте package.json.

Show the full instructions

What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.

# Install and place "codeblock-010" (Inline Code) from VibeUI

## 1. Install first — do not skip, do not recreate
Run this exact command before writing any code:
npx shadcn@latest add https://vibeui.ru/r/codeblock-010.json

Registry item: https://vibeui.ru/r/codeblock-010.json
Installs to: components/vibeui/codeblock-010.tsx (the exact path follows this project's components.json aliases).
npm dependencies: none.
Registry dependencies: none.

Install it from the registry. Do not recreate it from the description,
do not substitute a similar component from another library, and do not
rewrite it to match the project's existing style.

## 2. What it is
Inline code inside a paragraph: the command, the path and the key each get their own chip, and the chip background survives a line break.

A paragraph with inline code: command and path chips plus a key in kbd. The chip background survives wrapping. Zero dependencies, no client JS.

## 3. How to use it
import { Codeblock010 } from "@/components/vibeui/codeblock-010"

<Codeblock010
  heading="How to install the component"
  command="npx shadcn@latest add codeblock-010"
  file="components/vibeui/codeblock-010.tsx"
  shortcut="Ctrl + `"
/>

Read the installed file for the full prop list.

## 4. Where to place it
This is a small inline component. Put it exactly where the user asked,
inside the existing markup. Do not create a new page, section or
wrapper for it. If a similar control already sits in that spot,
replace it instead of adding a second one.

Placement: ___
(The user fills this line in. If it is still blank, ask where to put it
instead of guessing.)

## 5. Keep exactly as installed
- the local --vibeui-codeblock-010-* palette — do not swap it for your theme tokens
- box-decoration-break:clone: without it a wrapped chip loses its radius and looks broken
- the chip metrics in em — in pixels they fall apart at a different paragraph text size
- different colours for the command and the path: identical chips hide what you are looking at
- a separate kbd for the key: a key is not code and deserves its own surface
- the paragraph's own light surface: without it the dark text vanishes on a dark background

## 6. You may change
- the heading through heading
- the command through command and the path through file
- the key combination through shortcut
- the chip colours and the paragraph width

## 7. Rules
- A long path inside the paragraph breaks by overflow-wrap: better than scrolling the whole page.
- The chip is scaled to 0.8125em: monospaced faces look larger than body text at the same size.
- This block is not for multi-line code — use a regular pre block for that.
- Do not lift the CSS variables into globals.css: the component has to stay a single file.

## 8. Verify
- it renders with no console errors;
- it looks like the preview on the VibeUI page you copied this from;
- if it does not, you changed something listed in section 5 — put it back.

For developers

npx shadcn@latest add https://vibeui.ru/r/codeblock-010.json
https://vibeui.ru/r/codeblock-010.json

Компонент самодостаточен: один файл, без зависимостей, собственная палитра в локальных переменных --vibeui-codeblock-010-*. Серверный: хуков нет. Главный приём — box-decoration-break:clone на инлайновом code: без него у перенесённого куска пропадает скругление и правый отступ. Размеры чипа заданы в em, поэтому он масштабируется вместе с текстом абзаца; клавиша сделана отдельным элементом kbd с утолщённой нижней границей, чтобы её не путали с командой.

Component source

The same file your agent installs. Here in case you would rather copy it by hand.

import type { CSSProperties } from "react"

export type Codeblock010Props = {
  heading?: string
  command?: string
  file?: string
  shortcut?: string
  className?: string
  style?: CSSProperties
}

// Идея компонента: код внутри абзаца, а не блоком. Главная задача — чтобы
// подложка чипа не рвалась при переносе строки: за это отвечает
// box-decoration-break:clone, иначе у перенесённого куска пропадает скругление.
const STYLES = `
:where([data-vibeui-block="codeblock-010"]){
--vibeui-codeblock-010-bg:oklch(0.99 0.003 265);
--vibeui-codeblock-010-fg:oklch(0.27 0.016 265);
--vibeui-codeblock-010-muted:oklch(0.5 0.014 265);
--vibeui-codeblock-010-border:oklch(0.9 0.006 265);
--vibeui-codeblock-010-chip-bg:oklch(0.94 0.012 265);
--vibeui-codeblock-010-chip-fg:oklch(0.32 0.09 300);
--vibeui-codeblock-010-path-fg:oklch(0.36 0.09 240);
--vibeui-codeblock-010-key-bg:oklch(1 0 0);
--vibeui-codeblock-010-mono:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;
--vibeui-codeblock-010-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
[data-vibeui-block="codeblock-010"]{
display:block;width:100%;max-width:30rem;box-sizing:border-box;
padding:1.125rem 1.25rem 1.25rem;
border:1px solid var(--vibeui-codeblock-010-border);border-radius:0.875rem;
background:var(--vibeui-codeblock-010-bg);color:var(--vibeui-codeblock-010-fg);
font-family:var(--vibeui-codeblock-010-font);font-size:0.875rem;line-height:1.65;
}
[data-vibeui-block="codeblock-010"] h3{
margin:0 0 0.5rem;font-size:1rem;line-height:1.3;letter-spacing:-0.01em;
}
[data-vibeui-block="codeblock-010"] p{margin:0 0 0.625rem}
[data-vibeui-block="codeblock-010"] p:last-child{margin-bottom:0;color:var(--vibeui-codeblock-010-muted)}
/* clone сохраняет фон и скругление у обеих половин перенесённого чипа. */
[data-vibeui-block="codeblock-010"] code{
font-family:var(--vibeui-codeblock-010-mono);
font-size:0.8125em;line-height:inherit;
padding:0.125em 0.375em;border-radius:0.3125em;
background:var(--vibeui-codeblock-010-chip-bg);color:var(--vibeui-codeblock-010-chip-fg);
overflow-wrap:break-word;
-webkit-box-decoration-break:clone;box-decoration-break:clone;
}
[data-vibeui-block="codeblock-010"] code[data-kind="path"]{color:var(--vibeui-codeblock-010-path-fg)}
[data-vibeui-block="codeblock-010"] kbd{
font-family:var(--vibeui-codeblock-010-font);font-size:0.75em;font-weight:650;
padding:0.1875em 0.4375em;border-radius:0.3125em;
border:1px solid var(--vibeui-codeblock-010-border);
border-bottom-width:2px;
background:var(--vibeui-codeblock-010-key-bg);color:var(--vibeui-codeblock-010-fg);
white-space:nowrap;
}
`

/** Инлайновый код в абзаце: чипы команды, пути и клавиши. */
export function Codeblock010({
  heading = "Как поставить компонент",
  command = "npx shadcn@latest add codeblock-010",
  file = "components/vibeui/codeblock-010.tsx",
  shortcut = "Ctrl + `",
  className,
  style,
}: Codeblock010Props) {
  return (
    <>
      <style href="vibeui-codeblock-010" precedence="medium">
        {STYLES}
      </style>
      <div
        data-vibeui-block="codeblock-010"
        className={className}
        style={style}
      >
        <h3>{heading}</h3>
        <p>
          Выполните <code>{command}</code> — файл ляжет в{" "}
          <code data-kind="path">{file}</code> и сразу заработает.
        </p>
        <p>
          Терминал открывается по <kbd>{shortcut}</kbd>; если команда не
          найдена, проверьте <code data-kind="path">package.json</code>.
        </p>
      </div>
    </>
  )
}