Display

Inline Text Key

A key inside a line of text that does not break the leading: the height is set in em, vertical padding is zero and the bulk comes from horizontal padding.

  • kbd
  • inline
  • typography
  • text

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/kbd-003?lang=en

Press +K to open the catalog search — the input appears above the page.

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 "kbd-003" (Inline Text Key) 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/kbd-003.json

Registry item: https://vibeui.ru/r/kbd-003.json
Installs to: components/vibeui/kbd-003.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
A key inside a line of text that does not break the leading: the height is set in em, vertical padding is zero and the bulk comes from horizontal padding.

A key inside a paragraph: em-based height, zero vertical padding and a nudge onto the baseline. Zero dependencies, one file, no client JS.

## 3. How to use it
import { Kbd003 } from "@/components/vibeui/kbd-003"

<Kbd003
  before="Press"
  keys={["⌘", "K"]}
  after="to open the catalog search."
/>

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-kbd-003-* palette — do not swap it for your theme tokens
- the zero vertical padding on the key: with it the line grows taller than its neighbours
- the em-based height and size — the key must scale together with the paragraph
- the 0.05em nudge instead of editing line-height: a line-height change affects the whole text
- nowrap on the chord, otherwise "⌘ + K" is split across lines
- the component's own light surface: paragraph and keys are dark and vanish on a dark background

## 6. You may change
- the text before the key through before
- the text after the key through after
- the chord contents through keys
- the paragraph width through max-width

## 7. Rules
- The key takes 1.5em of height: with leading below 1.5 the lines start touching.
- One or two chords per paragraph is the limit — beyond that the text becomes a list.
- The baseline nudge is tuned for the system font; verify it with your own typeface.
- 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/kbd-003.json
https://vibeui.ru/r/kbd-003.json

Серверный компонент, хуков нет. Обычная kbd с вертикальным паддингом делает свою строку выше соседних, и абзац «разъезжается». Здесь высота клавиши выражена в em и вписана в строку, вертикальные отступы нулевые, а точная посадка на базовую линию сделана сдвигом на 0.05em — не изменением line-height абзаца, которое поехало бы на весь текст. Кегль клавиши задан долей от текста (0.85em), поэтому она масштабируется вместе с абзацем. Сочетание обёрнуто в nowrap, чтобы «⌘ + K» не разорвался переносом. Подложка светлая: текст тёмный.

Component source

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

import type { ComponentPropsWithoutRef, CSSProperties } from "react"

export type Kbd003Props = Omit<ComponentPropsWithoutRef<"p">, "children"> & {
  before?: string
  keys?: string[]
  after?: string
}

// Идея компонента: клавиша внутри строки текста, которая не рвёт интерлиньяж.
// Обычная kbd с паддингом делает строку выше соседних, и абзац «разъезжается».
// Здесь высота клавиши задана в em и вписана в строку: вертикальные отступы
// нулевые, объём даёт padding по горизонтали и рамка, а вертикальное
// выравнивание — сдвиг на 0.05em, а не изменение line-height абзаца.
const STYLES = `
:where([data-vibeui-block="kbd-003"]){
--vibeui-kbd-003-surface:oklch(1 0 0);
--vibeui-kbd-003-fg:oklch(0.24 0.014 265);
--vibeui-kbd-003-border:oklch(0.87 0.008 265);
--vibeui-kbd-003-key:oklch(0.97 0.003 265);
--vibeui-kbd-003-font:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
}
/* Своя светлая подложка: абзац и клавиши тёмные. */
[data-vibeui-block="kbd-003"]{
display:block;box-sizing:border-box;margin:0;
width:100%;max-width:24rem;padding:0.875rem 1rem;
background:var(--vibeui-kbd-003-surface);
border:1px solid var(--vibeui-kbd-003-border);border-radius:0.875rem;
font-family:var(--vibeui-kbd-003-font);color:var(--vibeui-kbd-003-fg);
font-size:0.875rem;line-height:1.7;
}
/* Клавиша вписана в строку: нулевые вертикальные отступы, высота в em. */
[data-vibeui-block="kbd-003"] kbd{
display:inline-block;
height:1.5em;padding:0 0.4em;box-sizing:border-box;
background:var(--vibeui-kbd-003-key);
border:1px solid var(--vibeui-kbd-003-border);border-bottom-width:2px;
border-radius:0.35em;
font-family:inherit;font-size:0.85em;font-weight:650;line-height:1.4;
vertical-align:baseline;transform:translateY(0.05em);
white-space:nowrap;
}
[data-vibeui-block="kbd-003"] [data-part="combo"]{white-space:nowrap}
[data-vibeui-block="kbd-003"] [data-part="plus"]{opacity:.55;padding:0 0.15em}
@media (prefers-reduced-motion:reduce){[data-vibeui-block="kbd-003"] *{animation:none!important;transition:none!important}}
`

/**
 * Клавиша внутри строки текста без ломки интерлиньяжа абзаца.
 * Один файл, ноль зависимостей, собственная палитра.
 */
export function Kbd003({
  before = "Нажмите",
  keys = ["⌘", "K"],
  after = "чтобы открыть поиск по каталогу — строка ввода появится поверх страницы.",
  className,
  style,
  ...props
}: Kbd003Props) {
  return (
    <>
      <style href="vibeui-kbd-003" precedence="medium">
        {STYLES}
      </style>
      <p
        {...props}
        data-vibeui-block="kbd-003"
        className={className}
        style={style as CSSProperties}
      >
        {before}{" "}
        <span data-part="combo">
          {keys.map((key, index) => (
            <span key={key}>
              {index > 0 ? <span data-part="plus">+</span> : null}
              <kbd>{key}</kbd>
            </span>
          ))}
        </span>{" "}
        {after}
      </p>
    </>
  )
}