---
title: "ProgressGroup"
description: "Один индикатор выполнения, который несёт сразу несколько значений, каждое в виде отдельного цветного сегмента."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/progress-group"
---
# ProgressGroup

> Один индикатор выполнения, который несёт сразу несколько значений, каждое в виде отдельного цветного сегмента.

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

ProgressGroup показывает несколько значений как сегменты одного индикатора выполнения.

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

const items = ref<ProgressGroupItem[]>([
  {
    label: 'Система',
    value: 24,
    color: 'air-secondary'
  },
  {
    label: 'Приложения',
    value: 8,
    color: 'air-primary-alert'
  },
  {
    label: 'Документы',
    value: 12,
    color: 'air-primary-warning'
  },
  {
    label: 'Мультимедиа',
    value: 42,
    color: 'air-primary-success'
  }
])
</script>

<template>
  <B24ProgressGroup :max="128" :items="items" class="w-96" />
</template>
```

### Элементы

Пропс `items` — массив объектов со свойствами:

- `label?: string`
- `icon?: IconComponent`
- `value?: number`
- `color?: "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-primary-warning" | "air-secondary"`
- `slot?: string`
- `class?: any`
- `b24ui?: { segment?: ClassNameValue, indicator?: ClassNameValue, item?: ClassNameValue, itemLeadingIcon?: ClassNameValue, itemLeadingDot?: ClassNameValue, itemLabel?: ClassNameValue, itemTrailing?: ClassNameValue }`

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

const items = ref<ProgressGroupItem[]>([
  {
    label: 'Вычисления',
    value: 42,
    color: 'air-primary'
  },
  {
    label: 'Хранилище',
    value: 18,
    color: 'air-secondary'
  },
  {
    label: 'Пропускная способность',
    value: 9,
    color: 'air-primary-warning'
  }
])
</script>

<template>
  <B24ProgressGroup :items="items" class="w-96" />
</template>
```

> [!NOTE]
> Элементы без `icon` получают в списке цветную точку.

### Максимум

Пропс `max` задаёт значение, которое составляют все элементы вместе. По умолчанию `100`.

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

const items = ref<ProgressGroupItem[]>([
  {
    label: 'Система',
    value: 24
  },
  {
    label: 'Приложения',
    value: 8
  }
])
</script>

<template>
  <B24ProgressGroup :max="128" :items="items" class="w-96" />
</template>
```

> [!NOTE]
> Если `max` не положительное число, используется `100`, и сегменты сохраняют пропорции, а не схлопываются.

### Статус

Пропс `status` показывает суммарное значение прогресса.

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

const items = ref<ProgressGroupItem[]>([
  {
    label: 'Система',
    value: 24,
    color: 'air-secondary'
  },
  {
    label: 'Приложения',
    value: 8,
    color: 'air-primary-alert'
  }
])
</script>

<template>
  <B24ProgressGroup :max="128" status :items="items" class="w-96" />
</template>
```

> [!TIP]
> Статус следует за концом полосы; чтобы растянуть его на всю ширину, используйте `:b24ui="{ status: 'w-full' }"`.

### Цвет

Пропс `color` задаёт цвет, который берут элементы без своего цвета.

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

const items = ref<ProgressGroupItem[]>([
  {
    label: 'Система',
    value: 24
  },
  {
    label: 'Приложения',
    value: 8
  }
])
</script>

<template>
  <B24ProgressGroup color="air-secondary" :max="128" :items="items" class="w-96" />
</template>
```

### Размер

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

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

const items = ref<ProgressGroupItem[]>([
  {
    label: 'Система',
    value: 24
  },
  {
    label: 'Приложения',
    value: 8
  }
])
</script>

<template>
  <B24ProgressGroup size="lg" :max="128" :items="items" class="w-96" />
</template>
```

### Ориентация

Пропс `orientation` меняет направление полосы. По умолчанию `horizontal`.

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

const items = ref<ProgressGroupItem[]>([
  {
    label: 'Система',
    value: 24
  },
  {
    label: 'Приложения',
    value: 8
  }
])
</script>

<template>
  <B24ProgressGroup orientation="vertical" :max="128" :items="items" class="h-96" />
</template>
```

## Примеры

### Со слотом status

Слот `status` заменяет суммарное значение вашим содержимым.

```vue [ProgressGroupStatusExample.vue]
<script setup lang="ts">
import type { ProgressGroupItem } from '@bxshefby/b24ui-nuxt'
import SettingsIcon from '@bitrix24/b24icons-vue/main/SettingsIcon'
import AppsIcon from '@bitrix24/b24icons-vue/outline/AppsIcon'
import FileIcon from '@bitrix24/b24icons-vue/main/FileIcon'
import PlayCircleIcon from '@bitrix24/b24icons-vue/main/PlayCircleIcon'

const max = 128

const items: ProgressGroupItem[] = [
  { label: 'Системная', value: 24, color: 'air-secondary', icon: SettingsIcon },
  { label: 'Приложения', value: 8, color: 'air-primary-alert', icon: AppsIcon },
  { label: 'Документы', value: 12, color: 'air-primary-warning', icon: FileIcon },
  { label: 'Мультимедиа', value: 42, color: 'air-primary-success', icon: PlayCircleIcon }
]

const used = items.reduce((total, item) => total + (item.value ?? 0), 0)
</script>

<template>
  <B24ProgressGroup :items="items" :max="max" status class="w-96" :b24ui="{ status: 'w-full justify-between' }">
    <template #status>
      <p>{{ used }}GB used</p>
      <p class="text-description">
        {{ max - used }}GB remaining
      </p>
    </template>
  </B24ProgressGroup>
</template>
```

### Со слотами элементов

Слоты `item-label` и `item-trailing` меняют то, что легенда показывает для каждого элемента.

```vue [ProgressGroupItemExample.vue]
<script setup lang="ts">
import type { ProgressGroupItem } from '@bxshefby/b24ui-nuxt'

const items: ProgressGroupItem[] = [
  { label: 'Системная', value: 24, color: 'air-secondary' },
  { label: 'Приложения', value: 8, color: 'air-primary-alert' },
  { label: 'Документы', value: 12, color: 'air-primary-warning' },
  { label: 'Мультимедиа', value: 42, color: 'air-primary-success' }
]
</script>

<template>
  <B24ProgressGroup :items="items" :max="128" class="w-96">
    <template #item-label="{ item }">
      <span class="font-(--ui-font-weight-medium)">{{ item.label }}</span>
    </template>

    <template #item-trailing="{ item }">
      {{ item.value }}GB
    </template>
  </B24ProgressGroup>
</template>
```

## API

### Пропсы

```ts
/**
 * Props for the ProgressGroup component
 */
interface ProgressGroupProps {
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  items?: T[] | undefined;
  /**
   * The value all items add up to, used to compute each segment's share of the track.
   * @default 100
   */
  max?: number | undefined;
  /**
   * Display the summed progress value.
   */
  status?: boolean | undefined;
  /**
   * @default 'md'
   */
  size?: "xs" | "sm" | "md" | "lg" | undefined;
  /**
   * @default 'air-primary'
   */
  color?: "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot" | "air-secondary";
  /**
   * The orientation of the progress bar.
   * @default 'horizontal'
   */
  orientation?: "horizontal" | "vertical" | undefined;
  b24ui?: { root?: SlotClass; base?: SlotClass; segment?: SlotClass; indicator?: SlotClass; status?: SlotClass; list?: SlotClass; item?: SlotClass; itemLeadingIcon?: SlotClass; itemLeadingDot?: SlotClass; itemLabel?: SlotClass; itemTrailing?: SlotClass; } | undefined;
}
```

### Слоты

```ts
/**
 * Slots for the ProgressGroup component
 */
interface ProgressGroupSlots {
  status(): any;
  item(): any;
  item-leading(): any;
  item-label(): any;
  item-trailing(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    progressGroup: {
      slots: {
        root: 'gap-2',
        base: 'flex overflow-hidden rounded-(--ui-border-radius-pill) bg-(--ui-color-base-5)',
        segment: 'duration-200 ease-out motion-reduce:transition-none',
        indicator: 'size-full bg-(--b24ui-background)',
        status: 'flex justify-end text-legend duration-200 ease-out motion-reduce:transition-none',
        list: 'flex flex-col gap-1',
        item: 'flex items-center gap-1.5 min-w-0',
        itemLeadingIcon: 'shrink-0',
        itemLeadingDot: 'shrink-0 rounded-(--ui-border-radius-pill)',
        itemLabel: 'truncate text-label',
        itemTrailing: 'ms-auto shrink-0 text-legend'
      },
      variants: {
        color: {
          'air-primary': {
            segment: 'style-filled',
            itemLeadingIcon: 'style-filled text-(--b24ui-background)',
            itemLeadingDot: 'style-filled bg-(--b24ui-background)'
          },
          'air-primary-success': {
            segment: 'style-filled-success',
            itemLeadingIcon: 'style-filled-success text-(--b24ui-background)',
            itemLeadingDot: 'style-filled-success bg-(--b24ui-background)'
          },
          'air-primary-alert': {
            segment: 'style-filled-alert',
            itemLeadingIcon: 'style-filled-alert text-(--b24ui-background)',
            itemLeadingDot: 'style-filled-alert bg-(--b24ui-background)'
          },
          'air-primary-copilot': {
            segment: 'style-filled-copilot',
            itemLeadingIcon: 'style-filled-copilot text-(--b24ui-background)',
            itemLeadingDot: 'style-filled-copilot bg-(--b24ui-background)'
          },
          'air-primary-warning': {
            segment: 'style-filled-warning',
            itemLeadingIcon: 'style-filled-warning text-(--b24ui-background)',
            itemLeadingDot: 'style-filled-warning bg-(--b24ui-background)'
          },
          'air-secondary': {
            segment: 'style-tinted',
            itemLeadingIcon: 'style-tinted text-(--b24ui-background)',
            itemLeadingDot: 'style-tinted bg-(--b24ui-background)'
          }
        },
        size: {
          xs: {
            status: 'text-(length:--ui-font-size-xs)/(--ui-font-line-height-sm)',
            list: 'text-(length:--ui-font-size-xs)/(--ui-font-line-height-sm)',
            itemLeadingIcon: 'size-3',
            itemLeadingDot: 'size-1.5'
          },
          sm: {
            status: 'text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm)',
            list: 'text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm)',
            itemLeadingIcon: 'size-4',
            itemLeadingDot: 'size-2'
          },
          md: {
            status: 'text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm)',
            list: 'text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm)',
            itemLeadingIcon: 'size-4',
            itemLeadingDot: 'size-2'
          },
          lg: {
            status: 'text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm)',
            list: 'text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm)',
            itemLeadingIcon: 'size-5',
            itemLeadingDot: 'size-2.5'
          }
        },
        orientation: {
          horizontal: {
            root: 'w-full flex flex-col',
            base: 'w-full flex-row',
            status: 'flex-row w-(--percent) transition-[width]'
          },
          vertical: {
            root: 'h-full flex flex-row-reverse',
            base: 'h-full flex-col',
            status: 'flex-col min-w-[32px] h-(--percent) transition-[height]'
          }
        }
      },
      compoundVariants: [
        {
          orientation: 'horizontal',
          size: 'xs',
          class: {
            base: 'h-[2px]'
          }
        },
        {
          orientation: 'horizontal',
          size: 'sm',
          class: {
            base: 'h-[4px]'
          }
        },
        {
          orientation: 'horizontal',
          size: 'md',
          class: {
            base: 'h-2'
          }
        },
        {
          orientation: 'horizontal',
          size: 'lg',
          class: {
            base: 'h-[12px]'
          }
        },
        {
          orientation: 'vertical',
          size: 'xs',
          class: {
            base: 'w-[2px]'
          }
        },
        {
          orientation: 'vertical',
          size: 'sm',
          class: {
            base: 'w-[4px]'
          }
        },
        {
          orientation: 'vertical',
          size: 'md',
          class: {
            base: 'w-2'
          }
        },
        {
          orientation: 'vertical',
          size: 'lg',
          class: {
            base: 'w-[12px]'
          }
        }
      ],
      defaultVariants: {
        color: 'air-primary',
        size: 'md'
      }
    }
  }
})
```

## История изменений

<component-changelog>

</component-changelog>

## Sitemap

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