# @salmonui/navigation/stepper API reference

> 13 exported symbols of @salmonui/navigation/stepper: 2 functions, 8 interfaces, 2 types and 1 constant.

Canonical: https://salmonui.dev/docs/reference/navigation/stepper

```ts
import { … } from '@salmonui/navigation/stepper';
```

## Functions

### Step

Kind: function

Page: https://salmonui.dev/docs/reference/navigation/stepper/Step

```ts
function Step(props: StepProps): ReactElement;
```

One step: `<li class="salmon-stepper-step">` with `data-status`,
`data-active`, `data-invalid`, `data-optional`, `data-disabled`; parts
`.salmon-stepper-step-button` (a `<span>` when read-only),
`.salmon-stepper-indicator`, `.salmon-stepper-label`,
`.salmon-stepper-description`. The connector to the next step is CSS.

### Stepper

Kind: function

Page: https://salmonui.dev/docs/reference/navigation/stepper/Stepper

```ts
function Stepper(props: StepperProps): ReactElement;
```

A step indicator: an `<ol>` of `Step`s; the active step has
`aria-current="step"`. Selectable steps are buttons with one tab stop
(arrows by orientation, mirrored in RTL, Home / End). `.salmon-stepper`
with `data-orientation`, `data-label-placement`. `ref` is the `<ol>`.

## Interfaces

### StepClickEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepClickEvent

```ts
interface StepClickEvent {
    readonly index: number;
    readonly source: StepperSource;
}
```

`onStepClick` event.

Members (2):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `index` | `readonly index: number;` |  |  |
| `source` | `readonly source: StepperSource;` |  |  |

### StepProps

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepProps

```ts
interface StepProps extends Omit<HTMLAttributes<HTMLLIElement>, 'children'> {
    label?: ReactNode;
    description?: ReactNode;
    icon?: ReactNode;
    optional?: boolean | undefined;
    disabled?: boolean | undefined;
    invalid?: boolean | undefined;
    status?: StepStatus | undefined;
    children?: ReactNode;
    render?: ((props: StepTriggerProps) => ReactElement) | undefined;
    ref?: Ref<HTMLLIElement> | undefined;
}
```

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `label` | `label?: ReactNode;` | optional |  |
| `description` | `description?: ReactNode;` | optional |  |
| `icon` | `icon?: ReactNode;` | optional | Replaces the step number in the indicator. |
| `optional` | `optional?: boolean \| undefined;` | optional | Shows the "Optional" text. |
| `disabled` | `disabled?: boolean \| undefined;` | optional | Not selectable (`aria-disabled`). |
| `invalid` | `invalid?: boolean \| undefined;` | optional | Marks the step as failing validation (`data-invalid`, announced). |
| `status` | `status?: StepStatus \| undefined;` | optional | Overrides the status derived from the Stepper `value`. |
| `children` | `children?: ReactNode;` | optional | Replaces the step's content; wins over `renderStep`. |
| `render` | `render?: ((props: StepTriggerProps) => ReactElement) \| undefined;` | optional | Renders the step's trigger element (a `<button>`, or a `<span>` when the Stepper is read-only) with the computed props; spread them. Composes a `Tooltip` around the step without the Stepper importing it. |
| `ref` | `ref?: Ref<HTMLLIElement> \| undefined;` | optional |  |

### StepRenderContext

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepRenderContext

```ts
interface StepRenderContext {
    readonly index: number;
    readonly status: StepStatus;
    readonly active: boolean;
    readonly label: ReactNode;
    readonly description: ReactNode;
    readonly icon: ReactNode;
    readonly optional: boolean;
    readonly invalid: boolean;
    readonly disabled: boolean;
}
```

Context of `renderStep`.

Members (9):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `index` | `readonly index: number;` |  |  |
| `status` | `readonly status: StepStatus;` |  |  |
| `active` | `readonly active: boolean;` |  |  |
| `label` | `readonly label: ReactNode;` |  |  |
| `description` | `readonly description: ReactNode;` |  |  |
| `icon` | `readonly icon: ReactNode;` |  |  |
| `optional` | `readonly optional: boolean;` |  |  |
| `invalid` | `readonly invalid: boolean;` |  |  |
| `disabled` | `readonly disabled: boolean;` |  |  |

### StepTriggerProps

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepTriggerProps

```ts
interface StepTriggerProps {
    readonly className: string;
    readonly children: ReactNode;
    readonly type?: 'button';
    readonly tabIndex?: number;
    readonly 'aria-disabled'?: true;
    readonly onClick?: (event: MouseEvent<HTMLElement>) => void;
}
```

Props `Step` computes for its trigger (`render`); none of them is a focus or pointer handler.

Members (6):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `className` | `readonly className: string;` |  |  |
| `children` | `readonly children: ReactNode;` |  |  |
| `type` | `readonly type?: 'button';` | optional |  |
| `tabIndex` | `readonly tabIndex?: number;` | optional |  |
| `aria-disabled` | `readonly 'aria-disabled'?: true;` | optional |  |
| `onClick` | `readonly onClick?: (event: MouseEvent<HTMLElement>) => void;` | optional |  |

### StepperBeforeChangeEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepperBeforeChangeEvent

```ts
interface StepperBeforeChangeEvent {
    readonly value: number;
    readonly previousValue: number;
    readonly source: StepperSource;
    readonly defaultPrevented: boolean;
    preventDefault(): void;
}
```

`onBeforeValueChange` event; `preventDefault()` cancels the change.

Members (5):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `value` | `readonly value: number;` |  |  |
| `previousValue` | `readonly previousValue: number;` |  |  |
| `source` | `readonly source: StepperSource;` |  |  |
| `defaultPrevented` | `readonly defaultPrevented: boolean;` |  |  |
| `preventDefault` | `preventDefault(): void;` |  |  |

### StepperChangeEvent

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepperChangeEvent

```ts
interface StepperChangeEvent {
    readonly source: StepperSource;
}
```

Second argument of `onValueChange` (frozen in development).

Members (1):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `source` | `readonly source: StepperSource;` |  |  |

### StepperLocaleText

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepperLocaleText

```ts
interface StepperLocaleText {
    readonly optional: string;
    readonly invalid: string;
    readonly completed: string;
}
```

Static texts of the Stepper.

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `optional` | `readonly optional: string;` |  | Shown under the label of an `optional` step. |
| `invalid` | `readonly invalid: string;` |  | Announced for an `invalid` step. |
| `completed` | `readonly completed: string;` |  | Announced for a completed step. |

### StepperProps

Kind: interface

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepperProps

```ts
interface StepperProps extends Omit<OlHTMLAttributes<HTMLOListElement>, 'defaultValue' | 'onChange' | 'type'> {
    children?: ReactNode;
    value?: number | undefined;
    defaultValue?: number | undefined;
    onValueChange?: ((value: number, event: StepperChangeEvent) => void) | undefined;
    onBeforeValueChange?: ((event: StepperBeforeChangeEvent) => void) | undefined;
    onStepClick?: ((event: StepClickEvent) => void) | undefined;
    linear?: boolean | undefined;
    readOnly?: boolean | undefined;
    orientation?: 'horizontal' | 'vertical' | undefined;
    labelPlacement?: 'top' | 'bottom' | 'start' | 'end' | undefined;
    renderStep?: ((context: StepRenderContext) => ReactNode) | undefined;
    localeText?: Partial<StepperLocaleText> | undefined;
    ref?: Ref<HTMLOListElement> | undefined;
}
```

Members (13):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `children` | `children?: ReactNode;` | optional | `Step` children (direct children or arrays of them). |
| `value` | `value?: number \| undefined;` | optional | Active step, 0-based. |
| `defaultValue` | `defaultValue?: number \| undefined;` | optional |  |
| `onValueChange` | `onValueChange?: ((value: number, event: StepperChangeEvent) => void) \| undefined;` | optional |  |
| `onBeforeValueChange` | `onBeforeValueChange?: ((event: StepperBeforeChangeEvent) => void) \| undefined;` | optional | Runs before a change; `event.preventDefault()` cancels it. |
| `onStepClick` | `onStepClick?: ((event: StepClickEvent) => void) \| undefined;` | optional | A selectable step was clicked or activated with Enter / Space. |
| `linear` | `linear?: boolean \| undefined;` | optional | Only earlier steps and the next one are selectable. |
| `readOnly` | `readOnly?: boolean \| undefined;` | optional | Steps are an indicator only: no buttons, no selection. |
| `orientation` | `orientation?: 'horizontal' \| 'vertical' \| undefined;` | optional | Default `'horizontal'`. |
| `labelPlacement` | `labelPlacement?: 'top' \| 'bottom' \| 'start' \| 'end' \| undefined;` | optional | Label side relative to the indicator; logical. Default `'bottom'` horizontally, `'end'` vertically. |
| `renderStep` | `renderStep?: ((context: StepRenderContext) => ReactNode) \| undefined;` | optional | Replaces the default content of every step. |
| `localeText` | `localeText?: Partial<StepperLocaleText> \| undefined;` | optional |  |
| `ref` | `ref?: Ref<HTMLOListElement> \| undefined;` | optional |  |

## Types

### StepStatus

Kind: type

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepStatus

```ts
type StepStatus = 'notStarted' | 'inProgress' | 'completed';
```

Progress of a step.

### StepperSource

Kind: type

Page: https://salmonui.dev/docs/reference/navigation/stepper/StepperSource

```ts
type StepperSource = 'pointer' | 'keyboard' | 'touch';
```

## Constants

### STEPPER_DEFAULT_LOCALE_TEXT

Kind: const

Page: https://salmonui.dev/docs/reference/navigation/stepper/STEPPER_DEFAULT_LOCALE_TEXT

```ts
const STEPPER_DEFAULT_LOCALE_TEXT: StepperLocaleText;
```
