Grid
Grid exposes responsive breakpoint information for adaptive layouts.
@duskmoon-dev/components/gridUsage
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.
Source
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.
Source
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.
Source
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.
Source
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.
Source
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.
Source
<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.tsScenarios: packages/components/src/components/grid/Grid.test.tsxType definition
(typeof gridBreakpoints)[number]Type definition
typeof gridBreakpointQueriesType definition
Record<Breakpoint, boolean>Type definition
Partial<BreakpointScreenMap>