<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-table-body/ in the magma monorepo (usage/*.md and the
  component's JSDoc). Regenerated on every stencil build (scripts/component-docs.ts).
-->

# mds-table-body

> `@maggioli-design-system/magma` 2.15.0. Shadow DOM: style it only through the public CSS custom properties and the parts below.

The `<mds-table-body>` web component is the row-group container of the Magma Design System tabular data system, used inside [`<mds-table>`](../mds-table/AGENTS.md). It is the equivalent of the native HTML `<tbody>`, grouping the data `mds-table-row` elements and relaying the parent table's interaction and selection styling to those rows.

#### Semantic Behavior

- **Compound child**: Must be a direct slot child of `<mds-table>` and hold only `mds-table-row` elements; it is not used standalone nor interleaved with `mds-table-header` / `mds-table-footer` content.
- **Parent-driven state**: Both `interactive` and `selection` are set by the parent table, so consumers normally do not toggle them by hand.
- **Live rows**: Rows added or removed at runtime are detected and re-wired with the table's interactive/selectable state.
- **Hover relay**: When `interactive` is set, hovering the body highlights its rows.
- **Last-row border trimming**: The last `mds-table-body` in a table clears the bottom border of its final row, so the final row does not double the table's own outer border.

#### Properties & Visual Configurations

This component exposes only two boolean flags, both intended to be managed by the parent `<mds-table>` rather than set directly:

- **`interactive`** enables the mouseover row-highlight styling for the group; it mirrors the table's own `interactive` prop.
- **`selection`** switches the body's default background to its alternate tone to signal that an active selection exists; the parent sets it true while at least one row is selected.

## Read next

- [`examples.md`](examples.md) - correct usage, from the most common case
- [`mistakes.md`](mistakes.md) - the wrong forms, each with the right one
- [Storybook](https://magma-design-system.github.io/magma/storybook/?path=/docs/layout-table-body--docs) - the live examples, in the published Storybook of `main`
- [`conventions.md`](../../../../agents/conventions.md), [`variants.md`](../../../../agents/variants.md), [`mistakes.md`](../../../../agents/mistakes.md) - the rules shared by every component

## Props

| Prop | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `interactive` | `interactive` | `boolean \| undefined` | - | Specifies whether the rows react to user interaction (hover/focus). |
| `selection` | `selection` | `boolean \| undefined` | - | Enables the selection column for the rows in this table body. |

## Slots

| Slot | Description |
| --- | --- |
| (default) | Put `mds-table-row` element/s. |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-table-body-background` | Default background color of table body rows. |
| `--mds-table-body-color` | Default text color for table body rows. |

Only these are public. Its other 3 are internal: they may change in any release, do not set them.
