12-Column Grid
Free · MITGeneral-purpose 12-column responsive grid container where children control their own span with plain col-span utilities.
- Category
- Bento & Layout
- Framework
- astro
- Version
- 1.0.0
- Peer deps
- none
Install
velocityx add grid-12
Free and MIT licensed — no account needed. The file lands under src/components/velocity/grid-12/ by default (override with --dest), and it's yours to edit from the moment it's written.
Demo
View the live demo on the showcase site ↗
Source
Pulled live from the registry — this is the exact file velocityx add grid-12 writes into your project right now.
components/velocity/grid-12/Grid12.astro
---
// VELOCITY COMPONENT · theming
//
// Colours here are Tailwind `primary-*` / `accent-*`, which resolve through
// the Velocity preset. Out of the box they are a neutral indigo — NOT the
// Aidxn brand — so this drops into your project without dragging our look in.
//
// ⚡ NOT USING VELOCITY? Run this once, in your project root:
//
// velocityx theme
//
// It writes velocity-preset.cjs + velocity-theme.css. Add the preset to your
// tailwind.config, import the css, then set your whole brand in ONE place:
//
// :root {
// --vx-brand: custom;
// --vx-primary-600: 220 38 38; <- your action colour
// --vx-primary-700: 185 28 28;
// }
//
// ⚠️ Raw RGB channels, space separated — NOT hex. `#DC2626` here silently
// breaks every /opacity variant in the library (bg-primary-600/20 etc).
//
// Prefer not to install anything? Find-and-replace `primary-` with your own
// scale name. Nothing else in this file depends on Velocity.
/**
* Grid12 — General-purpose 12-column responsive grid container. The
* foundation primitive underneath the more opinionated layouts (Split*,
* ThreeColumnFeatureRow, Bento*) — use this directly when you need
* arbitrary column spans that don't fit a named pattern.
*
* Children control their own span with plain Tailwind utilities
* (`col-span-12 md:col-span-6 lg:col-span-4`) — this component only
* establishes the 12-track grid + gap, it does not wrap children in
* anything that would interfere with `col-span-*`.
*/
export interface Props {
as?: 'div' | 'section';
gap?: 4 | 5 | 6 | 8 | 10;
className?: string;
}
const { as: As = 'div', gap = 6, className = '' } = Astro.props;
const GAP: Record<number, string> = {
4: 'gap-4',
5: 'gap-5',
6: 'gap-6',
8: 'gap-8',
10: 'gap-10',
};
---
<As class:list={['grid grid-cols-12', GAP[gap], className]}>
<slot />
</As>
Theming
Uses the shared primary-* / accent-* scale — see Theming if colours look unstyled after install.