---
title: "PricingPlans"
description: "Список тарифов в адаптивной сетке."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/pricing-plans"
---
# PricingPlans

> Список тарифов в адаптивной сетке.

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

Компонент PricingPlans раскладывает тарифы [PricingPlan](https://b24-ui.bx-shef.by/raw/docs/components/pricing-plan.md) сеткой — из слота по умолчанию или из пропса `plans`.

```vue
<template>
  <B24PricingPlans>
    <B24PricingPlan
      v-for="(plan, index) in plans"
      :key="index"
      v-bind="plan"
    />
  </B24PricingPlans>
</template>
```

> [!TIP]
> Число колонок сетки считается по числу тарифов — и с пропсом `plans`, и со слотом по умолчанию.

### Тарифы

Пропс `plans` — массив объектов с пропсами [PricingPlan](https://b24-ui.bx-shef.by/raw/docs/components/pricing-plan.md#props).

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

const plans = ref<PricingPlanProps[]>([
  {
    title: "Базовый",
    description: "Для небольшой команды.",
    price: "249 BYN",
    features: [
      "До 5 сотрудников",
      "Задачи и CRM"
    ],
    button: {
      label: "Купить"
    }
  },
  {
    title: "Стандартный",
    description: "Для растущего отдела продаж.",
    price: "499 BYN",
    features: [
      "До 50 сотрудников",
      "Всё из тарифа «Базовый»"
    ],
    button: {
      label: "Купить"
    }
  },
  {
    title: "Профессиональный",
    description: "Для компании с несколькими отделами.",
    price: "999 BYN",
    features: [
      "До 100 сотрудников",
      "Всё из тарифа «Стандартный»"
    ],
    button: {
      label: "Купить"
    }
  }
])
</script>

<template>
  <B24PricingPlans :plans="plans" />
</template>
```

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

Пропс `orientation` ставит тарифы в ряд (`horizontal`) или друг под другом (`vertical`). По умолчанию `horizontal`.

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

const plans = ref<PricingPlanProps[]>([
  {
    title: "Базовый",
    description: "Для небольшой команды.",
    price: "249 BYN",
    features: [
      "До 5 сотрудников",
      "Задачи и CRM"
    ],
    button: {
      label: "Купить"
    }
  },
  {
    title: "Стандартный",
    description: "Для растущего отдела продаж.",
    price: "499 BYN",
    features: [
      "До 50 сотрудников",
      "Всё из тарифа «Базовый»"
    ],
    button: {
      label: "Купить"
    }
  },
  {
    title: "Профессиональный",
    description: "Для компании с несколькими отделами.",
    price: "999 BYN",
    features: [
      "До 100 сотрудников",
      "Всё из тарифа «Стандартный»"
    ],
    button: {
      label: "Купить"
    }
  }
])
</script>

<template>
  <B24PricingPlans orientation="vertical" :plans="plans" />
</template>
```

> [!TIP]
> С пропсом `plans` ориентация самих тарифов обратная: в ряду (`horizontal`) каждый тариф вертикальный, в столбце (`vertical`) — горизонтальный.

### Без зазора

Пропс `compact` убирает зазор между тарифами, когда один из них увеличен.

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

const plans = ref<PricingPlanProps[]>([
  {
    title: "Базовый",
    description: "Для небольшой команды.",
    price: "249 BYN",
    features: [
      "До 5 сотрудников",
      "Задачи и CRM"
    ],
    button: {
      label: "Купить"
    }
  },
  {
    title: "Стандартный",
    description: "Для растущего отдела продаж.",
    price: "499 BYN",
    scale: true,
    features: [
      "До 50 сотрудников",
      "Всё из тарифа «Базовый»"
    ],
    button: {
      label: "Купить"
    }
  },
  {
    title: "Профессиональный",
    description: "Для компании с несколькими отделами.",
    price: "999 BYN",
    features: [
      "До 100 сотрудников",
      "Всё из тарифа «Стандартный»"
    ],
    button: {
      label: "Купить"
    }
  }
])
</script>

<template>
  <B24PricingPlans compact :plans="plans" />
</template>
```

### Увеличение

Пропс `scale` расширяет зазор между тарифами, чтобы увеличенный тариф не наезжал на соседние.

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

const plans = ref<PricingPlanProps[]>([
  {
    title: "Базовый",
    description: "Для небольшой команды.",
    price: "249 BYN",
    features: [
      "До 5 сотрудников",
      "Задачи и CRM"
    ],
    button: {
      label: "Купить"
    }
  },
  {
    title: "Стандартный",
    description: "Для растущего отдела продаж.",
    price: "499 BYN",
    scale: true,
    features: [
      "До 50 сотрудников",
      "Всё из тарифа «Базовый»"
    ],
    button: {
      label: "Купить"
    }
  },
  {
    title: "Профессиональный",
    description: "Для компании с несколькими отделами.",
    price: "999 BYN",
    features: [
      "До 100 сотрудников",
      "Всё из тарифа «Стандартный»"
    ],
    button: {
      label: "Купить"
    }
  }
])
</script>

<template>
  <B24PricingPlans scale :plans="plans" />
</template>
```

## Примеры

### На странице

Страница с ценами из PricingPlans:

```vue [pages/pricing/index.vue]
<script setup lang="ts">
const { data: plans } = await useAsyncData('plans', () => queryCollection('plans').all())
</script>

<template>
  <B24Page>
    <B24PageHero title="Цены" />

    <B24PageBody>
      <B24Container>
        <B24PricingPlans :plans="plans" />
      </B24Container>
    </B24PageBody>
  </B24Page>
</template>
```

> [!NOTE]
> Здесь `plans` загружает `queryCollection` модуля `@nuxt/content`; подойдёт любой источник данных.

## API

### Пропсы

```ts
/**
 * Props for the PricingPlans component
 */
interface PricingPlansProps {
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  plans?: PricingPlanProps[] | undefined;
  /**
   * The orientation of the pricing plans.
   * @default 'horizontal'
   */
  orientation?: "horizontal" | "vertical" | undefined;
  /**
   * When `true`, the plans will be displayed without gap.
   * @default false
   */
  compact?: boolean | undefined;
  /**
   * When `true`, the plans will be displayed with a larger gap.
   * Useful when one plan is scaled. Doesn't work with `compact`.
   * @default false
   */
  scale?: boolean | undefined;
  b24ui?: { base?: any; } | undefined;
}
```

### Слоты

```ts
/**
 * Slots for the PricingPlans component
 */
interface PricingPlansSlots {
  badge(): any;
  title(): any;
  description(): any;
  price(): any;
  discount(): any;
  billing(): any;
  features(): any;
  button(): any;
  header(): any;
  body(): any;
  footer(): any;
  tagline(): any;
  terms(): any;
  default(): any;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    pricingPlans: {
      base: 'flex flex-col gap-y-8',
      variants: {
        orientation: {
          horizontal: 'lg:grid lg:grid-cols-[repeat(var(--count),minmax(0,1fr))]',
          vertical: ''
        },
        compact: {
          false: 'gap-x-8'
        },
        scale: {
          true: ''
        }
      },
      compoundVariants: [
        {
          compact: false,
          scale: true,
          class: 'lg:gap-x-13'
        }
      ]
    }
  }
})
```

## Sitemap

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