---
title: "PricingTable"
description: "Таблица тарифов со сравнением возможностей: таблица на широком экране, карточки на узком."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/pricing-table"
---
# PricingTable

> Таблица тарифов со сравнением возможностей: таблица на широком экране, карточки на узком.

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

Компонент PricingTable сравнивает тарифы по возможностям. На широком экране это таблица — тарифы в шапке, возможности по разделам в строках; на узком — карточки тарифов друг под другом.

```vue
<template>
  <b24-pricing-table :sections=[{"title":"Возможности","features":[{"title":"Сотрудников","tiers":{"basic":"5","standard":"50","enterprise":"Без ограничений"}},{"title":"Задачи и проекты","tiers":{"basic":true,"standard":true,"enterprise":true}},{"title":"CRM и воронки продаж","tiers":{"basic":true,"standard":true,"enterprise":true}},{"title":"Хранилище","tiers":{"basic":"5 ГБ","standard":"100 ГБ","enterprise":"3 ТБ"}},{"title":"Поддержка","tiers":{"basic":"Почта","standard":"Приоритетная","enterprise":"Круглосуточно"}}]},{"title":"Безопасность","features":[{"title":"Единый вход (SSO)","tiers":{"basic":false,"standard":true,"enterprise":true}},{"title":"Журнал действий","tiers":{"basic":false,"standard":true,"enterprise":true}},{"title":"Свой сервер","tiers":{"basic":false,"standard":false,"enterprise":true}}]}] :tiers=[{"id":"basic","title":"Базовый","description":"Для небольшой команды.","price":"249 BYN","billingCycle":"/мес.","billingPeriod":"при оплате за год","badge":"Популярный","button":{"label":"Купить","color":"air-secondary-accent"}},{"id":"standard","title":"Стандартный","description":"Для растущего отдела продаж.","price":"499 BYN","billingCycle":"/мес.","billingPeriod":"при оплате за год","button":{"label":"Купить"},"highlight":true},{"id":"enterprise","title":"Энтерпрайз","description":"Для крупной компании.","price":"По запросу","button":{"label":"Связаться с отделом продаж","color":"air-tertiary"}}] />
</template>
```

### Тарифы

Пропс `tiers` — массив объектов, по одному на тариф. Поля тарифа:

- `id: string` — код тарифа, обязателен
- `title?: string` — название
- `description?: string` — короткое пояснение
- `price?: string` — цена (например, «99 BYN», «Бесплатно»)
- `discount?: string` — цена со скидкой; `price` тогда показывается зачёркнутой (например, «79 BYN»)
- `billingCycle?: string` — за какой срок цена (например, «/мес.», «/место/мес.»)
- `billingPeriod?: string` — как часто платят (например, «при оплате за год»)
- `badge?: string | BadgeProps` — бейдж рядом с названием, по умолчанию `{ color: 'air-secondary' }`
- `button?: ButtonProps` — кнопка, по умолчанию `{ size: 'lg', block: true, color: 'air-primary' }`
- `highlight?: boolean` — выделить тариф как рекомендуемый

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

const tiers = ref<PricingTableTier[]>([
  {
    id: "basic",
    title: "Базовый",
    description: "Для небольшой команды.",
    price: "249 BYN",
    billingCycle: "/мес.",
    billingPeriod: "при оплате за год",
    badge: "Популярный",
    button: {
      label: "Купить",
      color: "air-secondary-accent"
    }
  },
  {
    id: "standard",
    title: "Стандартный",
    description: "Для растущего отдела продаж.",
    price: "499 BYN",
    billingCycle: "/мес.",
    billingPeriod: "при оплате за год",
    button: {
      label: "Купить"
    },
    highlight: true
  },
  {
    id: "enterprise",
    title: "Энтерпрайз",
    description: "Для крупной компании.",
    price: "По запросу",
    button: {
      label: "Связаться с отделом продаж",
      color: "air-tertiary"
    }
  }
])
</script>

<template>
  <B24PricingTable :tiers="tiers" />
</template>
```

### Разделы

Пропс `sections` группирует возможности по разделам. Поля раздела:

- `title: string` — заголовок раздела
- `features: PricingTableSectionFeature[]` — возможности и их наличие в каждом тарифе:

 - у возможности есть `title` и объект `tiers`: код тарифа → значение
 - `true` / `false` показываются значками «есть» и «нет»
 - строка выводится текстом (например, «Без ограничений», «До 5 сотрудников»)
 - число выводится как есть (например, 10, 100)

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

const tiers = ref<PricingTableTier[]>([
  {
    id: "basic",
    title: "Базовый",
    price: "249 BYN",
    description: "Для небольшой команды.",
    billingCycle: "/мес.",
    button: {
      label: "Купить",
      color: "air-secondary-accent"
    }
  },
  {
    id: "standard",
    title: "Стандартный",
    price: "499 BYN",
    description: "Для растущего отдела продаж.",
    billingCycle: "/мес.",
    button: {
      label: "Купить"
    }
  },
  {
    id: "enterprise",
    title: "Энтерпрайз",
    price: "По запросу",
    description: "Для крупной компании.",
    button: {
      label: "Связаться с отделом продаж",
      color: "air-tertiary"
    }
  }
])
const sections = ref<PricingTableSection[]>([
  {
    title: "Возможности",
    features: [
      {
        title: "Сотрудников",
        tiers: {
          basic: "5",
          standard: "50",
          enterprise: "Без ограничений"
        }
      },
      {
        title: "CRM",
        tiers: {
          basic: true,
          standard: true,
          enterprise: true
        }
      }
    ]
  },
  {
    title: "Безопасность",
    features: [
      {
        title: "Единый вход (SSO)",
        tiers: {
          basic: false,
          standard: true,
          enterprise: true
        }
      }
    ]
  }
])
</script>

<template>
  <B24PricingTable :tiers="tiers" :sections="sections" />
</template>
```

## Примеры

### Слоты

Слоты меняют вид любой части таблицы: общие — для всех тарифов, разделов и возможностей, именные — для одного по его коду.

```vue [PricingTableSlotsExample.vue]
<script setup lang="ts">
const tiers = [
  {
    id: 'basic',
    title: 'Базовый',
    price: '249 BYN',
    description: 'Для небольшой команды.',
    billingCycle: '/мес.',
    button: { label: 'Купить', color: 'air-secondary-accent' as const }
  },
  {
    id: 'standard',
    title: 'Стандартный',
    price: '499 BYN',
    description: 'Для растущего отдела продаж.',
    billingCycle: '/мес.',
    button: { label: 'Купить' },
    highlight: true
  },
  {
    id: 'enterprise',
    title: 'Энтерпрайз',
    price: 'По запросу',
    description: 'Для крупной компании.',
    button: { label: 'Связаться с отделом продаж', color: 'air-tertiary' as const }
  }
]

const sections = [
  {
    id: 'features',
    title: 'Возможности',
    features: [
      {
        id: 'users',
        title: 'Сотрудников',
        tiers: { basic: '5', standard: '50', enterprise: 'Без ограничений' }
      },
      {
        id: 'crm',
        title: 'CRM',
        tiers: { basic: true, standard: true, enterprise: true }
      }
    ]
  },
  {
    id: 'security',
    title: 'Безопасность',
    features: [
      {
        id: 'sso',
        title: 'Единый вход (SSO)',
        tiers: { basic: false, standard: true, enterprise: true }
      }
    ]
  }
]
</script>

<template>
  <B24PricingTable :tiers="tiers" :sections="sections">
    <!-- Название одного тарифа -->
    <template #standard-title="{ tier }">
      <div class="flex items-center gap-2">
        <B24Icon name="i-bx24-main-crown-1" class="size-4 text-(--ui-color-accent-main-warning)" />
        {{ tier.title }}
      </div>
    </template>

    <!-- Заголовок одного раздела -->
    <template #section-security-title="{ section }">
      <div class="flex items-center gap-2">
        <B24Icon name="i-bx24-main-shield-2-checked" class="size-4 text-(--ui-color-accent-main-success)" />
        <span class="font-(--ui-font-weight-semi-bold) text-(--ui-color-accent-main-success)">{{ section.title }}</span>
      </div>
    </template>

    <!-- Значение одной возможности -->
    <template #feature-users-value="{ feature, tier }">
      <template v-if="feature.tiers?.[tier.id]">
        <B24Badge :label="String(feature.tiers[tier.id])" color="air-secondary" />
      </template>
      <B24Icon v-else name="i-bx24-outline-cross-m" class="size-4 text-(--ui-color-design-plain-na-content-secondary)" />
    </template>
  </B24PricingTable>
</template>
```

Виды слотов:

| Вид | Шаблон | Что меняет | Пример |
| --- | --- | --- | --- |
| **Тариф** | `#{id-тарифа}-{часть}` | одну часть одного тарифа | `#standard-title`, `#basic-price` |
| **Раздел** | `#section-{id\|заголовок}-title` | заголовок одного раздела | `#section-features-title` |
| **Возможность** | `#feature-{id\|заголовок}-{title\|value}` | одну возможность | `#feature-users-title` |
| **Общие** | `#tier-title`, `#section-title` и другие | все тарифы, разделы или возможности | `#feature-value` |

> [!WARNING]
> Без `id` имя слота строится из заголовка: латинские буквы и цифры остаются, пробелы становятся дефисами («Premium Features!» → `#section-premium-features-title`). Кириллица в имя не попадает, поэтому разделам и возможностям с русскими заголовками задавайте `id`.

## API

### Пропсы

```ts
/**
 * Props for the PricingTable component
 */
interface PricingTableProps {
  /**
   * The pricing tiers to display in the table.
   * Each tier represents a pricing plan with its own title, description, price, and features.
   */
  tiers: T[];
  /**
   * The sections of features to display in the table.
   * Each section contains a title and a list of features with their availability in each tier.
   */
  sections: PricingTableSection<T>[];
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  /**
   * The caption to display above the table.
   * @default t('pricingTable.caption')
   */
  caption?: string | undefined;
  b24ui?: { root?: SlotClass; table?: SlotClass; list?: SlotClass; item?: SlotClass; caption?: SlotClass; thead?: SlotClass; tbody?: SlotClass; tr?: SlotClass; th?: SlotClass; td?: SlotClass; tier?: SlotClass; tierWrapper?: SlotClass; tierTitleWrapper?: SlotClass; tierTitle?: SlotClass; tierDescription?: SlotClass; tierBadge?: SlotClass; tierPriceWrapper?: SlotClass; tierPrice?: SlotClass; tierDiscount?: SlotClass; tierBilling?: SlotClass; tierBillingPeriod?: SlotClass; tierBillingCycle?: SlotClass; tierButton?: SlotClass; tierFeatureIcon?: SlotClass; section?: SlotClass; sectionTitle?: SlotClass; feature?: SlotClass; featureTitle?: SlotClass; featureValue?: SlotClass; } | undefined;
}
```

### Слоты

```ts
/**
 * Slots for the PricingTable component
 */
interface PricingTableSlots {
  caption(): any;
  tier(): any;
  tier-title(): any;
  tier-description(): any;
  tier-badge(): any;
  tier-button(): any;
  tier-billing(): any;
  tier-discount(): any;
  tier-price(): any;
  section-title(): any;
  feature-title(): any;
  feature-value(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    pricingTable: {
      slots: {
        root: 'w-full relative',
        table: 'w-full table-fixed border-separate border-spacing-x-0 hidden md:table h-fit',
        list: 'md:hidden flex flex-col gap-6 w-full',
        item: 'p-6 flex flex-col border border-(--ui-color-divider-default) rounded-lg',
        caption: 'sr-only',
        thead: '',
        tbody: '',
        tr: '',
        th: 'py-4 font-(--ui-font-weight-normal) text-start border-b border-(--ui-color-divider-default)',
        td: 'px-6 py-4 text-center border-b border-(--ui-color-divider-default)',
        tier: 'p-6 text-start font-(--ui-font-weight-normal) align-top h-full',
        tierWrapper: 'flex flex-col md:h-full',
        tierTitleWrapper: 'flex items-center gap-3',
        tierTitle: 'text-(length:--ui-font-size-2xl) font-(--ui-font-weight-semi-bold) text-(--ui-color-base-1)',
        tierDescription: 'text-(length:--ui-font-size-md) font-(--ui-font-weight-normal) text-(--ui-color-design-plain-na-content-secondary) mt-1',
        tierBadge: 'truncate',
        tierPriceWrapper: 'flex items-center gap-1 mt-4',
        tierPrice: 'text-(--ui-color-base-1) text-5xl sm:text-6xl font-(--ui-font-weight-semi-bold)',
        tierDiscount: 'text-(--ui-color-design-plain-na-content-secondary) line-through text-(length:--ui-font-size-3xl) sm:text-(length:--ui-font-size-4xl)',
        tierBilling: 'flex flex-col justify-between min-w-0',
        tierBillingPeriod: 'text-(--ui-color-design-plain-na-content) truncate text-(length:--ui-font-size-xs) font-(--ui-font-weight-medium)',
        tierBillingCycle: 'text-(--ui-color-design-plain-na-content-secondary) truncate text-(length:--ui-font-size-xs) font-(--ui-font-weight-medium)',
        tierButton: 'mt-6 md:mt-auto md:pt-6',
        tierFeatureIcon: 'size-5 shrink-0',
        section: 'mt-6 flex flex-col gap-2',
        sectionTitle: 'font-(--ui-font-weight-semi-bold) text-(length:--ui-font-size-md) text-(--ui-color-base-1)',
        feature: 'flex items-center justify-between gap-1',
        featureTitle: 'text-(length:--ui-font-size-md) text-(--ui-color-base-1)',
        featureValue: 'text-(length:--ui-font-size-md) text-(--ui-color-design-plain-na-content-secondary) flex justify-center min-w-5'
      },
      variants: {
        section: {
          true: {
            tr: '*:pt-8'
          }
        },
        active: {
          true: {
            tierFeatureIcon: 'text-(--ui-color-accent-main-primary)'
          }
        },
        highlight: {
          true: {
            tier: 'bg-(--ui-color-bg-content-secondary) border-x border-t border-(--ui-color-divider-default) rounded-t-lg',
            td: 'bg-(--ui-color-bg-content-secondary) border-x border-(--ui-color-divider-default)',
            item: 'bg-(--ui-color-bg-content-secondary)'
          }
        }
      }
    }
  }
})
```

## Sitemap

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