Dashboard Grid
Wraps dashboard cards into as many columns as fit, with no breakpoints to write.
<arc-dashboard-grid>Overview
DashboardGrid lays out metric cards in a CSS grid that wraps them into as many columns as fit. Each column is at least min-column-width wide (280px by default), so you don't need breakpoints. Lower it to fit more, smaller cards, or raise it for fewer, wider ones. gap sets the space between cards and takes any CSS length or spacing token. It defaults to var(--space-lg), which is also the grid's padding.
columns caps the count. With columns="3", a wide container shows three columns, and a narrow one still wraps once a column would get narrower than min-column-width.
Guidelines
Do
- Set `min-column-width` to the narrowest your cards can be
- Put each metric in a Card or ValueCard so the cards match
- Use spacing tokens such as `var(--space-md)` for `gap`
Don't
- Don't use it for page layout. Use PageLayout for sidebar and main areas
- Don't nest one inside another. The padding doubles. Adjust `min-column-width` on a single grid
- Don't restyle the grid with flex or floats
Features
- The column minimum and gap are also set as `--min-col` and `--gap` on the host, where page code can read them
- Columns and gap are in the server-rendered markup, so the grid doesn't reflow when the script loads
- The inner grid is exposed as the `grid` CSS part
Preview
Usage
<arc-dashboard-grid columns="3" gap="var(--space-md)">
<arc-card>Revenue: $45,231</arc-card>
<arc-card>Users: 2,345</arc-card>
<arc-card>Growth: +12.5%</arc-card>
</arc-dashboard-grid>import { Card, DashboardGrid } from '@arclux/arc-ui-react';
export default function Example() {
return (
<DashboardGrid columns="3" gap="var(--space-md)">
<Card>Revenue: $45,231</Card>
<Card>Users: 2,345</Card>
<Card>Growth: +12.5%</Card>
</DashboardGrid>
);
}<script setup>
import { Card, DashboardGrid } from '@arclux/arc-ui-vue';
</script>
<template>
<DashboardGrid columns="3" gap="var(--space-md)">
<Card>Revenue: $45,231</Card>
<Card>Users: 2,345</Card>
<Card>Growth: +12.5%</Card>
</DashboardGrid>
</template><script>
import { Card, DashboardGrid } from '@arclux/arc-ui-svelte';
</script>
<DashboardGrid columns="3" gap="var(--space-md)">
<Card>Revenue: $45,231</Card>
<Card>Users: 2,345</Card>
<Card>Growth: +12.5%</Card>
</DashboardGrid>import { Component } from '@angular/core';
import { Card, DashboardGrid } from '@arclux/arc-ui-angular';
@Component({
imports: [Card, DashboardGrid],
template: `
<arc-dashboard-grid columns="3" gap="var(--space-md)">
<arc-card>Revenue: $45,231</arc-card>
<arc-card>Users: 2,345</arc-card>
<arc-card>Growth: +12.5%</arc-card>
</arc-dashboard-grid>
`,
})
export class MyComponent {}import { Card, DashboardGrid } from '@arclux/arc-ui-solid';
export default function Example() {
return (
<DashboardGrid columns="3" gap="var(--space-md)">
<Card>Revenue: $45,231</Card>
<Card>Users: 2,345</Card>
<Card>Growth: +12.5%</Card>
</DashboardGrid>
);
}import { Card, DashboardGrid } from '@arclux/arc-ui-preact';
export default function Example() {
return (
<DashboardGrid columns="3" gap="var(--space-md)">
<Card>Revenue: $45,231</Card>
<Card>Users: 2,345</Card>
<Card>Growth: +12.5%</Card>
</DashboardGrid>
);
}<!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-dashboard-grid — requires dashboard-grid.css + base.css (or arc-ui.css) -->
<div class="arc-dashboard-grid">
<div class="dashboard-grid">
DashboardGrid
</div>
</div><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-dashboard-grid — self-contained, no external CSS needed -->
<div class="arc-dashboard-grid" style="display: block; box-sizing: border-box">
<div style="display: grid; grid-template-columns: repeat(
auto-fill,
minmax(280px, 1fr)
); gap: 24px; padding: 24px">
DashboardGrid
</div>
</div>API
gapstring'var(--space-lg)'- Gap between grid cells. Accepts any CSS length value or spacing token. Maps to the --gap CSS custom property.
min-column-widthstring'280px'- Minimum column width in auto-fill mode. Controls the minmax() threshold at which columns wrap to the next row. Maps to the --min-col CSS custom property.
columnsnumber0- Number of columns when using explicit column mode. When this attribute is set on the element, the grid switches from auto-fill to a fixed repeat(N, 1fr) layout.
See also
- CardContent container with a border and hover effects. When it links somewhere, the whole surface is the link and the border turns to a gradient on hover.
- StatShows one short number, drawn large in the accent gradient, with a label under it.
- ResizableA panel with a drag handle on one edge that changes its width or height.