# Tooltip (`<pTooltip>`)

> Ficha para agentes, generada de sc-docs por `scripts/docs-ia.mjs` el 2026-12-03: no se edita a mano. La página para personas, con el Playground y las herramientas: https://sc-doc.pages.dev/#/components/tooltip

- **Estado**: listo: tiene maestro en el Kit de Figma y página de demo.
- **Envuelve**: `primeng/tooltip` de PrimeNG.

## Cuándo se usa

Para lo que se lee al pasar el ratón: un icono con significado, un texto cortado (con `showOnEllipsis`) o por qué un botón está apagado. Nunca un `title`, que el navegador enseña con su globo; el de un botón de solo icono ya lo pone `sc-button`.

## Qué es

Lo que se lee al pasar el ratón: el nombre de un icono, un texto cortado o por qué un botón está apagado. Es el pTooltip de PrimeNG tal cual, con el tema del DS, sobre el elemento que lo necesita; nunca un title, que el navegador enseña con su globo del sistema (DD-212). Siempre con su posición: arriba, y abajo en la barra superior; nunca a la izquierda. Dice una frase sin punto final y, si no cabe en una línea, parte en dos iguales (DD-254).

## Importar

```ts
// <pTooltip>: su clase no se encontró en el DS
```

## Propiedades

Del código del componente, cruzado con la API de PrimeNG (`_component-api.json`). «Dos sentidos» es un `model()`: se ata con `[(x)]`.

| Nombre | Clase | Tipo | Por defecto | Qué hace |
|---|---|---|---|---|
| `pTooltip` | entrada | `string \| TemplateRef<void>` |  | Content of the tooltip. (de PrimeNG) |
| `tooltipPosition` | entrada | `TooltipPosition` |  | Position of the tooltip. (de PrimeNG) |
| `tooltipEvent` | entrada | `TooltipEvent` |  | Event to show the tooltip. (de PrimeNG) |
| `positionStyle` | entrada | `string` |  | Type of CSS position. (de PrimeNG) |
| `tooltipStyleClass` | entrada | `string` |  | Style class of the tooltip. (de PrimeNG) |
| `tooltipZIndex` | entrada | `string \| number` |  | Whether the z-index should be managed automatically to always go on top or have a fixed value. (de PrimeNG) |
| `escape` | entrada | `boolean` |  | By default the tooltip contents are rendered as text. Set to false to support html tags in the content. (de PrimeNG) |
| `showDelay` | entrada | `number` |  | Delay to show the tooltip in milliseconds. (de PrimeNG) |
| `hideDelay` | entrada | `number` |  | Delay to hide the tooltip in milliseconds. (de PrimeNG) |
| `life` | entrada | `number` |  | Time to wait in milliseconds to hide the tooltip even it is active. (de PrimeNG) |
| `positionTop` | entrada | `number` |  | Specifies the additional vertical offset of the tooltip from its default position. (de PrimeNG) |
| `positionLeft` | entrada | `number` |  | Specifies the additional horizontal offset of the tooltip from its default position. (de PrimeNG) |
| `autoHide` | entrada | `boolean` |  | Whether to hide tooltip when hovering over tooltip content. Keeping the tooltip open applies to pointer users only, content inside the tooltip is not reachable with the keyboard. (de PrimeNG) |
| `fitContent` | entrada | `boolean` |  | Whether the width of the tooltip fits its content. (de PrimeNG) |
| `hideOnEscape` | entrada | `boolean` |  | Whether to hide tooltip on escape key press. (de PrimeNG) |
| `showOnEllipsis` | entrada | `boolean` |  | Whether to show the tooltip only when the target text overflows (e.g., ellipsis is active). (de PrimeNG) |
| `tooltipDisabled` | entrada | `boolean` |  | When present, it specifies that the component should be disabled. (de PrimeNG) |
| `tooltipOptions` | entrada | `TooltipOptions` |  | Specifies the tooltip configuration options for the component. (de PrimeNG) |
| `appendTo` | entrada | `AppendTo` |  | Target element to attach the overlay, valid values are "body" or a local ng-template variable of another element (note: use binding with brackets for template variables, e.g. [appendTo]="mydiv" for a div element having #mydiv as variable name). (de PrimeNG) |
| `pTooltipPT` | entrada | `TooltipPassThrough` |  | Used to pass attributes to DOM elements inside the Tooltip component. (de PrimeNG) |
| `pTooltipUnstyled` | entrada | `boolean` |  | Indicates whether the component should be rendered without styles. (de PrimeNG) |

## Stories

Cada una con su código y su enlace. «Suelta» abre solo esa story, sin el marco de la web (para mirarla o capturarla).

### Un icono con significado

```html
<!-- Un icono que significa algo dice su nombre, siempre. El lector lo oye por su aria-label. -->
<sc-tag severity="secondary" icon="description" role="img" aria-label="Transcribe" pTooltip="Transcribe" tooltipPosition="top" />
```

[Abrir](https://sc-doc.pages.dev/#/components/tooltip?historia=un-icono-con-significado) · [Suelta](https://sc-doc.pages.dev/#/components/tooltip?historia=un-icono-con-significado&solo=1) · [Captura](https://sc-doc.pages.dev/ia/capturas/tooltip/un-icono-con-significado.png)

### Un texto cortado

```html
<!-- Un texto cortado se enseña entero solo si se ve «…»: el que cabe no lleva tooltip.
     showOnEllipsis mide el elemento que lleva el pTooltip, así que va en el que recorta. -->
<span class="nombre" pTooltip="Atención al cliente" showOnEllipsis tooltipPosition="top">Atención al cliente</span>
<span class="nombre" pTooltip="Reclamaciones de facturación y cobros indebidos" showOnEllipsis tooltipPosition="top">
  Reclamaciones de facturación y cobros indebidos
</span>
```

[Abrir](https://sc-doc.pages.dev/#/components/tooltip?historia=un-texto-cortado) · [Suelta](https://sc-doc.pages.dev/#/components/tooltip?historia=un-texto-cortado&solo=1) · [Captura](https://sc-doc.pages.dev/ia/capturas/tooltip/un-texto-cortado.png)

### Un botón apagado

```html
<!-- Un botón apagado dice por qué, siempre. -->
<sc-button label="Guardar" [disabled]="true" pTooltip="No hay cambios que guardar" tooltipPosition="top" />
```

[Abrir](https://sc-doc.pages.dev/#/components/tooltip?historia=un-boton-apagado) · [Suelta](https://sc-doc.pages.dev/#/components/tooltip?historia=un-boton-apagado&solo=1) · [Captura](https://sc-doc.pages.dev/ia/capturas/tooltip/un-boton-apagado.png)

### Con teclado

```html
<!-- En algo que se enfoca, también con el teclado: por defecto el tooltip solo sale con el ratón. -->
<sc-button
  label="Datos de demo"
  variant="secondary"
  pTooltip="Cambia el conjunto de datos del prototipo"
  tooltipPosition="top"
  tooltipEvent="both"
/>
```

[Abrir](https://sc-doc.pages.dev/#/components/tooltip?historia=con-teclado) · [Suelta](https://sc-doc.pages.dev/#/components/tooltip?historia=con-teclado&solo=1) · [Captura](https://sc-doc.pages.dev/ia/capturas/tooltip/con-teclado.png)

### En la barra superior

```html
<!-- En la barra superior (lo que una pantalla pone en su #topbarActions), abajo: arriba no cabe
     y PrimeNG lo bajaría solo; se escribe donde sale. -->
<sc-button label="Guardar" [disabled]="true" pTooltip="El nombre es obligatorio" tooltipPosition="bottom" />
```

[Abrir](https://sc-doc.pages.dev/#/components/tooltip?historia=en-la-barra-superior) · [Suelta](https://sc-doc.pages.dev/#/components/tooltip?historia=en-la-barra-superior&solo=1)
