Komponenter
Timeline
Tidslinjen gir en visuell oversikt over perioder i kronologisk rekkefølge. Periodene kan gjøres klikkbare, slik at du kan vise utfyllende informasjon. Tidslinjen fungerer ikke på mobil, og skal bare brukes på interne flater.
Egnet til:
- Bruk på interne flater
- Fullskjermvisning
- Oversikt over hva som har skjedd i bestemte perioder
Uegnet til:
- Mobile grensesnitt
Eksempler
Retningslinjer
Bruk av ikoner og farger
Bruk ikon, som eksemplene viser, for å kommunisere type periode. Komponenten kommer med 5 innebygde statuser som bestemmer farge og tilgjengelig tekst:
| Status | Farge | Tilgjengelig tekst |
|---|---|---|
| success | --ax-bg-success-moderate | Suksess fra ${start} til ${end} |
| warning | --ax-bg-warning-moderate | Advarsel fra ${start} til ${end} |
| danger | --ax-bg-danger-moderate | Fare fra ${start} til ${end} |
| info | --ax-bg-info-moderate | Info fra ${start} til ${end} |
| neutral | --ax-bg-neutral-moderate | Nøytral fra ${start} til ${end} |
Du kan overskrive statusen i den tilgjengelige teksten ved å bruke propen statusLabel.
Minimum bredde
Avhengig av hvilken tidsperiode som blir vist (startDate/endDate) og antall perioder vil komponenten kreve en viss bredde for at innholdet skal komme tydelig frem. Vær forsiktig med å legge inn for mange perioder, og vurder å legge til horisontal stegvis skroll.
Tilgjengelighet
Tastaturinteraksjon
Mulighet for bruk av pil opp/ned er lagt til for å lettere kunne navigere seg gjennom tidslinjen uten å tabbe gjennom alle periodene.
Interaksjon med skjermleser
Hvis aria-controls er satt på en periode i tidslinja og panelet, kan de som bruker Jaws hoppe fram/tilbake med hurtigtasten Alt+Jaws+m. Jaws er enten Insert eller CapsLock, avhengig av hvilket tastaturoppsett som er valgt i Jaws.
Mulige utfordringer med WCAG
Vær oppmerksom på at komponenten ikke er responsiv.
Props
Timeline
startDate?
- Type:Date
- Description:
Decides startingpoint in timeline. Defaults to earliest date among the timeline periods.
Using this disables use of ZoomButtons. You will need to control zooming yourself.
endDate?
- Type:Date
- Description:
Decides end-date for timeline. Defaults to the latest date among the timeline periods.
Using this disables use of ZoomButtons. You will need to control zooming yourself.
direction?
- Type:"left" | "right"
- Default:"left"
- Description:
Decides direction which periods are sorted/displayed. "left" ascends from earliest date on left.
className?
- Type:string
axisLabelTemplates?
- Deprecated:Use `<Provider />`-component
- Type:AxisLabelTemplates
- Description:
Templates for label texts. The templates are passed to the date-fns
formatfunction. Defaults to { day: "dd.MM", month: "MMM yy", year: "yyyy" }.
Timeline.Row
label
- Type:string
- Description:
Label for the timeline row
headingTag?
- Type:"h2" | "h3" | "h4" | "h5" | "h6"
- Default:"h3"
- Description:
Heading level for the label e.g h2, h3...
icon?
- Type:ReactNode
- Description:
Icon next to label
className?
- Type:string
ref?
- Type:Ref<HTMLOListElement>
- Description:
Allows getting a ref to the component instance. Once the component unmounts, React will set
ref.currenttonull(or call the ref withnullif you passed a callback ref). React Docs
Timeline.Period
start
- Type:Date
- Description:
Period start date.
end
- Type:Date
- Description:
Period end date.
icon?
- Type:ReactNode
- Description:
Icon for easier visual identification.
status?
- Type:"success" | "warning" | "danger" | "info" | "neutral"
- Default:"neutral"
- Description:
Period status.
data-color?
- Type:"accent" | "neutral" | "info" | "success" | "warning" | "danger" | "meta-purple" | "meta-lime" | "brand-beige" | "brand-blue" | "brand-magenta"
- Description:
Overrides color set by status. @see 🏷️ {@link AkselColor } @see 📝 Documentation
statusLabel?
- Type:string
- Description:
Status label for screen-readers e.g "Sykemeldt", "foreldrepermisjon"
onSelectPeriod?
- Type:((event: MouseEvent<Element, MouseEvent> | KeyboardEvent<Element>) => void)
- Description:
Callback when selecting a period.
children?
- Type:ReactNode
- Description:
Content displayed in Popover on click.
isActive?
- Type:boolean
- Description:
Visual active inidcation on period.
Make sure only one period is active at a time.
placement?
- Type:"top" | "bottom"
- Default:"top"
- Description:
Default orientation of popover
className?
- Type:string
ref?
- Type:Ref<HTMLDivElement | HTMLButtonElement>
- Description:
Allows getting a ref to the component instance. Once the component unmounts, React will set
ref.currenttonull(or call the ref withnullif you passed a callback ref). React Docs
Timeline.Pin
date
- Type:Date
- Description:
Date position for the pin.
children?
- Type:ReactNode
- Description:
Content in Pin Popover.
className?
- Type:string
ref?
- Type:Ref<HTMLButtonElement>
- Description:
Allows getting a ref to the component instance. Once the component unmounts, React will set
ref.currenttonull(or call the ref withnullif you passed a callback ref). React Docs
Timeline.Zoom
className?
- Type:string
ref?
- Type:Ref<HTMLUListElement>
- Description:
Allows getting a ref to the component instance. Once the component unmounts, React will set
ref.currenttonull(or call the ref withnullif you passed a callback ref). React Docs
Timeline.Zoom.Button
label
- Type:string
- Description:
e.g 3mnd, 6mnd etc
interval
- Type:"month" | "year"
- Description:
Zoom interval in months or years
count
- Type:number
- Description:
How many units of the interval that will be applied e.g interval="month" + count={3} equals 3 months
ref?
- Type:Ref<HTMLButtonElement>
- Description:
Allows getting a ref to the component instance. Once the component unmounts, React will set
ref.currenttonull(or call the ref withnullif you passed a callback ref). React Docs