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

# mds-card-header

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

The `<mds-card-header>` web component is the header region of a [`<mds-card>`](../mds-card/AGENTS.md), grouping the card's title, supporting text, and optional inline actions. It carries no styling of its own beyond layout: its job is to occupy the parent card's `header` region and arrange its content alongside any action controls.

#### Semantic Behavior

- **Compound child only**: `<mds-card-header>` must be placed as a direct child of `<mds-card>`; it is not used standalone, and a card expects at most one header alongside its sibling card regions (`mds-card-media`, `mds-card-content`, `mds-card-footer`), not mixed with arbitrary elements.
- **Self-slotting into the parent**: It automatically lands in the card's `header` region without the author setting any `slot` attribute, and its presence is factored into the card's responsive layout.
- **Action slot presence**: The dedicated actions wrapper is shown only while a direct child assigned to the `action` slot exists, also when it is added after the first render, so a header without actions produces no empty action container.
- **No role/ARIA of its own**: It exposes no implicit role, state, or events; it is a passive layout grouping.

#### Properties & Visual Configurations

`<mds-card-header>` has no configurable properties - it is a pure layout child driven entirely by its two slots:

- **Default (unnamed) slot**: Holds the primary header content (title text, HTML, or components such as a heading element).
- **`action` slot**: Holds inline action controls, rendered in a separate region next to the header content; `mds-button` is the recommended element here. Provide content to this slot only when the header needs actions, since the wrapper is shown only while children are present.

## 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-card-header--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

## Slots

| Slot | Description |
| --- | --- |
| (default) | Add `text string`, `HTML elements` or `components` to this slot. |
| `action` | Add `HTML elements` or `components`, it is **recommended** to use `mds-button` element. |
