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

# mds-paginator

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

The `<mds-paginator>` web component is the page-navigation control of the Magma Design System. It renders a horizontal strip of numbered page items framed by previous/next arrows, replacing an ad-hoc set of links or buttons with a single self-managing control.

#### Semantic Behavior

- **Self-rendered children**: The paginator generates its own page items internally from `pages`; authors do not slot the items.
- **Page change event**: Selecting a page (or an arrow) emits `mdsPaginatorChange` with a detail of `{ page, caller }`, where `caller` is the `mds-paginator-item` that triggered the change.
- **Bounds clamping**: Navigation requests below `1` or above `pages` are ignored, so the arrows can never move past the valid range.
- **Arrow disabling**: The back arrow is disabled on the first page and the forward arrow on the last page; a disabled arrow leaves the tab order.
- **Arrow names**: The arrows are icon-only buttons, named in the page language (the `lang` of `<html>`): "Previous page" and "Next page".
- **Auto-scroll into view**: When `pages` exceeds two, the strip scrolls so the active page is centered; selecting an item re-centers it, and so does focusing an item from the keyboard (tabbing through the pages). Pointer interaction never scrolls the strip before the click lands, so the clicked page is always the one selected. Scroll motion is themeable via `--mds-paginator-scroll-behavior`.
- **Initial sync**: On load the component navigates to the provided `currentPage`, emitting the change event and scrolling the strip to match.

#### Properties & Visual Configurations

- **`pages`** is the total number of pages the control should represent and drives how many items are rendered; with `0` only the arrows appear.
- **`currentPage`** marks which item is selected and which arrows are disabled; set it to control the paginator from outside, or read it back after a `mdsPaginatorChange` to follow user navigation.

This component does not use the shared `variant` / `tone` ladders defined in [`agents/variants.md`](../../../../agents/variants.md); its appearance is tuned only through the CSS custom properties documented in [`AGENTS.md`](AGENTS.md).

## 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-paginator--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 |
| --- | --- | --- | --- | --- |
| `currentPage` | `current-page` | `number` | `1` | Specifies the current page selected in the paginator |
| `pages` | `pages` | `number` | `0` | Specifies the number of total pages to be handled |

## Events

| Event | Detail | Description |
| --- | --- | --- |
| `mdsPaginatorChange` | `MdsPaginatorEventDetail` | Emits when a page is changed |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-paginator-background` | Sets the background-color of the pages area, behind the items |
| `--mds-paginator-scroll-behavior` | Sets the scroll-behavior animation |

## Dependencies

Uses: `mds-paginator-item`.
