Skip to content

Grid track constructors

Read as Markdown

Build fixed, repeated, auto-fill, and auto-fit grid track definitions.

Plain source. This example demonstrates a type-level or host-specific contract; it is checked with TypeScript rather than presented as an animated preview.

import {
autoFillTracks,
autoFitTracks,
minmax,
repeatTracks,
type GridMinMaxTrack,
type GridRepeatTrack,
type GridTrack,
type GridTrackBreadth,
} from "@pibbl/core";
const breadth: GridTrackBreadth = "1fr";
const bounded: GridMinMaxTrack = minmax({ min: 72, max: breadth });
const repeated: GridRepeatTrack = repeatTracks([bounded], { count: 2 });
const fill: GridRepeatTrack = autoFillTracks(96);
const fit: GridRepeatTrack = autoFitTracks(96);
const tracks: readonly GridTrack[] = [repeated, fill, fit];
const output = document.createElement("pre");
output.textContent = JSON.stringify(tracks, null, 2);
document.body.append(output);
  • Displays immutable track definitions in the document.

Documentation built with @pibbl/core 0.0.2, revision a1dcf8e. ALPHA — NOT FOR PRODUCTION USE.