---
title: "TableWrapper"
description: "Обёртка для отображения HTML-таблицы."
canonical_url: "https://b24-ui.bx-shef.by/docs/components/table-wrapper"
---
# TableWrapper

> Обёртка для отображения HTML-таблицы.

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

TableWrapper — обёртка над HTML-таблицей, которая даёт гибкий контроль над её внешним видом.

Таблицу можно оформлять как угодно.

```vue [TableWrapperExample.vue]
<template>
  <B24TableWrapper class="overflow-x-auto w-full">
    | # | Компания | Стадия сделки | Сумма |
| --- | --- | --- | --- |
| 1 | Tech Innovators Inc. | Предложение отправлено | 50,000 |
| 2 | Global Solutions Ltd. | Переговоры | 120,000 |
| 3 | Future Enterprises | Договор подписан | 200,000 |
| 4 | Bright Ideas Co. | Первичный контакт | 15,000 |
| 5 | NextGen Technologies | Закрытие | 300,000 |
| Total: | 685,00 |
  </B24TableWrapper>
</template>
```

### Размер

Свойство `size` меняет размер таблицы.

```vue [TableWrapperSizeExample.vue]
<template>
  <B24TableWrapper
    class="overflow-x-auto w-full"
    size="xs"
  >
    | # | Компания | Стадия сделки | Сумма |
| --- | --- | --- | --- |
| 1 | Tech Innovators Inc. | Предложение отправлено | 50,000 |
| 2 | Global Solutions Ltd. | Переговоры | 120,000 |
| 3 | Future Enterprises | Договор подписан | 200,000 |
| 4 | Bright Ideas Co. | Первичный контакт | 15,000 |
| 5 | NextGen Technologies | Закрытие | 300,000 |
| Total: | 685,00 |
  </B24TableWrapper>
</template>
```

### Граница и фон

Свойство `bordered` показывает границу таблицы.

Фон задаётся отдельно через `class`. Например, белый фон: `class="bg-white"`.

Фон можно задать и с помощью компонента [Card](https://b24-ui.bx-shef.by/raw/docs/components/card.md).

```vue [TableWrapperBorderBackgroundExample.vue]
<template>
  <B24Card
    variant="outline-copilot"
    class="w-full"
    :b24ui="{ body: 'p-0 sm:px-0 sm:py-0' }"
  >
    <B24TableWrapper
      class="overflow-x-auto w-full"
      rounded
      :b24ui="{
        base: '[&>table>thead>tr]:border-(--ui-color-design-filled-copilot-stroke) [&>table>tbody>tr]:border-(--ui-color-design-tinted-a1-bg) [&>table>tfoot]:border-(--ui-color-design-filled-copilot-stroke)'
      }"
    >
      | # | Компания | Стадия сделки | Сумма |
| --- | --- | --- | --- |
| 1 | Tech Innovators Inc. | Предложение отправлено | 50,000 |
| 2 | Global Solutions Ltd. | Переговоры | 120,000 |
| 3 | Future Enterprises | Договор подписан | 200,000 |
| 4 | Bright Ideas Co. | Первичный контакт | 15,000 |
| 5 | NextGen Technologies | Закрытие | 300,000 |
| Total: | 685,00 |
    </B24TableWrapper>
  </B24Card>
</template>
```

### Скругление

Параметр `rounded` скругляет углы.

```vue [TableWrapperRoundedExample.vue]
<template>
  <B24TableWrapper
    class="overflow-x-auto w-full dark bg-(--ui-color-gray-90)"
    rounded
  >
    | # | Компания | Стадия сделки | Сумма |
| --- | --- | --- | --- |
| 1 | Tech Innovators Inc. | Предложение отправлено | 50,000 |
| 2 | Global Solutions Ltd. | Переговоры | 120,000 |
| 3 | Future Enterprises | Договор подписан | 200,000 |
| 4 | Bright Ideas Co. | Первичный контакт | 15,000 |
| 5 | NextGen Technologies | Закрытие | 300,000 |
| Total: | 685,00 |
  </B24TableWrapper>
</template>
```

### Зебра

Свойство `zebra` чередует цвета строк.

Чтобы выделить строки таблицы, используйте класс тега `tr`.

Чтобы выделять строку при наведении курсора, добавьте в класс тега `tr` что-нибудь вроде `hover:bg-red-500`.

```vue [TableWrapperZebraExample.vue]
<template>
  <B24TableWrapper
    class="overflow-x-auto w-full"
    zebra
  >
    | # | Компания | Стадия сделки | Сумма |
| --- | --- | --- | --- |
| 1 | Tech Innovators Inc. | Предложение отправлено | 50,000 |
| 2 | Global Solutions Ltd. | Переговоры | 120,000 |
| 3 | Future Enterprises | Договор подписан | 200,000 |
| 4 | Bright Ideas Co. | Первичный контакт | 15,000 |
| 5 | NextGen Technologies | Закрытие | 300,000 |
| Total: | 685,00 |
  </B24TableWrapper>
</template>
```

### Подсветка строки при наведении

Свойство `rowHover` автоматически подсвечивает строку при наведении.

```vue [TableWrapperHoverExample.vue]
<template>
  <B24TableWrapper
    class="overflow-x-auto w-full"
    row-hover
  >
    | # | Компания | Стадия сделки | Сумма |
| --- | --- | --- | --- |
| 1 | Tech Innovators Inc. | Предложение отправлено | 50,000 |
| 2 | Global Solutions Ltd. | Переговоры | 120,000 |
| 3 | Future Enterprises | Договор подписан | 200,000 |
| 4 | Bright Ideas Co. | Первичный контакт | 15,000 |
| 5 | NextGen Technologies | Закрытие | 300,000 |
| Total: | 685,00 |
  </B24TableWrapper>
</template>
```

### Закреплённые строки

Строки закрепляются свойством `pinRows`.

Закреплённую строку задайте тегом `<thead>...</thead>` или `<tfoot>...</tfoot>`.

```vue [TableWrapperPinRowsExample.vue]
<template>
  <B24TableWrapper
    class="overflow-x-auto w-full h-[400px]"
    size="xs"
    pin-rows
  >
    | A |
| --- |
| AlphaTech Solutions |
| Apex Innovations |
| AstroCore Systems |
| Atomix Enterprises |
| Aurora Dynamics |
| B |
| BlueWave Technologies |
| BrightPath Solutions |
| BoldFuture Inc. |
| BioNova Industries |
| BeaconWorks |
| C |
| CyberForge Ltd. |
| CloudHaven Systems |
| CrimsonLogic |
| Catalyst Innovations |
| D |
| DeltaCore Technologies |
| Dynamo Solutions |
| DataSphere Inc. |
| DreamForge Industries |
| E |
| Eclipse Systems |
| F |
| FusionWorks |
| G |
| GreenPulse Technologies |
| GlobeForge Solutions |
| GoldenAxis Inc. |
| GalacticCore |
| H |
| Hyperion Dynamics |
| HaloTech Industries |
| HorizonWorks |
| I |
| InfinityForge |
| Ironclad Solutions |
| M |
| MetaCore Systems |
| R |
| Radiant Innovations |
| RocketForge Ltd. |
| S |
| Skyline Technologies |
| SolarFlare Systems |
| StellarCore Inc. |
| SynapseWorks |
| Summit Dynamics |
| T |
| TechNova Solutions |
| TitanForge Industries |
| W |
| WaveFront Technologies |
| WhiteHaven Systems |
| WiseCore Inc. |
| WorldForge Solutions |
| X |
| Xenon Innovations |
| Z |
| ZenithCore Systems |
| ZephyrWorks |
  </B24TableWrapper>
</template>
```

### Закреплённые колонки

Свойство `pinCols` закрепляет колонки.

Колонки задайте тегом `<th>...</th>`.

```vue [TableWrapperPinColsExample.vue]
<template>
  <B24TableWrapper
    class="overflow-x-auto w-full h-[400px]"
    size="xs"
    pin-cols
    pin-rows
    row-hover
  >
    | Название сделки | Компания | Стадия сделки | Сумма | Ответственный | Дата начала | Заметки |
| --- | --- | --- | --- | --- | --- | --- |
| 1 | Обновление технологий | Tech Innovators Inc. | Предложение отправлено | 150,000 | John Doe | 15.01.2023 | Ожидаем обратную связь | 1 |
| 2 | План глобального расширения | Global Solutions Ltd. | Переговоры | 500,000 | Jane Smith | 10.02.2023 | Ключевое лицо, принимающее решение | 2 |
| 3 | Запуск нового продукта | Future Enterprises | Договор подписан | 300,000 | Michael Brown | 05.03.2023 | Идёт поставка | 3 |
| 4 | Маркетинговая кампания | Bright Ideas Co. | Первичный контакт | 75,000 | Emily Davis | 20.04.2023 | Бюджет утверждён | 4 |
| 5 | Сделка по IT-инфраструктуре | NextGen Technologies | Закрытие | 1,000,000 | David Wilson | 12.05.2023 | Уточняем детали | 5 |
| 6 | Внедрение HR-системы | People First Inc. | Предложение отправлено | 200,000 | Sophi Biles | 01.06.2023 | Ожидает согласования | 6 |
| 7 | Оптимизация логистики | Logistics Pro | Переговоры | 450,000 | Reid Semiras | 18.07.2023 | Обсуждаем условия | 7 |
| 8 | Программа обучения продажам | Global Sales Ltd. | Договор подписан | 120,000 | Alec Lethby | 22.08.2023 | Обучение назначено | 8 |
| 9 | Редизайн продукта | Innovate Corp. | Первичный контакт | 90,000 | Florida Garces | 05.09.2023 | Первые переговоры | 9 |
| 10 | Миграция в облако | Tech Solutions Inc. | Закрытие | 600,000 | Maribeth Popping | 10.10.2023 | Финальная проверка | 10 |
| 11 | Улучшение клиентской поддержки | Zemlak, Daniel and Leannon | Предложение отправлено | 85,000 | Hart Hagerty | 15.11.2023 | Ожидает утверждения | 11 |
| 12 | Финансовый аудит | Carroll Group | Переговоры | 250,000 | Brice Swyre | 01.12.2023 | Объём работ согласован | 12 |
| 13 | Ремонт офиса | Rowe-Schoen | Договор подписан | 180,000 | Marjy Ferencz | 10.01.2024 | Работа идёт | 13 |
| 14 | Усиление кибербезопасности | Wyman-Ledner | Первичный контакт | 300,000 | Yancy Tear | 05.02.2024 | Первичная оценка | 14 |
| 15 | Программа заботы о сотрудниках | Schuster-Schimmel | Закрытие | 95,000 | Meghann Durtnal | 12.03.2024 | Уточняем детали | 15 |
| 16 | Проект по аналитике данных | Wiza, Bins and Emard | Предложение отправлено | 220,000 | Irma Vasilik | 18.04.2024 | Ожидаем отзыв | 16 |
| 17 | Платформа электронной коммерции | O'Hara, Welch and Keebler | Переговоры | 700,000 | Sammy Seston | 22.05.2024 | Обсуждены ключевые условия | 17 |
| 18 | Интеграция AI | Turner-Kuhlman | Договор подписан | 1,200,000 | Lesya Tinham | 30.06.2024 | Внедрение началось | 18 |
| 19 | Оптимизация цепочки поставок | Kshlerin, Rogahn and Swaniawski | Первичный контакт | 400,000 | Aland Wilber | 15.07.2024 | Первые переговоры | 19 |
| 20 | Мероприятие по запуску продукта | Sauer LLC | Закрытие | 150,000 | Zaneta Tewkesbury | 20.08.2024 | Финальная подготовка | 20 |
| 21 | Разработка мобильного приложения | Hilpert Group | Предложение отправлено | 350,000 | Andy Tipple | 25.09.2024 | Ожидает согласования | 21 |
| 22 | Программа лояльности клиентов | Gutmann Inc | Переговоры | 120,000 | Sophi Biles | 10.10.2024 | Условия на рассмотрении | 22 |
| 23 | Внедрение ERP-системы | Gaylord, Pacocha and Baumbach | Договор подписан | 900,000 | Florida Garces | 15.11.2024 | Старт проекта | 23 |
| 24 | Кампания цифрового маркетинга | Deckow-Pouros | Первичный контакт | 200,000 | Maribeth Popping | 20.12.2024 | Первые переговоры | 24 |
| 25 | Автоматизация склада | Schiller, Cole and Hackett | Закрытие | 1,500,000 | Moritz Dryburgh | 05.01.2025 | Уточняем детали | 25 |
| Название сделки | Компания | Стадия сделки | Сумма | Ответственный | Дата начала | Заметки |
  </B24TableWrapper>
</template>
```

## API

### Пропсы

```ts
/**
 * Props for the TableWrapper component
 */
interface TableWrapperProps {
  /**
   * The element or component this component should render as.
   * @default 'div'
   */
  as?: any;
  /**
   * @default 'md'
   */
  size?: "md" | "xs" | "sm" | "lg" | undefined;
  /**
   * @default false
   */
  rounded?: boolean | undefined;
  /**
   * @default false
   */
  zebra?: boolean | undefined;
  /**
   * @default false
   */
  pinRows?: boolean | undefined;
  /**
   * @default false
   */
  pinCols?: boolean | undefined;
  /**
   * @default false
   */
  rowHover?: boolean | undefined;
  /**
   * @default false
   */
  bordered?: boolean | undefined;
  /**
   * @default true
   */
  scrollbarThin?: boolean | undefined;
  b24ui?: { base?: SlotClass; } | undefined;
}
```

## Тема

```ts [app.config.ts]
export default defineAppConfig({
  b24ui: {
    tableWrapper: {
      slots: {
        base: 'font-[family-name:var(--ui-font-family-primary)] [&>table]:text-(length:--ui-font-size-md)/(--ui-font-line-height-md) [&>table]:relative [&>table]:w-full [&>table]:text-start [&>table]:text-label [&>table>thead>tr>td]:align-middle [&>table>thead>tr>th]:align-middle [&>table>tbody>tr>td]:align-middle [&>table>tbody>tr>th]:align-middle [&>table>tfoot>tr>td]:align-middle [&>table>tfoot>tr>th]:align-middle [&>table>thead>tr>td]:whitespace-nowrap [&>table>thead>tr>td]:text-(length:--ui-font-size-md) [&>table>thead>tr>td]:font-(--ui-font-weight-normal) [&>table>thead>tr>th]:whitespace-nowrap [&>table>thead>tr>th]:text-(length:--ui-font-size-md) [&>table>thead>tr>th]:font-(--ui-font-weight-normal) [&>table>tbody>tr>th]:whitespace-nowrap [&>table>tbody>tr>th]:text-(length:--ui-font-size-md) [&>table>tbody>tr>th]:font-(--ui-font-weight-normal) [&>table>tfoot>tr>td]:whitespace-nowrap [&>table>tfoot>tr>td]:text-(length:--ui-font-size-md) [&>table>tfoot>tr>td]:font-(--ui-font-weight-normal) [&>table>tfoot>tr>th]:whitespace-nowrap [&>table>tfoot>tr>th]:text-(length:--ui-font-size-md) [&>table>tfoot>tr>th]:font-(--ui-font-weight-normal) [&>table>thead>tr]:border-(--ui-color-design-tinted-na-stroke) [&>table>tbody>tr]:border-(--ui-color-design-tinted-na-stroke) [&>table>tfoot]:border-(--ui-color-design-tinted-na-stroke) [&>table>thead>tr]:border-b [&>table>tbody>tr:not(:last-child)]:border-b [&>table>tfoot]:border-t'
      },
      variants: {
        size: {
          xs: '[&>table>thead>tr>td]:text-(length:--ui-font-size-xs)/(--ui-font-line-height-2xs) [&>table>thead>tr>td]:px-2 [&>table>thead>tr>td]:py-1 [&>table>thead>tr>th]:text-(length:--ui-font-size-xs)/(--ui-font-line-height-2xs) [&>table>thead>tr>th]:px-2 [&>table>thead>tr>th]:py-1 [&>table>tbody>tr>td]:text-(length:--ui-font-size-xs)/(--ui-font-line-height-2xs) [&>table>tbody>tr>td]:px-2 [&>table>tbody>tr>td]:py-1 [&>table>tbody>tr>th]:text-(length:--ui-font-size-xs)/(--ui-font-line-height-2xs) [&>table>tbody>tr>th]:px-2 [&>table>tbody>tr>th]:py-1 [&>table>tfoot>tr>td]:text-(length:--ui-font-size-xs)/(--ui-font-line-height-2xs) [&>table>tfoot>tr>td]:px-2 [&>table>tfoot>tr>td]:py-1 [&>table>tfoot>tr>th]:text-(length:--ui-font-size-xs)/(--ui-font-line-height-2xs) [&>table>tfoot>tr>th]:px-2 [&>table>tfoot>tr>th]:py-1',
          sm: '[&>table>thead>tr>td]:text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm) [&>table>thead>tr>td]:px-3 [&>table>thead>tr>td]:py-2 [&>table>thead>tr>th]:text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm) [&>table>thead>tr>th]:px-3 [&>table>thead>tr>th]:py-2 [&>table>tbody>tr>td]:text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm) [&>table>tbody>tr>td]:px-3 [&>table>tbody>tr>td]:py-2 [&>table>tbody>tr>th]:text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm) [&>table>tbody>tr>th]:px-3 [&>table>tbody>tr>th]:py-2 [&>table>tfoot>tr>td]:text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm) [&>table>tfoot>tr>td]:px-3 [&>table>tfoot>tr>td]:py-2 [&>table>tfoot>tr>th]:text-(length:--ui-font-size-sm)/(--ui-font-line-height-sm) [&>table>tfoot>tr>th]:px-3 [&>table>tfoot>tr>th]:py-2',
          md: '[&>table>thead>tr>td]:text-(length:--ui-font-size-md)/(--ui-font-line-height-md) [&>table>thead>tr>td]:px-4 [&>table>thead>tr>td]:py-3.5 [&>table>thead>tr>th]:text-(length:--ui-font-size-md)/(--ui-font-line-height-md) [&>table>thead>tr>th]:px-4 [&>table>thead>tr>th]:py-3.5 [&>table>tbody>tr>td]:text-(length:--ui-font-size-md)/(--ui-font-line-height-md) [&>table>tbody>tr>td]:px-4 [&>table>tbody>tr>td]:py-3.5 [&>table>tbody>tr>th]:text-(length:--ui-font-size-md)/(--ui-font-line-height-md) [&>table>tbody>tr>th]:px-4 [&>table>tbody>tr>th]:py-3.5 [&>table>tfoot>tr>td]:text-(length:--ui-font-size-md)/(--ui-font-line-height-md) [&>table>tfoot>tr>td]:px-4 [&>table>tfoot>tr>td]:py-3.5 [&>table>tfoot>tr>th]:text-(length:--ui-font-size-md)/(--ui-font-line-height-md) [&>table>tfoot>tr>th]:px-4 [&>table>tfoot>tr>th]:py-3.5',
          lg: '[&>table>thead>tr>td]:text-(length:--ui-font-size-lg)/(--ui-font-line-height-lg) [&>table>thead>tr>td]:px-5 [&>table>thead>tr>td]:py-4 [&>table>thead>tr>th]:text-(length:--ui-font-size-lg)/(--ui-font-line-height-lg) [&>table>thead>tr>th]:px-5 [&>table>thead>tr>th]:py-4 [&>table>tbody>tr>td]:text-(length:--ui-font-size-lg)/(--ui-font-line-height-lg) [&>table>tbody>tr>td]:px-5 [&>table>tbody>tr>td]:py-4 [&>table>tbody>tr>th]:text-(length:--ui-font-size-lg)/(--ui-font-line-height-lg) [&>table>tbody>tr>th]:px-5 [&>table>tbody>tr>th]:py-4 [&>table>tfoot>tr>td]:text-(length:--ui-font-size-lg)/(--ui-font-line-height-lg) [&>table>tfoot>tr>td]:px-5 [&>table>tfoot>tr>td]:py-4 [&>table>tfoot>tr>th]:text-(length:--ui-font-size-lg)/(--ui-font-line-height-lg) [&>table>tfoot>tr>th]:px-5 [&>table>tfoot>tr>th]:py-4'
        },
        rounded: {
          true: 'rounded-(--ui-border-radius-md)',
          false: ''
        },
        zebra: {
          true: '[&>table>tbody>tr]:even:bg-(--ui-color-bg-content-secondary) [&>table>tbody>tr]:even:[&>td]:bg-(--ui-color-bg-content-secondary) [&>table>tbody>tr]:even:[&>th]:bg-(--ui-color-bg-content-secondary) light:[&>table>tbody>tr]:even:bg-[#f6f8f9] light:[&>table>tbody>tr]:even:[&>td]:bg-[#f6f8f9] light:[&>table>tbody>tr]:even:[&>th]:bg-[#f6f8f9]'
        },
        pinRows: {
          true: '[&>table>thead>tr]:sticky [&>table>thead>tr]:top-0      [&>table>thead>tr]:z-1 [&>table>thead>tr]:bg-(--ui-color-bg-content-primary) [&>table>thead>tr>th]:backdrop-blur-sm [&>table>thead>tr]:shadow-bottom-sm [&>table>tfoot>tr]:sticky [&>table>tfoot>tr]:bottom-0   [&>table>tfoot>tr]:z-1 [&>table>tfoot>tr]:bg-(--ui-color-bg-content-primary) [&>table>tfoot>tr>th]:backdrop-blur-sm [&>table>tfoot>tr]:shadow-top-sm'
        },
        pinCols: {
          true: '[&>table>thead>tr>th]:sticky [&>table>thead>tr>th]:right-0 [&>table>thead>tr>th]:left-0 [&>table>thead>tr>th]:bg-(--ui-color-bg-content-primary) [&>table>thead>tr>th]:backdrop-blur-sm [&>table>tbody>tr>th]:sticky [&>table>tbody>tr>th]:right-0 [&>table>tbody>tr>th]:left-0 [&>table>tbody>tr>th]:bg-(--ui-color-bg-content-primary) [&>table>tbody>tr>th]:backdrop-blur-sm [&>table>tfoot>tr>th]:sticky [&>table>tfoot>tr>th]:right-0 [&>table>tfoot>tr>th]:left-0 [&>table>tfoot>tr>th]:bg-(--ui-color-bg-content-primary) [&>table>tfoot>tr>th]:backdrop-blur-sm'
        },
        rowHover: {
          true: '[&>table>tbody>tr]:hover:bg-(--ui-color-bg-content-secondary) [&>table>tbody>tr]:hover:[&>td]:bg-(--ui-color-bg-content-secondary) [&>table>tbody>tr]:hover:[&>th]:bg-(--ui-color-bg-content-secondary) light:[&>table>tbody>tr]:hover:bg-[#f6f8f9] light:[&>table>tbody>tr]:hover:[&>td]:bg-[#f6f8f9] light:[&>table>tbody>tr]:hover:[&>th]:bg-[#f6f8f9]'
        },
        bordered: {
          true: 'border border-(--ui-color-design-tinted-na-stroke)'
        },
        scrollbarThin: {
          true: 'scrollbar-thin'
        }
      },
      defaultVariants: {
        size: 'md',
        scrollbarThin: true
      }
    }
  }
})
```

## Sitemap

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