---
title: "Stat"
description: "Плитка с одним показателем: подпись, значение, пояснение и стрелка динамики."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/stat"
---
# Stat

> Плитка с одним показателем: подпись, значение, пояснение и стрелка динамики.

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

Stat показывает одно число с подписью. Несколько плиток удобно собирать в сетку.

```vue
<template>
  <B24Stat label="Сделок в работе" :value="12" class="w-56" />
</template>
```

### Пояснение

Пропс `hint` добавляет строку под значением, например второе число.

```vue
<template>
  <B24Stat label="Выручка" value="278 149 BYN" hint="26 сделок" class="w-56" />
</template>
```

### Динамика

Пропс `trend` рисует стрелку рядом со значением: `up` — рост, `down` — снижение.

```vue
<template>
  <B24Stat label="Просрочено" :value="4" trend="down" class="w-56" />
</template>
```

### Размер

Пропс `size` меняет отступы и размер текста.

```vue
<template>
  <B24Stat size="lg" label="Выиграно" :value="38" class="w-64" />
</template>
```

## API

### Свойства

```ts
/**
 * Props for the Stat component
 */
interface StatProps {
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  /**
   * The name of the metric.
   */
  label?: string | undefined;
  /**
   * The value of the metric, with its unit.
   */
  value?: string | number | undefined;
  /**
   * A note under the value, for example a second number.
   */
  hint?: string | undefined;
  /**
   * The direction of the change: an arrow next to the value.
   */
  trend?: "up" | "down" | undefined;
  /**
   * @default 'md'
   */
  size?: "md" | "sm" | "lg" | undefined;
  b24ui?: { root?: SlotClass; label?: SlotClass; body?: SlotClass; value?: SlotClass; trend?: SlotClass; trendIcon?: SlotClass; hint?: SlotClass; } | undefined;
}
```

### Слоты

```ts
/**
 * Slots for the Stat component
 */
interface StatSlots {
  label(): any;
  value(): any;
  trend(): any;
  hint(): any;
  default(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    stat: {
      slots: {
        root: 'relative flex min-w-0 flex-col gap-1 rounded-(--ui-border-radius-md) bg-(--ui-color-design-outline-na-bg) border border-(--ui-color-design-outline-na-stroke) border-(length:--ui-design-outline-na-stroke-weight) text-(--ui-color-design-outline-na-content)',
        label: 'truncate text-(--ui-color-design-outline-na-content-secondary)',
        body: 'flex min-w-0 items-baseline gap-2',
        value: 'min-w-0 truncate font-(--ui-font-weight-semi-bold) text-(--ui-color-design-outline-na-content)',
        trend: 'inline-flex shrink-0 items-center',
        trendIcon: 'size-[16px] shrink-0',
        hint: 'truncate text-(--ui-color-design-outline-na-content-secondary)'
      },
      variants: {
        size: {
          sm: {
            root: 'p-3',
            label: 'text-(length:--ui-font-size-xs)',
            value: 'text-(length:--ui-font-size-xl)/(--ui-font-line-height-3xs)',
            hint: 'text-(length:--ui-font-size-xs)'
          },
          md: {
            root: 'p-4',
            label: 'text-(length:--ui-font-size-sm)',
            value: 'text-(length:--ui-font-size-3xl)/(--ui-font-line-height-3xs)',
            hint: 'text-(length:--ui-font-size-sm)'
          },
          lg: {
            root: 'p-5',
            label: 'text-(length:--ui-font-size-md)',
            value: 'text-(length:--ui-font-size-4xl)/(--ui-font-line-height-3xs)',
            hint: 'text-(length:--ui-font-size-md)'
          }
        },
        trend: {
          up: {
            trend: 'text-(--ui-color-design-tinted-success-content)'
          },
          down: {
            trend: 'text-(--ui-color-accent-main-alert)'
          }
        }
      },
      defaultVariants: {
        size: 'md'
      }
    }
  }
})
```

## Sitemap

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