0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…
The tr element defines a row of cells in a table. Vanilla Breeze adds data attributes for row states like selection, highlighting, and expandable detail rows.
Description
The <tr> (table row) element is a container for a horizontal group of cells. Each row must contain at least one <th> or <td> element, and all rows in a table should have the same number of cells (accounting for colspan).
Vanilla Breeze applies hover effects to rows within <tbody> and provides data attributes for common row states: selection, highlighting, disabling, and expandable detail rows.
When to Use
Every table row: All rows of data, headers, and footers require tr elements
Grouping cells: Each horizontal set of related data goes in one row
Header rows: In <thead>, rows typically contain <th> elements
Data rows: In <tbody>, rows typically contain <td> elements (with optional <th scope="row">)
Examples
Basic Table Rows
Rows contain cells that align with the table's column structure. Hover over rows to see the built-in highlight effect.
Vanilla Breeze provides data attributes for common row states. Selected and highlighted rows get a tint and a bar on the row's inline-start edge, so the state is not carried by colour alone; in forced-colors mode they switch to system colours (Highlight, Mark) with a real border. The attributes are visual only. They add no semantics, so pair each state with visible text or a control, as the demo's Status column does.
Row state attributes
12345678910111213141516171819202122
<tbody><!-- Selected row: say so in text (or a checked checkbox) too --><trdata-selected><td>Alice Johnson</td><td>Developer</td><td>New York</td></tr><!-- Highlighted row --><trdata-highlight><td>Bob Smith</td><td>Designer</td><td>San Francisco</td></tr><!-- Disabled row: data-disabled mutes it, inert disables it --><trdata-disabledinert><td>Carol Williams</td><td><ahref="/people/carol">Profile</a></td><td>Chicago (disabled)</td></tr></tbody>
Row Hover Effect
Rows in <tbody> receive a hover effect automatically to help users track data across columns. This is applied by default in Vanilla Breeze and requires no additional attributes.
In an authored table, mark the selected row with data-selected. <data-table> manages selection itself: rows with data-selectable get a checkbox, and the component writes data-state-selected on the selected rows. VB styles both attributes identically, so the two can be mixed. The checkbox (or visible "Selected" text in a static table) is the accessible cue; aria-selected is not valid on plain table rows.
Selected rows
1234567891011121314
<!-- Static table: you write the state --><tbody><tr><td>Row 1</td><tddata-numeric>$49.99</td></tr><trdata-selected><td>Row 2 (selected)</td><tddata-numeric>$29.99</td></tr></tbody><!-- Inside <data-table>: the component writes the state --><trdata-selectabledata-state-selected>…</tr>
Disabled Rows
data-disabled only changes the look: the row's text switches to the muted text colour (not reduced opacity, which would drop below AA contrast). To actually disable the row, add the native inertattribute as well. It takes every link and button in the row out of the tab order, blocks pointer input, and hides the row's controls from assistive technology. VB styles tr[inert] the same as tr[data-disabled].
Expandable rows are a <data-table> feature. Put data-expandable on the trigger row with a toggle button (data-action="toggle-expand", with an accessible name), and follow it with a detail row marked data-expand-content and hidden. When the user expands it, the component puts data-state-expanded on the trigger row, removes hidden from the detail row, and keeps aria-expanded on the button in sync. The detail row usually spans all columns with colspan; VB pads whatever element you put inside its cell.
Expandable detail rows
1234567891011121314151617181920212223
<data-table><table><caption>Orders</caption><thead><tr><thscope="col">Order</th><thscope="col"data-numeric>Total</th><thscope="col">Status</th></tr></thead><tbody><trdata-expandable><td><buttontype="button"data-action="toggle-expand"aria-label="Details for order #1024">▸</button> Order #1024</td><tddata-numeric>$149.99</td><td>Shipped</td></tr><trdata-expand-contenthidden><tdcolspan="3"><p>Tracking: 1Z999AA10123456784</p></td></tr></tbody></table></data-table>
Consistent cell count: All rows should have the same number of cells (accounting for colspan)
Row headers: Use <th scope="row"> when the first cell identifies the row
Screen reader navigation: Users can navigate row by row through table data
Implicit role:<tr> has an implicit ARIA role of row
Disabled rows:data-disabled is visual only. Add inert so the row's controls can't be reached by keyboard or pointer
Selected and highlighted rows: the attributes carry no semantics and aria-selected is not valid on a plain table row. State it in the row itself: a checked checkbox (as <data-table> does) or visible text such as "Selected"
Not colour alone: selected and highlighted rows show an inline-start bar as well as a tint, and use system colours in forced-colors mode