Split 50/50 Section
Free · MITEven two-column split section that stacks to one column on mobile, with an optional mobile reorder flag.
- Category
- Bento & Layout
- Framework
- astro
- Version
- 1.0.0
- Peer deps
- none
Install
velocityx add split-fifty
Free and MIT licensed — no account needed. The file lands under src/components/velocity/split-fifty/ 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 split-fifty writes into your project right now.
components/velocity/split-fifty/SplitFifty.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.
/**
* SplitFifty — Even 50/50 two-column section. Stacks to a single column on
* mobile (left slot first, then right — reorder with `reverseOnMobile` if
* the right slot should read first on small screens).
*/
export interface Props {
as?: 'div' | 'section';
gap?: 6 | 8 | 10 | 12;
align?: 'start' | 'center' | 'end' | 'stretch';
reverseOnMobile?: boolean;
className?: string;
}
const {
as: As = 'div',
gap = 10,
align = 'center',
reverseOnMobile = false,
className = '',
} = Astro.props;
const GAP: Record<number, string> = {
6: 'gap-6',
8: 'gap-8',
10: 'gap-10',
12: 'gap-12',
};
const ALIGN: Record<string, string> = {
start: 'items-start',
center: 'items-center',
end: 'items-end',
stretch: 'items-stretch',
};
---
<As
class:list={[
'grid grid-cols-1 md:grid-cols-2',
GAP[gap],
ALIGN[align],
className,
]}
>
<div class:list={['min-w-0', reverseOnMobile && 'order-2 md:order-1']}>
<slot name="left" />
</div>
<div class:list={['min-w-0', reverseOnMobile && 'order-1 md:order-2']}>
<slot name="right" />
</div>
</As>
Theming
Uses the shared primary-* / accent-* scale — see Theming if colours look unstyled after install.