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 th element defines a header cell in a table. Vanilla Breeze styles headers with a raised background and semi-bold weight. Always use scope for accessibility. Supports sort indicators and numeric alignment via data attributes.
Description
The <th> (table header) element defines a cell that acts as a header for a group of table cells. Headers can apply to columns, rows, or groups of either.
Vanilla Breeze gives every header cell a semi-bold font weight (600). Column headers (in <thead>, or with scope="col" / scope="colgroup") also get a raised background (var(--color-surface-raised)) and a thicker bottom border (var(--border-width-medium)). Row headers (<th scope="row"> in <tbody>) keep the data-cell look, a transparent background and a thin rule, so row hover, stripe and selection tints run across the whole row.
Row headers: First cell of data rows with scope="row"
Group headers: Headers spanning multiple columns/rows with scope="colgroup" or scope="rowgroup"
When to Use td Instead
Data cells: Cells containing actual data values
Summary cells: Totals in <tfoot> (though the label cell may be <th>)
The scope Attribute
The scopeattribute is essential for accessibility. It tells assistive technologies which cells the header applies to. Always include it.
Value
Description
Use Case
col
Header applies to all cells in the column
Column headers in <thead>
row
Header applies to all cells in the row
Row headers in first cell of <tbody> rows
colgroup
Header applies to multiple columns
Group headers used with colspan
rowgroup
Header applies to multiple rows
Section headers spanning all columns
Examples
Column and Row Headers
This example shows both scope="col" for column headers and scope="row" for row headers. Screen readers use these to announce context when navigating cells.
Use scope="colgroup" with colspan for headers that span multiple columns, commonly seen in multi-level header rows. Pair it with real <colgroup span> elements so the group the header covers is defined in the markup.
Either way the behaviour follows the APG sortable table: the <th> keeps its columnheader role and carries aria-sort, and the script wraps the header text in a native <button data-sort-button> that takes focus and Enter/Space. VB styles that button to read as header text with a focus ring, and draws the direction glyph (⇅, ↑, ↓) from aria-sort, so the visual and accessible state cannot drift.
A bare <th data-sort> without either enhancement has no behaviour, so VB draws no sort affordance on it. On a server-sorted static table you can still mark the sorted column with aria-sort="ascending" or "descending"; VB shows the matching arrow.
Use data-numeric on header cells for numeric columns. This aligns the header text to the inline end (right in left-to-right text, left in right-to-left) and applies font-variant-numeric: tabular-nums for proper digit alignment.
Always use scope: The scopeattribute is essential for screen readers to associate headers with data cells
Screen reader announcement: When navigating to a data cell, the associated headers are announced
Complex tables: For tables with multiple header levels, consider using the headersattribute on <td> elements
Implicit roles:<th> has an implicit ARIA role of columnheader (with scope="col") or rowheader (with scope="row")
Sort state: When a column is sorted, use aria-sort="ascending" or aria-sort="descending" on the <th>. Never give the <th> itself role="button": that replaces the columnheader role, aria-sort is then ignored, and the column's cells lose their header. Put a <button> inside the header instead.