Columns
A responsive column grid with configurable count, gap, and collapse breakpoint.
Installation
pnpm dlx shadcn@latest add https://prototyper-ui.com/r/columns.jsonnpx shadcn@latest add https://prototyper-ui.com/r/columns.jsonyarn dlx shadcn@latest add https://prototyper-ui.com/r/columns.jsonbunx --bun shadcn@latest add https://prototyper-ui.com/r/columns.jsonThis will add the following files to your project:
components/ui/columns.tsx
Usage
import { Columns, Column } from "@/components/ui/columns";<Columns count={3} gap={4}>
<div>Column 1</div>
<div>Column 2</div>
<div>Column 3</div>
</Columns>Columns creates a responsive CSS grid that starts as a single column and expands to count columns above the collapse breakpoint. Use Column for items that need to span multiple grid tracks.
Anatomy
<Columns count={3} gap={4} collapse="md">
<Column span={2}>Wide column</Column>
<Column>Normal column</Column>
</Columns>| Sub-component | data-slot | Purpose | Required |
|---|---|---|---|
Columns | columns | Grid container with responsive columns | Yes |
Column | column | Grid item with optional span | No |
Examples
Two Columns
Left Column
A simple two-column layout that stacks on smaller screens.
Right Column
Content in the second column sits side by side above the breakpoint.
Asymmetric Layout
Use Column with span to create uneven splits like a sidebar layout.
Responsive Collapse
Columns collapse to a single column below the collapse breakpoint. Compare md (default) and lg collapse points.
Styling
Data Slots
Use data-slot attributes to target Columns parts in CSS:
| Slot name | Element |
|---|---|
columns | The grid <div> root |
column | A grid item <div> |
Customization Examples
/* Add a border between columns */
[data-slot="column"] + [data-slot="column"] {
@apply border-l border-border pl-4;
}<Columns className="rounded-lg bg-muted p-4" count={2} gap={6}>
Custom styled grid
</Columns>API Reference
Columns
A responsive grid container.
Prop
Type
Extends React.ComponentProps<"div">. All standard div props are forwarded via ...props.
Column
A grid item with optional span control.
Prop
Type
Extends React.ComponentProps<"div">. All standard div props are forwarded via ...props.
Accessibility
Keyboard Interactions
Columns is a non-interactive layout container and does not have keyboard interactions.
ARIA Attributes
- Renders as a plain
<div>with CSS Grid, no implicit ARIA role. - No additional ARIA attributes are needed for a grid layout container.