Перейти к содержанию

BarList New

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

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

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

  • Анна Иванова12 сделок
  • Борис Петров8 сделок
  • Вера Сидорова3 сделок
<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>
<script setup lang="ts">
import { ref } from 'vue'
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

Свойства

Пропс По умолчанию Тип
as'ul'any

The element or component this component should render as.

items BarListItem[]

The rows to compare.

max number

The value of a full bar. Defaults to the largest value of items.

unit string

The unit shown after each value, when the item has no valueLabel.

color'air-primary'"air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot"
size'md' "md" | "sm" | "lg"
b24ui { root?: SlotClass; item?: SlotClass; label?: SlotClass; value?: SlotClass; track?: SlotClass; bar?: SlotClass; }

Слоты

Слот Тип
label{ item: BarListItem; index: number; }
value{ item: BarListItem; index: number; }

Тема

Была ли страница полезна?