---
title: "Kbd"
description: "Элемент kbd для обозначения ввода с клавиатуры."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/kbd"
---
# Kbd

> Элемент kbd для обозначения ввода с клавиатуры.

## Использование

Слот по умолчанию задаёт значение Kbd.

```vue
<template>
  <B24Kbd>K</B24Kbd>
</template>
```

### Значение

Пропс `value` задаёт значение Kbd.

```vue
<template>
  <B24Kbd value="K" />
</template>
```

В пропс `value` можно передавать специальные клавиши, которые обрабатываются композаблом [`useKbd`](https://github.com/bitrix24/b24ui/blob/main/src/runtime/composables/useKbd.ts). Например, клавиша `meta` отображается как `⌘` в macOS и как `Ctrl` на других платформах.

```vue
<template>
  <B24Kbd value="meta" />
</template>
```

### Акцент

Пропс `accent` меняет вариант Kbd.

```vue
<template>
  <B24Kbd accent="accent">K</B24Kbd>
</template>
```

### Размер

Пропс `size` меняет размер Kbd.

```vue
<template>
  <B24Kbd size="lg">K</B24Kbd>
</template>
```

## Примеры

### Пропс `class`

Пропс `class` переопределяет базовые стили Badge.

```vue
<template>
  <B24Kbd class="text-(--ui-color-copilot-accent-primary) dark:text-(--ui-color-accent-main-warning) font-(--ui-font-weight-bold) rounded-full" accent="accent">K</B24Kbd>
</template>
```

## API

### Пропсы

```ts
/**
 * Props for the Kbd component
 */
interface KbdProps {
  /**
   * The element or component this component should render as.
   * @default 'kbd'
   */
  as?: any;
  value?: string | undefined;
  /**
   * @default 'default'
   */
  accent?: "default" | "accent" | "less" | undefined;
  /**
   * @default 'md'
   */
  size?: "sm" | "md" | "lg" | undefined;
  b24ui?: { base?: SlotClass; } | undefined;
}
```

### Слоты

```ts
/**
 * Slots for the Kbd component
 */
interface KbdSlots {
  default(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    kbd: {
      slots: {
        base: 'inline-flex items-center justify-center px-1 rounded-(--ui-border-radius-2xs) font-(--ui-font-weight-normal) font-[family-name:var(--ui-font-family-system-mono)] uppercase border border-(length:--b24ui-border-width) border-(--b24ui-border-color) text-(--b24ui-color) bg-(--b24ui-background)'
      },
      variants: {
        accent: {
          default: 'style-outline',
          accent: 'style-outline-accent-1',
          less: 'style-outline-no-accent'
        },
        size: {
          sm: 'h-[20px] min-w-[20px] text-(length:--ui-font-size-4xs)/(--ui-font-line-height-reset)',
          md: 'h-[24px] min-w-[24px] text-(length:--ui-font-size-md)/(--ui-font-line-height-reset)',
          lg: 'h-[28px] min-w-[28px] text-(length:--ui-font-size-2xl)/(--ui-font-line-height-reset)'
        }
      },
      defaultVariants: {
        accent: 'less',
        size: 'md'
      }
    }
  }
})
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
