Grid
Grid exposes responsive breakpoint information for adaptive layouts.
@duskmoon-dev/components/grid Usage
When to use
- Use it to build predictable page, toolbar, panel, or grid structure.
- Keep layout primitives responsible for geometry and let child components own behavior.
Implementation notes
Features
Documents spacing, responsive behavior, and nested regions used to build larger screens.
Examples keep predictable dimensions so the surrounding UI does not jump while content changes.
Exports hook helpers on the Grid object
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Basic usage
Import the component stylesheet and Grid from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { Grid } from "@duskmoon-dev/components/grid";
export function Example() {
return (<Grid>DuskMoon Grid</Grid>);
} Exports hook helpers on the Grid object
test-backedGrid scenario from the component test coverage: exports hook helpers on the grid object.
import "@duskmoon-dev/components/styles.css";
import { Grid } from "@duskmoon-dev/components/grid";
export function GridExportsHookHelpersOnDemo() {
return (<Grid>DuskMoon Grid</Grid>);
} Returns a complete fallback screen map without matchMedia
test-backedGrid scenario from the component test coverage: returns a complete fallback screen map without matchmedia.
import "@duskmoon-dev/components/styles.css";
import { Grid } from "@duskmoon-dev/components/grid";
export function GridReturnsACompleteFallbackDemo() {
return (<Grid>DuskMoon Grid</Grid>);
} Reads breakpoint state from matchMedia
test-backedGrid scenario from the component test coverage: reads breakpoint state from matchmedia.
import "@duskmoon-dev/components/styles.css";
import { Grid } from "@duskmoon-dev/components/grid";
export function GridReadsBreakpointStateFromDemo() {
return (<Grid>DuskMoon Grid</Grid>);
} Updates subscribers and supports useWatch selectors
test-backedGrid scenario from the component test coverage: updates subscribers and supports usewatch selectors.
import "@duskmoon-dev/components/styles.css";
import { Grid } from "@duskmoon-dev/components/grid";
export function GridUpdatesSubscribersAndSupportsDemo() {
return (<Grid>DuskMoon Grid</Grid>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<Grid>DuskMoon Grid</Grid>
</div>
<div data-theme="moonlight">
<Grid>DuskMoon Grid</Grid>
</div> API
The API reference below lists every parsed exported type or interface for Grid.
packages/components/src/components/grid/Grid.types.ts
Scenarios: packages/components/src/components/grid/Grid.test.tsx (typeof gridBreakpoints)[number] typeof gridBreakpointQueries Record<Breakpoint, boolean> Partial<BreakpointScreenMap>