Komponenter
Stepper
Stepper brukes som en visuell guide på progresjon, eller som støtte til navigasjon mellom steg.
Egnet til:
- Vise brukeren hvor langt de har kommet i en prosess.
Uegnet til:
- Eneste måte å navigere på.
- Søknadsdialog (bruk FormProgress).
Eksempler
Retningslinjer
Som lenke eller knapp
Stepper.Step er default en a-tag og brukes som lenke. Basert på hvordan applikasjonen din er satt opp, kan en button funke bedre. Da kan man bruke as
-proppen på steget for å overskrive taggen.
<Stepper> <Stepper.Step as="button" onClick={() => doSPAStuff()}>Start søknad</Stepper.Step> <Stepper.Step as="button" onClick={() => doSPAStuff()}>Personopplysninger</Stepper.Step></Stepper>
Props
Stepper
children
- Type:
ReactNode
- Description:
<Stepper.Step />
elements.
orientation?
- Type:
"horizontal" | "vertical"
- Default:
""vertical""
- Description:
The direction the component grows.
activeStep
- Type:
number
- Description:
Current active step.
Stepper index starts at 1, not 0.
onStepChange?
- Type:
((step: number) => void)
- Description:
Callback for next
activeStep
.Stepper index starts at 1, not 0.
interactive?
- Type:
boolean
- Default:
true
- Description:
Makes stepper non-interactive if false.
className?
- Type:
string
data-color?
- Type:
(string & {}) | AkselColor
ref?
- Type:
LegacyRef<HTMLOListElement>
- Description:
Allows getting a ref to the component instance. Once the component unmounts, React will set
ref.current
tonull
(or call the ref withnull
if you passed a callback ref). React Docs
Stepper.Step
children
- Type:
string
- Description:
Text content by indicator.
completed?
- Type:
boolean
- Default:
false
- Description:
Makes step-indicator a checkmark.
interactive?
- Type:
boolean
- Default:
true
- Description:
Makes step non-interactive if false. Step will be set to a
<div>
, overridingas
-prop.
className?
- Type:
string
data-color?
- Type:
(string & {}) | AkselColor
ref?
- Type:
LegacyRef<HTMLAnchorElement>
- Description:
Allows getting a ref to the component instance. Once the component unmounts, React will set
ref.current
tonull
(or call the ref withnull
if you passed a callback ref). React Docs
as?
- Type:
React.ElementType
- Description:
OverridableComponent-api
Tokens
Deprecation warning: I det nye systemet for theming og darkmode, er komponent-tokens fjernet. Mer dokumentasjon for dette kommer, midlertidig dokumentasjon finner du her.
Token | Fallback |
---|---|
--ac-stepper-text | --a-surface-action |
--ac-stepper-line | --a-border-default |
--ac-stepper-line-completed | --a-border-selected |
--ac-stepper-non-interactive | --a-text-subtle |
--ac-stepper-active | --a-text-action-selected |
--ac-stepper-active-bg | --a-surface-action-selected |
--ac-stepper-active-border | --a-border-action-selected |
--ac-stepper-active-text | --a-text-on-action |
--ac-stepper-hover-active | --a-text-action-hover |
--ac-stepper-hover-bg | --a-surface-action-subtle-hover |
--ac-stepper-non-interactive-completed-bg | --a-surface-subtle |
--ac-stepper-non-interactive-line-completed | --a-border-strong |
--ac-stepper-non-interactive-active | --a-text-default |
--ac-stepper-non-interactive-active-bg | --a-surface-inverted |
--ac-stepper-non-interactive-active-border | --a-surface-inverted |
--ac-stepper-non-interactive-active-text | --a-text-on-inverted |
--ac-stepper-active-completed | --a-text-action-selected |
--ac-stepper-non-interactive-active-completed | --a-text-default |