# StickyFormHeader (`<sc-sticky-form-header>`)

> 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/stickyformheader

- **Estado**: retirado. Motivo: RETENIDO PARA ROLLBACK (S59, Supervisor DD#65). Ya NO lo usa ningún form de la app: los 3 form shells migraron al modelo "todo arriba" (acciones al TopBar + la ficha del panel para la identidad). Se conserva intacto —exportado + showcased en la demo— como red de seguridad por si se revierte el "todo arriba". NO borrar sin decisión explícita (ver DD#65 § "Cómo revertir").
- **Envuelve**: `—` de PrimeNG.

## Cuándo se usa

Para la cabecera fija de un formulario largo, con guardar y cancelar siempre a mano.

## Qué es

Deprecated / retenido (rollback DD#65): ya no lo usa ningún form (los 3 shells migraron a «todo arriba»). Se conserva como red de seguridad. Header sticky de Create/Edit: eyebrow + nombre editable inline + Guardar.

## Importar

```ts
import { ScStickyFormHeaderComponent } from '@smartcontact-hub/components';
```

## 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 |
|---|---|---|---|---|
| `mode` | entrada | `'create' \| 'edit'` |  | `create` o `edit`. Cambia los textos de la cabecera y del botón de guardar. **(obligatoria)** |
| `entityKey` | entrada | `string` |  | Entity-singular label key (`'users.entity_singular'`). **(obligatoria)** |
| `name` | entrada | `string` |  | Current entity name (display + edit target). **(obligatoria)** |
| `canSave` | entrada | `boolean` | `true` | Disables the Save button while true. |
| `saving` | entrada | `boolean` | `false` | Replaces Save with a spinner while true. |
| `namePlaceholderKey` | entrada | `string` | `'sc.stickyFormHeader.namePlaceholder'` | i18n key for the create-mode name input placeholder. |
| `showBack` | entrada | `boolean` | `false` | Whether to render the "Atrás" button in the actions cluster. Default is `false` — the page-level breadcrumb already gives the user a way back, so the form actions cluster only carries Save. Pass `true` to opt-in (e.g. on a deeper modal where the breadcrumb isn't visible). |
| `nameChange` | salida | `string` |  | El usuario ha editado el nombre desde la propia cabecera. |
| `save` | salida | `void` |  | El usuario ha pulsado guardar. |
| `cancelled` | salida | `void` |  | El usuario ha pulsado cancelar. |

## 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).

### Playground

Controles del Playground:

- `mode` (create | edit)
- `entityKey` (texto)
- `canSave` (sí/no)
- `saving` (sí/no)
- `namePlaceholderKey` (texto)
- `showBack` (sí/no)

Con sus valores por defecto:

```html
<sc-sticky-form-header
  [name]="name"
  mode="edit"
  entityKey="AGENTE"
  namePlaceholderKey="Nombre del agente"
/>
```

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

Todas las combinaciones de sus desplegables e interruptores, en una rejilla: https://sc-doc.pages.dev/#/components/stickyformheader?historia=combinaciones

### Edit (nombre editable)

```html
<sc-sticky-form-header
  mode="edit"
  entityKey="AGENTE"
  [name]="name()"
  (nameChange)="onNameChange($event)"
  (save)="onSave()"
/>
```

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

### Create (input de nombre)

```html
<sc-sticky-form-header
  mode="create"
  entityKey="Nuevo agente"
  [name]="''"
  namePlaceholderKey="Nombre del agente"
/>
```

[Abrir](https://sc-doc.pages.dev/#/components/stickyformheader?historia=create-input-de-nombre) · [Suelta](https://sc-doc.pages.dev/#/components/stickyformheader?historia=create-input-de-nombre&solo=1) · [Captura](https://sc-doc.pages.dev/ia/capturas/stickyformheader/create-input-de-nombre.png)

## Anatomía

Lo que se escribe es `<sc-sticky-form-header>`; esto es lo que el navegador pinta de verdad (leído del DOM el 2026-10-30). Sirve para escribir un selector o depurar CSS.

```
sc-sticky-form-header
  header
    div
      sc-button
        p-button
          button.p-button.p-button-primary.p-component.p-ripple
```
