Skip to the content

Props

NameTypeDefaultDescription
liveLabelstringThe locale'sOverrides "Live", the word shown beside the live dot
ageingLabelstringThe locale'sOverrides "Ageing", the word shown beside the ageing dot
estimatedLabelstringThe locale'sOverrides "Estimated", the word shown beside the estimated dot
timetableOnlyLabelstringThe locale'sOverrides "Timetable only", the word shown beside the timetable-only dot
noSignalLabelstringThe locale'sOverrides "No signal", the word shown beside the no-signal dot
aircraftVisiblebooleanfalseAdds the aircraft, the aircraft glyph beside "Planes", after the five states, for a map that shows aircraft
aircraftLabelstringThe locale'sOverrides "Planes", the word shown beside the aircraft glyph when aircraftVisible is set
classNamestring—Merged after pn-VehicleDotLegend on the root
styleCSSProperties—Reaches the root
refRef<HTMLUListElement>—Reaches the root
liveLabelstring, default The locale's
Overrides "Live", the word shown beside the live dot
ageingLabelstring, default The locale's
Overrides "Ageing", the word shown beside the ageing dot
estimatedLabelstring, default The locale's
Overrides "Estimated", the word shown beside the estimated dot
timetableOnlyLabelstring, default The locale's
Overrides "Timetable only", the word shown beside the timetable-only dot
noSignalLabelstring, default The locale's
Overrides "No signal", the word shown beside the no-signal dot
aircraftVisibleboolean, default false
Adds the aircraft, the aircraft glyph beside "Planes", after the five states, for a map that shows aircraft
aircraftLabelstring, default The locale's
Overrides "Planes", the word shown beside the aircraft glyph when aircraftVisible is set
classNamestring, default —
Merged after pn-VehicleDotLegend on the root
styleCSSProperties, default —
Reaches the root
refRef<HTMLUListElement>, default —
Reaches the root

Use it

import { VehicleDotLegend } from '@mylder/perron'

Ask your agent

search_docs({ query: "VehicleDotLegend" })

Keyboard and ARIA

No Base UI part, so nothing from Base UI here: the legend takes no focus and does nothing when pressed.

KeyDoesFrom
TabPasses the legend by to the next focusable element: it has no tab stop (CR-4)Perron
ElementRoleAccessible name fromStates announced
rootlist, from the native <ul>None of its own; the caller's aria-label or aria-labelledby when it gives one (CR-7)Its number of items, from the <ul>
itemlistitem, from the native <li>Its text: the label's wordnone
dothidden: VehicleDot's img, with aria-hidden="true" passednone: the word beside it names the state, so the ear hears it once (VehicleDot's CR-6)none
aircrafthidden: an <svg> with aria-hidden="true" and focusable="false"none: the word beside it, "Planes", names itnone
labeltextThe owned string for its state, or the caller's *Labelnone

What axe won't catch, from the contract, each with how this component meets it:

  • Everything the eye is told, the ear is told, for every shape each prop accepts: each dot's state is told to the ear by the word beside it, which the eye reads too; the dot's shape is what the legend teaches the eye, and the ear, which never meets the shapes, gets the five words in the same order.
  • Every landmark and named region has an accessible name: none here; the legend is a list, not a landmark or region, and a caller where it stands alone names it with aria-label or aria-labelledby (CR-7).
  • Every default label can be overridden: liveLabel, ageingLabel, estimatedLabel, timetableOnlyLabel, noSignalLabel and aircraftLabel.
  • Every shape the type accepts renders, in every variant: the legend takes no ReactNode; every *Label string replaces only its own item's word, an undefined one keeps the locale's, the Default, Narrow and ForcedColours stories render all five items, and the Aircraft story the sixth after them.
  • A hidden copy kept for animation is aria-hidden, and a collapsed region is inert: none here; nothing animates or collapses. The dots are aria-hidden because their words speak for them, not for animation.
  • Native semantics first: a <ul> of <li>s, each with a hidden VehicleDot and a <span> of text; no ARIA beyond the dots' aria-hidden.
  • Focus moves in reading order and returns on close: the legend takes no focus and opens nothing; Tab passes it by.
  • Every target is at least size.target-min square: no target; the legend is not pressed.
  • Loops stop when the system asks for less motion: none here; the legend has no motion.

Owned strings

Every word the legend shows is its own; the caller gives none. The five states' keys exist in packages/perron/src/locale/en.ts, held to the table in Content design, and VehicleDot already uses them. The legend adds one, aircraft, "Planes": the plural a visitor says for what they see overhead, where the code and the glossary say aircraft.

KeyEnglishOverrideSeen or heard where
liveLiveliveLabelThe first item's label, seen and read as shown
ageingAgeingageingLabelThe second item's label, seen and read as shown
estimatedEstimatedestimatedLabelThe third item's label, seen and read as shown
timetableOnlyTimetable onlytimetableOnlyLabelThe fourth item's label, seen and read as shown
noSignalNo signalnoSignalLabelThe fifth item's label, seen and read as shown
aircraftPlanesaircraftLabelThe sixth item's label, with aircraftVisible

Do and don't

For a caller using the component, with the reason. Each row is a rule: a must row's Don't is never right, a should row's needs a reason, and Checked by says what catches the Don't in a caller's code.

RuleLevelDoDon'tChecked by
DD-1shouldShow the legend wherever vehicle dots appear without their words, such as at the bottom centre of the mapBuild a legend of your own from VehicleDots and words: it drifts from the five states' order and wordsreview
DD-2mustKeep all five states, even when no vehicle on screen is in oneHide a state with className or CSS because no vehicle has it: Data states asks for all fivereview
DD-3shouldSet aircraftVisible while the map draws aircraft, and leave it off when the screen hides themDraw a plane of your own beside the legend: it drifts from the glyph the map drawsreview
DD-4shouldPut the legend on a glass Surface over the map, or straight on a panel's surfaceExpect the legend to bring its own glass, place itself or stack itself over the mapreview
DD-5mustName the list with aria-label or aria-labelledby where it stands alone, as on the mapPass aria-hidden to the legend: the eye reads its words, so the ear gets them tooreview
DD-6mustKeep render on the root to another list element, <ol> or a component that renders oneSwap the root for a <div> through render: its <li>s would sit outside a list, which HTML and axe both failreview
DD-7mustOverride a word with its *Label prop when a screen's copy needs it, and the same prop on the screen's VehicleDotsChange one word on the legend and leave the dots' names, so the eye and the ear are told two names for one statereview
DD-8mustExplain beside the legend what each state means, where a panel does, in the app's own figures from its thresholdsWrite the defaults as fixed facts, such as "Live: under a minute old": an app with a slower feed sets its own live threshold, and the words would disagree with its dotsreview