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

# mds-help

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

The `<mds-help>` web component is a contextual help affordance of the Magma Design System: a small help icon that reveals an explanatory tooltip on interaction. It composes [`mds-icon`](../mds-icon/AGENTS.md) and [`mds-tooltip`](../mds-tooltip/AGENTS.md) into a single drop-in element, so there is no native HTML primitive it replaces.

#### Semantic Behavior

- **Tooltip-on-icon**: The host always renders a help icon and anchors a tooltip to it; the slotted text becomes the tooltip body and is shown while the pointer hovers the icon or the icon has the focus. The icon is a tab stop named by the tooltip text (`role="img"` with `aria-labelledby`), so a screen reader reads the help on it.
- **Auto-placement**: Unless `disableAutoPlacement` is set (auto-placement is on by default), the tooltip takes `placement` whenever it has room there, and moves to another side of the icon only when it does not fit.
- **Default-slot is text**: The default slot is intended for a plain text string only; HTML elements or components in the slot are discouraged because the content is rendered inside the tooltip.

#### Properties & Visual Configurations

- **`icon`** is an SVG filename slug from the Magma icon library; when omitted, the component falls back to the standard outline help glyph, so set it only to convey a help affordance other than the default question mark.
- **`placement`** sets the preferred side of the icon on which the tooltip appears (e.g. `'top'`, `'bottom-start'`). It is kept whenever it has room; auto-placement moves the tooltip away from it only when it does not fit.
- **`disableAutoPlacement`** turns off dynamic repositioning. Leave it off in scrollable or edge-of-viewport contexts; set it only when you need the tooltip pinned strictly to the `placement` side.

The tooltip's dimensions and reveal timing are tuned via the CSS custom properties documented in [`AGENTS.md`](AGENTS.md) (`--mds-help-tooltip-width`, `--mds-help-tooltip-min-width`, `--mds-help-tooltip-max-width`, `--mds-help-tooltip-delay`).

## 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-help--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 |
| --- | --- | --- | --- | --- |
| `disableAutoPlacement` | `disable-auto-placement` | `boolean \| undefined` | `false` | Pins the tooltip to `placement`: without it, the tooltip moves to another side of the icon when `placement` has no room. |
| `icon` | `icon` | `string \| undefined` | - | Set the name of the icon. |
| `placement` | `placement` | `"bottom" \| "bottom-end" \| "bottom-start" \| "left" \| "left-end" \| "left-start" \| "right" \| "right-end" \| "right-start" \| "top" \| "top-end" \| "top-start" \| undefined` | `'top'` | Specifies where the tooltip should be placed relative to the icon: the side it takes whenever it has room there. |

## Slots

| Slot | Description |
| --- | --- |
| (default) | Add `text string` to this slot, **avoid** `HTML elements` or `components`. |

## Parts

| Part | Description |
| --- | --- |
| `icon` | The icon that shows the help text in a tooltip |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-help-tooltip-delay` | The delay before the tooltip becomes visible. |
| `--mds-help-tooltip-max-width` | The maximum allowed width of the tooltip. |
| `--mds-help-tooltip-min-width` | The minimum allowed width of the tooltip. |
| `--mds-help-tooltip-width` | The width of the tooltip element. |

## Dependencies

Uses: `mds-icon`, `mds-tooltip`.
Used by: `mds-policy-ai`.
