Skip to the content

Could not load the data

The map still shows the last reports. Try again in a minute.

Props

NameTypeDefaultDescription
status'ready' | 'loading' | 'empty' | 'error''ready'Where the data view's data stands: ready shows children; loading says "Loading" while there is no data yet; empty says the data came back with nothing in it; error says it could not be loaded. Not a vehicle dot data state
childrenReactNode—The data view itself, such as a table or a chart, shown only while status is 'ready'
descriptionReactNode—The sentence under the message in the empty and error statuses: why, and what to try. "Try again in a minute." Not shown while loading or ready
actionReactNode—What the person can do about it in the empty and error statuses, such as a button that loads the data again, below the sentence. Not shown while loading or ready
loadingLabelstringThe locale'sOverrides "Loading", the message while status is 'loading'
noDataLabelstringThe locale'sOverrides "No data to show", the message while status is 'empty'. Give it what is missing when the caller knows: "No vehicles on line 5C right now"
loadFailedLabelstringThe locale'sOverrides "Could not load the data", the message while status is 'error'
classNamestring—Joined after pn-DataStatePanel on the root
styleCSSProperties—Reaches the root
refRef<HTMLDivElement>—Reaches the root element
slotProps{ message?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | undefined; emptyState?: Omit<EmptyStateProps, "action" | "children" | "title"> | undefined; }—Props for each part: message, emptyState.
status'ready' | 'loading' | 'empty' | 'error', default 'ready'
Where the data view's data stands: ready shows children; loading says "Loading" while there is no data yet; empty says the data came back with nothing in it; error says it could not be loaded. Not a vehicle dot data state
childrenReactNode, default —
The data view itself, such as a table or a chart, shown only while status is 'ready'
descriptionReactNode, default —
The sentence under the message in the empty and error statuses: why, and what to try. "Try again in a minute." Not shown while loading or ready
actionReactNode, default —
What the person can do about it in the empty and error statuses, such as a button that loads the data again, below the sentence. Not shown while loading or ready
loadingLabelstring, default The locale's
Overrides "Loading", the message while status is 'loading'
noDataLabelstring, default The locale's
Overrides "No data to show", the message while status is 'empty'. Give it what is missing when the caller knows: "No vehicles on line 5C right now"
loadFailedLabelstring, default The locale's
Overrides "Could not load the data", the message while status is 'error'
classNamestring, default —
Joined after pn-DataStatePanel on the root
styleCSSProperties, default —
Reaches the root
refRef<HTMLDivElement>, default —
Reaches the root element
slotProps{ message?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | undefined; emptyState?: Omit<EmptyStateProps, "action" | "children" | "title"> | undefined; }, default —
Props for each part: message, emptyState.

Use it

import { DataStatePanel } from '@mylder/perron/patterns'

Ask your agent

search_docs({ query: "DataStatePanel" })

Keyboard and ARIA

DataStatePanel has no keys of its own. The action in the empty and error statuses, and the caller's content once ready, are reached in reading order.

KeyDoesFrom
TabMoves to the first focusable element in the action, or in children once readyThe browser
Shift+TabMoves back out, to whatever came before the DataStatePanelThe browser
ElementRoleAccessible name fromStates announced
rootNone (generic div)NoneNone
messagestatus, a polite live regionNone: a status region needs none, and its text is what it announcesIts text whenever it changes: "Loading", the empty or error title with the sentence, nothing when ready
emptyStateEmptyState's: a paragraph title, the sentence, the caller's controlsIts title's text, from the status's owned stringNone of its own

The root takes no aria-busy while loading. Screen readers may hold back a busy element's live regions until it is no longer busy, which would silence "Loading", and nothing inside the root is half-built while it loads: the content is not rendered at all.

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: the message is the visible title, sentence and action, read in place and announced through the message part's role="status"; a caller's icon is aria-hidden inside EmptyState and the title says what it shows.
  • Every landmark and named region has an accessible name: none here; the root is not a landmark, and a status region takes no name.
  • Every default label can be overridden: loadingLabel, noDataLabel and loadFailedLabel.
  • Every shape the type accepts renders, in every variant: children, description and action each render a string, an element and an array; description and action land in EmptyState's div parts, so block content is valid in them.
  • A hidden copy kept for animation is aria-hidden, and a collapsed region is inert: none here; a status not shown is not rendered at all, so nothing hidden stays in the tree.
  • Native semantics first: plain divs and EmptyState's p title; role="status" only on the message part, where no element says it; the action holds the caller's own button or a href.
  • Focus moves in reading order and returns on close: the message comes before the content in the DOM, the action after the sentence; when a change of status removes the element that had focus inside the message, focus moves to the message part (CR-6), never to the page's top.
  • Every target is at least size.target-min square: DataStatePanel has no target of its own; the action's targets are the caller's components, which keep their own sizes.
  • Loops stop when the system asks for less motion: none here; nothing moves.

Owned strings

Each status but ready shows one string of its own as the EmptyState's title. loading is in packages/perron/src/locale/en.ts already; noData and loadFailed are new keys, and agents write their Danish, Swedish and Norwegian.

KeyEnglishOverrideSeen or heard where
loadingLoadingloadingLabelThe emptyState part's title while status is 'loading', announced by the message part
noDataNo data to shownoDataLabelThe emptyState part's title while status is 'empty', announced by the message part
loadFailedCould not load the dataloadFailedLabelThe emptyState part's title while status is 'error', announced by the message part

The empty status's owned string is noData, "No data to show", with noDataLabel for the caller to name what is missing. It says only what the panel knows, that the data came back with nothing in it, without claiming why; a caller that knows says more through noDataLabel or description. The error status's owned string is a new key, loadFailed, "Could not load the data", not "Data feed problems". "Data feed problems" is the fixed name of a kind of disruption on a line, which content design keeps for that alone; a panel whose request failed may have lost the network, not the feed, and "Could not load the data" says only what happened.

Do and don't

For a caller using the pattern, 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-1mustKeep status 'ready' while fresh data replaces data already shown, and use 'loading' only while there is nothing to show yetFlip to 'loading' on every refresh: the table blinks out every few seconds and the status region reads "Loading" each timereview
DD-2shouldName what is missing through noDataLabel when the view knows: "No vehicles on line 5C right now"Write "No data" when the view knows what kind: content design asks to say what is happening, plainlyreview
DD-3mustGive the error status one neutral action that loads the data again, such as "Try again"Add a brand action when the panel already has one: a screen has one brand action at mostreview
DD-4mustShow a vehicle that has gone silent as 'ready' content, with its vehicle dot state and the words "No signal"Use 'error' or 'empty' for a vehicle's data state: status is about the view's data request, and the data-state words have their own componentsreview
DD-5shouldUse plain EmptyState for a list that is empty for a reason the screen already knows, such as a search with no matchesWrap a list in DataStatePanel only to show an empty message: it is for views whose data loads, and its status region would announce a state nothing changedreview
DD-6mustLet the message part announce the change, and put the view's own live updates, if any, in the viewAdd role="status" or aria-live to children or the root: the table's every refresh would be read out, on top of the messagereview