---
title: "BarList"
description: "Горизонтальные полосы для сравнения значений: сотрудники, клиенты, стадии."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/bar-list"
---
# BarList

> Горизонтальные полосы для сравнения значений: сотрудники, клиенты, стадии.

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

Пропс `items` — массив строк с подписью и числом. Длина полосы считается от наибольшего значения.

```vue
<script setup lang="ts">
import type { BarListItem } from '@bxshefby/b24ui-nuxt'

const items = ref<BarListItem[]>([
  {
    label: "Анна Иванова",
    value: 12
  },
  {
    label: "Борис Петров",
    value: 8
  },
  {
    label: "Вера Сидорова",
    value: 3
  }
])
</script>

<template>
  <B24BarList unit="сделок" :items="items" class="w-96" />
</template>
```

### Элементы

Элемент `items` — объект со свойствами:

- `label: string`
- `value: number`
- `valueLabel?: string` — текст вместо числа
- `class?: any`

### Максимум

Пропс `max` задаёт значение полной полосы. Без него берётся наибольшее из `items`.

### Цвет

Пропс `color` меняет цвет полос.

### Размер

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

## API

### Свойства

```ts
/**
 * Props for the BarList component
 */
interface BarListProps {
  /**
   * The element or component this component should render as.
   * @default 'ul'
   */
  as?: any;
  /**
   * The rows to compare.
   */
  items?: BarListItem[] | undefined;
  /**
   * The value of a full bar. Defaults to the largest value of `items`.
   */
  max?: number | undefined;
  /**
   * The unit shown after each value, when the item has no `valueLabel`.
   */
  unit?: string | undefined;
  /**
   * @default 'air-primary'
   */
  color?: "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot";
  /**
   * @default 'md'
   */
  size?: "md" | "sm" | "lg" | undefined;
  b24ui?: { root?: SlotClass; item?: SlotClass; label?: SlotClass; value?: SlotClass; track?: SlotClass; bar?: SlotClass; } | undefined;
}
```

### Слоты

```ts
/**
 * Slots for the BarList component
 */
interface BarListSlots {
  label(): any;
  value(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    barList: {
      slots: {
        root: 'flex min-w-0 flex-col',
        item: 'grid min-w-0 grid-cols-[minmax(0,1fr)_auto] items-baseline gap-x-3 gap-y-1',
        label: 'truncate text-(--ui-color-design-plain-content)',
        value: 'text-end font-(--ui-font-weight-medium) tabular-nums text-(--ui-color-design-plain-content)',
        track: 'col-span-2 block w-full overflow-hidden rounded-(--ui-border-radius-pill) bg-(--ui-color-base-5)',
        bar: 'block h-full rounded-(--ui-border-radius-pill) bg-(--b24ui-background) transition-[width] duration-200 ease-out motion-reduce:transition-none'
      },
      variants: {
        color: {
          'air-primary': {
            root: 'style-filled'
          },
          'air-primary-success': {
            root: 'style-filled-success'
          },
          'air-primary-alert': {
            root: 'style-filled-alert'
          },
          'air-primary-copilot': {
            root: 'style-filled-copilot'
          },
          'air-primary-warning': {
            root: 'style-filled-warning'
          }
        },
        size: {
          sm: {
            root: 'gap-2',
            label: 'text-(length:--ui-font-size-xs)',
            value: 'text-(length:--ui-font-size-xs)',
            track: 'h-[4px]'
          },
          md: {
            root: 'gap-3',
            label: 'text-(length:--ui-font-size-sm)',
            value: 'text-(length:--ui-font-size-sm)',
            track: 'h-[6px]'
          },
          lg: {
            root: 'gap-4',
            label: 'text-(length:--ui-font-size-md)',
            value: 'text-(length:--ui-font-size-md)',
            track: 'h-[8px]'
          }
        }
      },
      defaultVariants: {
        color: 'air-primary',
        size: 'md'
      }
    }
  }
})
```

## Sitemap

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