# ProgressTracker
A component that displays the current step in a multi-step process or workflow.
## Usage
Use standalone.
```svelte
```
## Anatomy
The `class` attribute values represent part names, and `conditional` indicates elements that are rendered conditionally. Other attributes represent their corresponding props.
```svelte
{#each labels as label}
{aux}
{label} or {children}
{extra}
{/each}
```
## Props
| Name | Type | Default | Description |
|---|---|---|---|
| `current*` | `number` | `0` | Index of the step currently progressing |
| `labels*` | `string[]` | - | Step labels |
| `children` | `Snippet` | - | Step content; receives index, label, and variant |
| `aux` | `Snippet` | - | Auxiliary content; receives index, label, and variant |
| `extra` | `boolean | Snippet` | `true` | Between-step connector: `true` default connector, Snippet customizes, `false` hides |
| `statusLabels` | `Record` | - | Maps a variant to a screen-reader-only suffix appended to each step |
| `styling` | `SVSClass` | - | Styling override |
| `variant` | `SVSVariant` | `NEUTRAL` | Variant |
| `eachVariant` | `SvelteMap` | - | Per-step variant |
`*` required. Other `HTMLOlAttributes` are passed to `` via rest props; `class` is merged onto the root.
## Styling
To learn more, see [Styling](/docs/styling).
### Variant Management
Current step and `whole` part are applied `neutral`. Steps less than current step will be `active`, greater than current will be `inactive`. If the `variant` prop is specified, the specified value is applied instead of `neutral`.
### Default Class Name
`svs-progress-tracker`
## Accessibility
### ARIA Roles and Attributes
The component applies these automatically:
- Steps (`middle` `
`): `aria-current="step"` on the current step, and `aria-label` on non-current steps when a status suffix is available.
- Connector (`extra` `
`, when rendered): `aria-hidden="true"`.
Pass `statusLabels` when custom variants need a screen-reader suffix; otherwise the default active state suffix is used.
## Exports
### Types
```ts
interface ProgressTrackerProps extends Omit {
current: number; // (0)
labels: string[];
children?: Snippet<[number, string, string]>; // Snippet<[index,label,variant]>
aux?: Snippet<[number, string, string]>; // Snippet<[index,label,variant]>
extra?: boolean | Snippet<[number, string, string]>; // (true) Snippet<[index,label,variant]>
statusLabels?: Partial>; // variant -> screen-reader suffix
styling?: SVSClass;
variant?: SVSVariant; // (VARIANT.NEUTRAL)
eachVariant?: SvelteMap | Map;
// other HTMLOlAttributes are passed to via ...rest; `class` is merged onto the root
}
type ProgressTrackerReqdProps = "current" | "labels";
type ProgressTrackerBindProps = never;
```
### Others
No additional exports are available.
## Examples
The example code uses Tailwind CSS along with `SVSClass`.
### Basic
**Code**
```svelte src=ProgressTrackerBasic.svelte
{#snippet aux(i)}
{num[i]}
{/snippet}
```
### With Interactive Variant
**Code**
```svelte src=ProgressTrackerPract.svelte
x.label)} {styling}>
{#snippet aux(index)}
{#if index < current}
{:else if index > current}
{:else}
{/if}
{/snippet}
{#snippet children(index)}