Instalación
npx logic2b@next add stepperUso
import {
Stepper,
StepperIndicator,
StepperItem,
StepperSeparator,
StepperTitle,
StepperTrigger,
} from "@/components/ui/stepper"
<Stepper defaultValue={1}>
<StepperItem step={1}>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Cuenta</StepperTitle>
</StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem step={2}>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Confirmación</StepperTitle>
</StepperTrigger>
</StepperItem>
</Stepper>
Cada paso deriva su estado del valor raíz: los anteriores están completed y
el indicador se convierte en una marca; el coincidente está active y lleva
aria-current="step"; los demás están upcoming.
Ejemplos
Vertical
Usa orientation="vertical" en flujos altos. Los separadores se convierten en
líneas entre indicadores y dejan espacio para las descripciones.
Accesibilidad
- Se genera como lista ordenada (
<ol>y<li>), por lo que el número y orden de pasos se anuncian de forma nativa. - El paso activo expone
aria-current="step". - Los activadores son botones reales: admiten foco, se desactivan cuando el
elemento está
disabledy usandata-statepara aplicar los estilos de los estados completado, activo y siguiente. - Los separadores llevan
aria-hiddenporque son puramente decorativos.
Playground interactivo
Edita las propiedades del componente y revisa el JSX exacto antes de copiarlo. La vista previa se carga solo cuando esta sección entra en pantalla.
<Stepper
defaultValue={2}
orientation="horizontal"
aria-label="Release progress"
>
<StepperItem
step={1}
>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Plan</StepperTitle>
</StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem
step={2}
>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Build</StepperTitle>
</StepperTrigger>
<StepperSeparator />
</StepperItem>
<StepperItem
step={3}
>
<StepperTrigger>
<StepperIndicator />
<StepperTitle>Release</StepperTitle>
</StepperTrigger>
</StepperItem>
</Stepper>Referencia de API
Generada a partir de las exportaciones públicas de TypeScript en src/ui/stepper.tsx. Las descripciones técnicas conservan el texto canónico del código fuente.
Stepper
ComponenteProps: Omit<React.ComponentProps<"ol">, "defaultValue"> & { value?: number defaultValue?: number onValueChange?: (step: number) => void orientation?: "horizontal" | "vertical" }| Propiedad | Tipo | Obligatoria | Valor predeterminado | Descripción |
|---|---|---|---|---|
value | number | No | — | — |
defaultValue | number | No | — | — |
onValueChange | (step: number) => void | No | — | — |
orientation | "horizontal" | "vertical" | No | "horizontal" | — |
StepperItem
ComponenteProps: React.ComponentProps<"li"> & { step: number disabled?: boolean }| Propiedad | Tipo | Obligatoria | Valor predeterminado | Descripción |
|---|---|---|---|---|
step | number | Sí | — | — |
disabled | boolean | No | false | — |
StepperTrigger
ComponenteProps: React.ComponentProps<"button">StepperIndicator
ComponenteProps: React.ComponentProps<"span">StepperTitle
ComponenteProps: React.ComponentProps<"span">StepperDescription
ComponenteProps: React.ComponentProps<"span">StepperSeparator
ComponenteProps: React.ComponentProps<"div">Contrato de accesibilidad
Comportamiento legible por máquinas y responsabilidades de quien integra stepper. Los detalles normativos conservan el texto canónico del registro.
- Soporte
- Comportamiento implementado
- Patrón
- step list
- HTML ordered list + buttons
| Teclas | Comportamiento |
|---|---|
| Enter Space | Activate the focused control. |
Semántica incorporada
- The active item exposes aria-current=step; separators are aria-hidden.
Responsabilidades de integración
- Give every trigger descriptive text and do not rely on color alone for completed/current state.