Skip to the content

5C Husum Torv

Next stop: Nørreport St. ~08:16

Variants and states

Rest
Line

5C Husum Torv

Next stop: Nørreport St. ~08:16
Stop

Nørreport St.

Metro, S-tog and buses
  • Rest

    5C Husum Torv

    Next stop: Nørreport St. ~08:16

Props

NameTypeDefaultDescription
variant'line' | 'stop''line'What the panel shows: line heads a vehicle or a line with its line badge and destination; stop heads a stop or station with its marker and name. Set on the root as data-variant.
line'm1' | 'm2' | 'm3' | 'm4' | 'a' | 'b' | 'c' | 'e' | 'f' | 'h' | 'bus' | 'regional'—The line whose colours the mark takes, typed as LineBadge's and StationIcon's line. In line, the badge's colours, needed with lineName; in stop, the marker's colour, left out for a stop several lines serve.
lineNameReactNode—The line's short name as riders know it, "5C", "M2" or "A": the badge's label in line, also read first in the title. Not used in stop.
title*ReactNode—The panel's title: the destination in line ("Husum Torv"), the stop's name in stop ("Nørreport St."). Required. Replaces the HTML title attribute.
subheaderReactNode—One supporting line under the title, such as "Next stop: Nørreport St." or the lines a stop has.
actionReactNode—The panel's own controls at the end of the row, such as a "Show on map" button. The panel's close button is DetailPanel's, from the Sheet, and needs no place here.
slotProps{ mark?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | undefined; title?: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement> | undefined; subheader?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | undefined; action?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | undefined; }—Props for each part: mark, title, subheader, action.
variant'line' | 'stop', default 'line'
What the panel shows: line heads a vehicle or a line with its line badge and destination; stop heads a stop or station with its marker and name. Set on the root as data-variant.
line'm1' | 'm2' | 'm3' | 'm4' | 'a' | 'b' | 'c' | 'e' | 'f' | 'h' | 'bus' | 'regional', default —
The line whose colours the mark takes, typed as LineBadge's and StationIcon's line. In line, the badge's colours, needed with lineName; in stop, the marker's colour, left out for a stop several lines serve.
lineNameReactNode, default —
The line's short name as riders know it, "5C", "M2" or "A": the badge's label in line, also read first in the title. Not used in stop.
title (required)ReactNode, default —
The panel's title: the destination in line ("Husum Torv"), the stop's name in stop ("Nørreport St."). Required. Replaces the HTML title attribute.
subheaderReactNode, default —
One supporting line under the title, such as "Next stop: Nørreport St." or the lines a stop has.
actionReactNode, default —
The panel's own controls at the end of the row, such as a "Show on map" button. The panel's close button is DetailPanel's, from the Sheet, and needs no place here.
slotProps{ mark?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | undefined; title?: DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement> | undefined; subheader?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | undefined; action?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> | undefined; }, default —
Props for each part: mark, title, subheader, action.

Use it

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

Ask your agent

search_docs({ query: "DetailHeader" })

Keyboard and ARIA

DetailHeader has no keys of its own and is never focusable. The controls in action follow the title in the DOM and on screen, so Tab reaches them in reading order.

KeyDoesFrom
TabMoves to the first focusable element in action, after the titleThe browser
Shift+TabMoves back out of action, to whatever came before the headerThe browser
ElementRoleAccessible name fromStates announced
rootNone (generic div)NoneNone
markHidden: aria-hidden="true"None: the title says the line in wordsNone
titleHeading, level 2Its text: in line, the hidden lineName then title, as "5C Husum Torv"; in stop, titleNone
subheaderNone (generic div)NoneNone
actionNone (generic div); the caller's controls carry their own rolesThe caller's controls' own namesTheirs
  • The title is always an h2, with an id the caller can set through slotProps.title (React's useId otherwise), so DetailPanel can name its Sheet with aria-labelledby pointing at it: the header heads one panel over a page whose own heading is the h1, and with no render a pattern can't swap the level.
  • In the line variant the mark is aria-hidden and the title starts with lineName in a VisuallyHidden span and a space, so the heading, and the panel name taken from it, reads "5C Husum Torv" rather than "Husum Torv" with the badge read apart before it: a screen reader moving by headings, and the panel's name, then carry the line, and the badge is read once.

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 badge's line name is read in the title (CR-4), and the StationIcon is decorative beside the stop's name, which the title says; the line's colour is never the only sign of the line.
  • Every landmark and named region has an accessible name: none here, the root is not a landmark; the title's id lets DetailPanel name its panel from the heading (CR-5).
  • Every default label can be overridden: none here; DetailHeader owns no string.
  • Every shape the type accepts renders, in every variant: title, lineName, subheader and action each render a string, an element and a list alike; subheader and action are divs, so block content is valid there, and the title takes phrasing content as an h2 does.
  • A hidden copy kept for animation is aria-hidden, and a collapsed region is inert: none here; nothing animates or collapses. The mark is aria-hidden because the title repeats it, not for animation.
  • Native semantics first: an h2 for the title, plain divs for the rest, and the caller's own button or a href in the action; no ARIA but aria-hidden on the mark.
  • Focus moves in reading order and returns on close: the action follows the title and subheader in the DOM and on screen; DetailHeader never moves focus, and the Sheet around it returns focus on close.
  • Every target is at least size.target-min square: DetailHeader has no target of its own; the action's controls keep their own sizes, size.control for an icon button.
  • Loops stop when the system asks for less motion: none here; nothing moves.

Owned strings

No owned strings: every word DetailHeader shows or announces comes from the caller, through lineName, title, subheader and action, and the panel's close label belongs to the Sheet's close button, which DetailPanel sets after the header, not in action.

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-1shouldGive the destination as title and the line's short name as lineName: "Husum Torv" with "5C"Put the line in the title as well, "5C Husum Torv": the header already reads the line first, so it would be said twicereview
DD-2mustLeave line off in stop for a station several lines serve, and name its lines in subheaderPick one line's colour for a shared station, which tells the eye only one line stops therereview
DD-3shouldKeep subheader to one plain line that says no more than the data knows: "Next stop: Nørreport St."Put a list of departures or delays in subheader; they belong in the panel's bodyreview
DD-4mustPut at most one of the panel's own controls in action, such as "Show on map"Put a close button in action, which DetailPanel draws from the Sheet after the header; or add a brand action there when the panel already has its main actionreview
DD-5mustUse one DetailHeader at the top of a detail panel, and name the panel from its title's idUse it to head a section inside a panel: its title is always an h2review
DD-6shouldLet the panel set the surface and padding around itGive it a fill or a border with className; it would draw a card inside the panelreview