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

# mds-kpi-item

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

The `<mds-kpi-item>` web component is a compound child that represents a single key-performance-indicator entry - a prominent numeric `label` with an optional `description` and `icon` - inside its parent container [`<mds-kpi>`](../mds-kpi/AGENTS.md). It carries no native HTML primitive of its own; it is a presentational list row that `<mds-kpi>` exposes as a list.

#### Semantic Behavior

- **Compound constraint**: Must be placed as a direct default-slot child of [`<mds-kpi>`](../mds-kpi/AGENTS.md); it is not used standalone, and the parent's list semantics only make sense when its children are `mds-kpi-item` elements (do not mix in other child types).
- **Accessible name**: Each item is announced as one list entry, with its spoken text consolidated as `"{label}: {description}"`, leaving out the one that is missing; an `aria-label` on the host replaces it and stays.
- **Scroll-triggered animation**: When `threshold` is greater than `0`, the `label`/`description` reveal with the `yugop` text animation once the item scrolls into the viewport. With `threshold === 0` (the default) the text is rendered immediately with no animation.
- **Conditional rendering**: The icon, value, and description each render only when their respective prop is provided, so an item can show any subset of icon, value, and caption.

#### Properties & Visual Configurations

- **`threshold`**: Controls the reveal-on-scroll behavior. Leave at `0` for static KPIs that should be visible immediately; set a value between `0` and `1` (the fraction of the element that must enter the viewport) to defer the scramble-in animation until the item is scrolled into view - useful for KPI strips lower on a page.
- **`label`** holds the headline figure (rendered as `h2` typography) and **`description`** the supporting caption (rendered as `label` typography); together they form the item's spoken accessible name, so prefer concise, self-explanatory values.
- **`icon`** takes an `mds-icon` name and adds a leading visual marker above the figure; omit it for text-only KPIs.

`<mds-kpi-item>` has no public CSS custom property of its own: the animation pacing comes from the public `--mds-kpi-text-animation-speed` and `--mds-kpi-text-animation-placeholder-char` of the parent [`<mds-kpi>`](../mds-kpi/AGENTS.md), and colors are tuned through the shadow parts documented in [`AGENTS.md`](AGENTS.md) (`icon-container`, `icon`, `content`).

## 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/ui-kpi-kpi-item--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 |
| --- | --- | --- | --- | --- |
| `description` | `description` | `string \| undefined` | - | Specifies the description under the value in the KPI element |
| `icon` | `icon` | `string \| undefined` | - | Specifies the icon on the top of the KPI element |
| `label` | `label` | `string \| undefined` | - | Specifies the number to be displayed in the KPI element |
| `threshold` | `threshold` | `number \| undefined` | `0` | Specifies the page threshold which starts the text animation |

## Parts

| Part | Description |
| --- | --- |
| `content` | Selects the label and description wrapper element |
| `icon` | Selects the icon element |
| `icon-container` | Selects the icon wrapper element |

## CSS custom properties

None is public: its 4 custom properties are internal and may change in any release. Style it with its props, its parts and the semantic roles.

## Dependencies

Uses: `mds-icon`, `mds-text`.
