diff --git a/configurator/src/components/panels/LayoutPanel.svelte b/configurator/src/components/panels/LayoutPanel.svelte index 238c2664..94cfd1a0 100644 --- a/configurator/src/components/panels/LayoutPanel.svelte +++ b/configurator/src/components/panels/LayoutPanel.svelte @@ -31,6 +31,7 @@ let centerMax = $derived(parseRem(overrides["--sf-center-max"], 75)); let centerGutter = $derived(parseRem(overrides["--sf-center-gutter"], 1)); let gridMin = $derived(parseRem(overrides["--sf-grid-min"], 16)); + let gridGap = $derived(parseRem(overrides["--sf-grid-gap"], 1)); let headerMobile = $derived(parseRem(overrides["--sf-header-height-mobile"], 3.5)); let headerDesktop = $derived(parseRem(overrides["--sf-header-height-desktop"], 5)); let sidebarWidth = $derived(parseRem(overrides["--sf-sidebar-width"], 18)); @@ -212,6 +213,22 @@ {showAutoGrid ? "▲" : "▼"} {#if showAutoGrid} + + onSet("--sf-grid-gap", `${v}rem`)} + onReset={() => onReset("--sf-grid-gap")} + rawDefault="var(--sf-gap)" + variableOptions={SPACE_SCALE} + currentRaw={overrides["--sf-grid-gap"]} + onRawSet={(v) => onSet("--sf-grid-gap", v)} + />
Preview at 360px panel width
{#each Array.from({ length: 8 }) as _, i (i)}
col
diff --git a/docs/layout.md b/docs/layout.md index 75126ec8..ab332a87 100644 --- a/docs/layout.md +++ b/docs/layout.md @@ -112,3 +112,35 @@ Override a single instance without new CSS: ```html
``` + +## Responsive gaps + +Gaps are already fluid: `--sf-grid-gap` defaults to `--sf-gap`, which interpolates +between its mobile and desktop ends via the shared space scale. Retune the whole +rhythm at once with the space-scale endpoints (`--sf-space-base-min` / +`--sf-space-base-max`) rather than per-token knobs. + +When one primitive needs a **different** gap on small vs large screens, override +its scoped token inside a `@container` query — the same container-driven model the +primitives themselves use, so the gap reacts to the same width that collapses the +columns. Endpoints stay live tokens, so they still follow any scale retuning: + +```css +.product-grid { --sf-grid-gap: var(--sf-space-l); } + +@container (min-width: 48rem) { + .product-grid { --sf-grid-gap: var(--sf-space-xl); } +} +``` + +```html +
+
+
+``` + +The override needs a container ancestor (`.sf-container` or `.sf-cq`) — the same +requirement as `.sf-grid-cols-*`. The gap steps at the breakpoint rather than +interpolating across it; for a gap that single step is imperceptible in normal use. +The same pattern works for any scoped gap token (`--sf-gap`, `--sf-content-gap`, +`--sf-gutter`, `--sf-cluster-gap`, …).