Skip to content
Alpha

Hololink UI is under active development. Components, APIs and these docs may change without notice.

Holo Grid

The holo-grid is a layout component designed to arrange children in a clean CSS grid. It features configurable column counts and gap sizes based on the design system’s spacing tokens, and by default collapses to a single column below 768px wide. For layouts that adapt to the space available instead, use fluid columns.

Use it for:

  • Laying out equal-width columns of cards or tiles with a consistent gap (cols, gap, min-item-width).
  • Dashboards and galleries where items share a visual weight.

Don’t use it for:

  • A single column or row of items. Use Stack.
  • Tabular data with rows and columns of related values. Use Table.
  • Constraining page width. Use Container.

Below is an interactive live preview of a 3-column layout featuring standard cards.

Vector Grid

A multi-dimensional geometric matrix designed for high-throughput spatial analysis.

Quantum Array

Dynamic quantum entanglement coordinates mapped onto a sub-atomic grid layout.

Holographic Core

Centralized optical beam emitter generating synthetic voxel architectures.

<holo-grid cols="3" gap="md">
<div>Vector Grid</div>
<div>Quantum Array</div>
<div>Holographic Core</div>
</holo-grid>

You can also specify lower or higher column counts, alongside larger or smaller gap spacings:

Flux Capacitor

Regulates electromagnetic flow across temporal interfaces inside the grid.

Chronal Engine

Synchronizes state updates with local spacetime frames of reference.

<holo-grid cols="2" gap="lg">
<div>Flux Capacitor</div>
<div>Chronal Engine</div>
</holo-grid>

Set min-item-width to a CSS length and the grid fits as many columns as its own width allows, from 1 up to cols. It ignores the viewport width, so it also adapts inside a narrow sidebar or on a phone. In fluid mode cols is the maximum number of columns, not a fixed count.

Vector Grid

Quantum Array

Holographic Core

Flux Capacitor

<!-- 2 columns on a 360px phone, 4 columns once the grid is about 620px wide -->
<holo-grid cols="4" min-item-width="9rem">
<div>Vector Grid</div>
<div>Quantum Array</div>
<div>Holographic Core</div>
<div>Flux Capacitor</div>
</holo-grid>

Choosing a min-item-width:

  • Use rem so columns drop out as people increase their text size.
  • Pick the narrowest width at which your item content still reads well. Values below about 8rem can squeeze content at 320px wide.
  • Items never exceed the grid’s width, so there is no horizontal scrolling.
  • Always include a CSS unit (9rem, not 9). A unitless or invalid value (for example banana) disables the column template, so content is no longer kept to the grid’s width.

By default the grid is a presentational CSS layout. It renders a slot with no role, no landmark and no focus behaviour, and it does not change the reading order. Screen readers and keyboard users move through children in DOM order.

If the items are really a list (a gallery of cards, a set of results), tell assistive technology so, which lets screen readers announce “list, 6 items”. Pick the first option that fits:

  1. A native <ul> with your own CSS grid. The most native answer, if you own the CSS. You give up the grid’s gap tokens and responsive behaviour.
  2. <holo-grid list> when you want the grid’s token-based layout. Described below.
  3. List for a vertical, styled list.

Set list and the host gets role="list". Each element child that has no role of its own gets role="listitem", plus a data-holo-grid-item attribute that marks it as managed by the grid. Children added or removed later are kept in sync.

<holo-grid list cols="3">
<div>Vector Grid</div>
<div>Quantum Array</div>
<div>Holographic Core</div>
</holo-grid>
  • Only element children can be list items. Wrap loose text in an element.
  • style, script, template, link and meta children are skipped.
  • A child that has, or once rendered gets, a role of its own is left alone. This covers holo-list-item and components such as holo-alert and holo-spinner that keep their alert or status role. The grid waits for registered custom elements to render before deciding. A hyphenated tag that is not registered, such as an Angular component host, is marked straight away; if it registers later and renders its own role, the grid hands it back.
  • A non-Stencil element (vanilla, Lit, FAST) that sets its own role in its constructor or connectedCallback is only handled if it is registered before the grid marks it. Register such components first, or give them an explicit role in markup.
  • A child with its own role other than listitem makes the list invalid (a list may only contain list items). Wrap such content in a <div> so the wrapper is the list item.
  • A display: contents wrapper becomes the single list item; its children are not separate items.
  • A role you set on the grid itself is not removed. To keep your own role="list" through toggling list, set it before enabling list or before the grid connects; a role="list" written after the grid wrote its own is treated as the grid’s. If the role is anything other than list (including none and presentation), the grid does not mark its children, since they would have no list parent.
  • Do not remove role or data-holo-grid-item from children yourself; the grid owns them. If a framework manages role on the same child, give the child its own role instead.
  • Links and buttons inside items keep their own semantics and keyboard behaviour. Items are not focusable.
  • Do not use list for grids of form controls or toolbars. Those need their own patterns.
  • Without list, the grid writes no attributes. You can still add role="list" and role="listitem" yourself.

Put the inner holo-grid list inside a wrapper element, which becomes the outer list item. A nested grid placed directly in another list grid keeps its own list role and is not marked as an item, which leaves the outer list invalid. Direct nesting is unsupported, including toggling the inner grid’s list off at runtime: the outer grid does not re-mark it. A Stencil app that compiles this library in development mode also logs a console warning for a direct child with role="list"; the published bundles do not.

<holo-grid list cols="2">
<div>
Group A
<holo-grid list cols="2">
<div>One</div>
<div>Two</div>
</holo-grid>
</div>
<div>Group B</div>
</holo-grid>

You provide:

  • A DOM order that matches the visual order you want people to read and tab through.
  • Real structure for what the grid holds, such as headings, lists or cards. Do not use it to present tabular data.

Importing

import '@philbob/hololink-ui/holo-grid';

Properties

PropertyAttributeTypeDefaultDescription
colscolsnumber3The number of columns at 768px and wider. In fluid mode (min-item-width set), the maximum number of columns.
gapgap"lg" | "md" | "sm"'md'The gap size between grid items: "sm" (--s-space-xs, 8px), "md" (--s-space-md, 16px), or "lg" (--s-space-xl, 32px).
listlistbooleanfalseExposes the grid as a list: the host gets role="list" and each element child without a role of its own gets role="listitem" (and a data-holo-grid-item attribute that marks it as managed by the grid). Children are kept in sync as they are added and removed. Skipped: style, script, template, link and meta children, and any child that has or gets a role of its own once it has rendered (a registered custom element is waited for first), such as holo-list-item, holo-alert or a nested holo-grid list. A hyphenated tag that is not registered (an Angular component host, say) is marked straight away, and handed back to the component if it registers later. A child with its own role other than listitem makes the list invalid, so give such content a listitem wrapper. To nest a list, wrap the inner holo-grid list in a <div>. A display: contents wrapper becomes one item itself; its children are not separate items. Only element children can be list items, so wrap loose text. A non-Stencil element (vanilla, Lit, FAST) that sets its own role in its constructor or connectedCallback is only handled if it is registered before the grid marks it. Register such components first, or give them an explicit role in markup. A role you set on the grid is not removed. To keep your own role="list" through toggling list, set it before enabling list or before the grid connects; one written after the grid wrote its own is treated as the grid's. If the role is anything other than list (including none and presentation), the grid does not mark its children, because they would have no list parent.
minItemWidthmin-item-widthstring | undefined—Turns on fluid mode: any CSS length for the minimum width of an item, such as 9rem. The grid fits as many columns as its own width allows, never more than cols and never fewer than 1. Prefer rem so columns drop out as text size increases. The value must include a CSS unit (9rem, not 9); a unitless or otherwise invalid value disables the column template.

Slots

SlotDescription
(default)The items to place in the grid.

CSS custom properties

PropertyDescription
--holo-grid-min-item-widthMinimum item width in fluid mode, set from the min-item-width prop.