Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

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…

Read the release notes

Table Responsive Examples

Responsive table layouts that adapt to narrow viewports using container queries and card-based layouts.

Responsive Card Layout

When the table container is narrower than 500px, each row transforms into a card with labeled fields. Uses data-responsive="card" on the table; each cell's label comes from data-label or, when that is missing, from its column header.

Resize your browser window to see the table transform into cards at narrow widths.

Team directory
Name Email Role Status
Alice Chen [email protected] Senior Engineer Active
Bob Martinez [email protected] Marketing Lead Active
Carol Johnson [email protected] Sales Manager On Leave
David Kim [email protected] Developer Active
Emma Wilson [email protected] UX Designer Active

Card Layout Preview

This container is constrained to 400px width to demonstrate the card layout without resizing.

Container width: 400px

Accessories in stock (labels derived from the headers)
Product Price Stock
Wireless Keyboard $79.99 42 units
USB-C Hub $49.99 128 units
Monitor Stand $119.99 15 units
Webcam HD $89.99 67 units

How It Works

HTML Structure

Add data-responsive="card" to the table. Card labels come from the column headers; add data-label to a <td> only to override one:

<data-table>
  <table data-responsive="card">
    <caption>Team directory</caption>
    <thead>
      <tr>
        <th scope="col">Name</th>
        <th scope="col">Email</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Alice Chen</td>
        <td data-label="Contact">[email protected]</td>
      </tr>
    </tbody>
  </table>
</data-table>

Container Query Behavior

The data-table element uses container-type: inline-size to enable container queries (VB sections and articles do too, so a plain table works the same way). When the container is narrower than 500px:

Benefits

Progressive Enhancement
The card layout is pure CSS and works without JavaScript; the script only adds roles and missing labels.
Container-Based
Responds to the container width, not viewport. Works in sidebars, modals, and constrained layouts.
Accessible
Column headers stay available to screen readers and the table, row and cell roles are restored explicitly, so table navigation still works in card mode. Without JavaScript, browsers that drop table roles on re-displayed rows (notably Safari) will read the cards as plain text.
↑