# Col

> React Col component for Tailwind CSS v4: a vertical flex column with a gap and no padding, for content inside a Row, Card or Section. See when to use Stack.

Source: https://vaneui.com/docs/layout-components/col

Import: `import { Col, Badge, Button, Card, NavLink, Row, Text, Title } from "@vaneui/ui"`

Col stacks content inside a surface that already supplies spacing, such as a Card or a Section, and forms the columns of a [Row](/docs/layout-components/row). It is a vertical flex column with a gap between its children and no padding or border. When the column needs padding of its own, use [Stack](/docs/layout-components/stack). For cells that should all share one column width, a [Grid](/docs/layout-components/grid) component such as Grid3 lays them out without a Col around each one.

## Basic usage

`Col` defaults to `column`, `flex`, `gap`, `md`, `noPadding`, `noBorder`, `noInsetRing`, `outline`, and `sharp`: you don't need to pass any of these. Pass `href` to render `Col` as `<a>` instead of `<div>`. A focus-visible outline auto-enables when `href` is set.

```tsx demo
<Col>
  <div className="p-4 bg-gray-100 rounded">Item 1</div>
  <div className="p-4 bg-gray-100 rounded">Item 2</div>
  <div className="p-4 bg-gray-100 rounded">Item 3</div>
</Col>
```

## Spacing

Use size props (`xs`, `sm`, `md`, `lg`, `xl`) to control the gap, or `noGap` to disable.

```tsx demo
<Row itemsStart>
  <Col xs flex1>
    <Text fontSemibold>xs</Text>
    <div className="p-3 bg-gray-100 rounded">Item 1</div>
    <div className="p-3 bg-gray-100 rounded">Item 2</div>
    <div className="p-3 bg-gray-100 rounded">Item 3</div>
  </Col>
  <Col sm flex1>
    <Text fontSemibold>sm</Text>
    <div className="p-3 bg-gray-100 rounded">Item 1</div>
    <div className="p-3 bg-gray-100 rounded">Item 2</div>
    <div className="p-3 bg-gray-100 rounded">Item 3</div>
  </Col>
  <Col flex1>
    <Text fontSemibold>md (default)</Text>
    <div className="p-3 bg-gray-100 rounded">Item 1</div>
    <div className="p-3 bg-gray-100 rounded">Item 2</div>
    <div className="p-3 bg-gray-100 rounded">Item 3</div>
  </Col>
  <Col lg flex1>
    <Text fontSemibold>lg</Text>
    <div className="p-3 bg-gray-100 rounded">Item 1</div>
    <div className="p-3 bg-gray-100 rounded">Item 2</div>
    <div className="p-3 bg-gray-100 rounded">Item 3</div>
  </Col>
  <Col xl flex1>
    <Text fontSemibold>xl</Text>
    <div className="p-3 bg-gray-100 rounded">Item 1</div>
    <div className="p-3 bg-gray-100 rounded">Item 2</div>
    <div className="p-3 bg-gray-100 rounded">Item 3</div>
  </Col>
  <Col noGap flex1>
    <Text fontSemibold>noGap</Text>
    <div className="p-3 bg-gray-100 rounded">Item 1</div>
    <div className="p-3 bg-gray-100 rounded">Item 2</div>
    <div className="p-3 bg-gray-100 rounded">Item 3</div>
  </Col>
</Row>
```

## Items (cross axis)

Col has no `items` default, so children stretch to fill the width. Use `itemsStart`, `itemsCenter`, `itemsEnd`, `itemsBaseline`, or `itemsStretch` to override.

```tsx demo
<Row itemsStart>
  <Col flex1 className="border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>default (stretch)</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
  <Col itemsStart flex1 className="border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>itemsStart</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
  <Col itemsCenter flex1 className="border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>itemsCenter</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
  <Col itemsEnd flex1 className="border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>itemsEnd</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
</Row>
```

## Justify (main axis)

Control vertical distribution with `justifyStart`, `justifyEnd`, `justifyCenter`, `justifyBetween`, `justifyAround`, or `justifyEvenly`. The Col needs a fixed height for these to have any effect.

```tsx demo
<Row itemsStart>
  <Col justifyStart flex1 className="h-48 border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>justifyStart</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
  <Col justifyCenter flex1 className="h-48 border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>justifyCenter</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
  <Col justifyEnd flex1 className="h-48 border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>justifyEnd</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
  <Col justifyBetween flex1 className="h-48 border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>justifyBetween</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
  <Col justifyAround flex1 className="h-48 border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>justifyAround</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
  <Col justifyEvenly flex1 className="h-48 border-2 border-dashed border-gray-300 p-2">
    <Text fontSemibold>justifyEvenly</Text>
    <div className="p-2 bg-gray-100 rounded">A</div>
    <div className="p-2 bg-gray-100 rounded">B</div>
  </Col>
</Row>
```

## Reverse order

Use `columnReverse` to reverse the visual order of children.

```tsx demo
<Col columnReverse className="border-2 border-dashed border-gray-300 p-2">
  <div className="p-3 bg-gray-100 rounded">First in DOM</div>
  <div className="p-3 bg-gray-100 rounded">Second</div>
  <div className="p-3 bg-gray-100 rounded">Last in DOM</div>
</Col>
```

## Variants

Use `filled` with an appearance prop for a filled background. Col defaults to `sharp`: pair with `rounded` or `pill` for curved corners, and add `padding` so the background has breathing room.

```tsx demo
<Row itemsStart>
  <Col filled primary padding rounded flex1>
    <div className="p-4 bg-white/80 rounded">Filled Primary</div>
    <div className="p-4 bg-white/80 rounded">Item 2</div>
  </Col>
  <Col border success padding rounded flex1>
    <div className="p-4 rounded">Outline Success</div>
    <div className="p-4 rounded">Item 2</div>
  </Col>
</Row>
```

## Text alignment

Use `textLeft`, `textCenter`, `textRight`, or `textJustify` to control text alignment within the column.

```tsx demo
<Row itemsStart>
  <Col textLeft flex1 className="border-2 border-dashed border-gray-300 p-4">
    <Text fontSemibold>Left Aligned</Text>
    <Text>Content aligned to the left.</Text>
  </Col>
  <Col textCenter flex1 className="border-2 border-dashed border-gray-300 p-4">
    <Text fontSemibold>Center Aligned</Text>
    <Text>Content centered within the column.</Text>
  </Col>
  <Col textRight flex1 className="border-2 border-dashed border-gray-300 p-4">
    <Text fontSemibold>Right Aligned</Text>
    <Text>Content aligned to the right.</Text>
  </Col>
</Row>
```

## Nested in Row

Col is commonly used inside Row to create multi-column layouts. Use `flex1` so each column shares the available width equally.

```tsx demo
<Row itemsStart>
  <Col flex1>
    <Card>
      <Title>Column 1</Title>
      <Text sm secondary>First column content.</Text>
    </Card>
  </Col>
  <Col flex1>
    <Card>
      <Title>Column 2</Title>
      <Text sm secondary>Second column content.</Text>
    </Card>
  </Col>
  <Col flex1>
    <Card>
      <Title>Column 3</Title>
      <Text sm secondary>Third column content.</Text>
    </Card>
  </Col>
</Row>
```

## Inside a Card

Col composes naturally inside a Card to lay out a vertical cluster: labelled fields, key/value pairs, or a list of actions.

```tsx demo
<Card>
  <Title>Account</Title>
  <Col>
    <Row justifyBetween>
      <Text secondary>Plan</Text>
      <Badge success>Pro</Badge>
    </Row>
    <Row justifyBetween>
      <Text secondary>Seats</Text>
      <Text fontSemibold>12 / 25</Text>
    </Row>
    <Row justifyBetween>
      <Text secondary>Renews</Text>
      <Text fontSemibold>Jan 14, 2026</Text>
    </Row>
  </Col>
  <Row justifyEnd>
    <Button secondary>Manage</Button>
    <Button filled>Upgrade</Button>
  </Row>
</Card>
```

## As a navigation column

Col is a natural container for a vertical stack of `NavLink`s in a sidebar.

```tsx demo
<Col className="w-56 border-2 border-dashed border-gray-300 p-3">
  <NavLink href="#" active>Dashboard</NavLink>
  <NavLink href="#">Projects</NavLink>
  <NavLink href="#">Team</NavLink>
  <NavLink href="#">Billing</NavLink>
  <NavLink href="#">Settings</NavLink>
</Col>
```

## As Link

Add `href` to render the Col as an `<a>` tag, useful for clickable feature tiles. A keyboard focus-visible outline auto-renders so the link is reachable via Tab; opt out with `noFocusVisible`.

```tsx demo
<Row itemsStart>
  <Col href="/docs" flex1 padding border rounded>
    <BookOpen size={20} />
    <Title>Documentation</Title>
    <Text secondary>Browse guides and API reference.</Text>
  </Col>
  <Col href="#as-link" flex1 padding border rounded>
    <Codepen size={20} />
    <Title>Examples</Title>
    <Text secondary>Copy-ready component patterns.</Text>
  </Col>
  <Col href="https://github.com" target="_blank" rel="noopener noreferrer" flex1 padding border rounded>
    <GitHub size={20} />
    <Title>Source</Title>
    <Text secondary>View the project on GitHub.</Text>
  </Col>
</Row>
```

## Next.js Link integration

Use the `tag` prop to render the Col as a Next.js `Link` for client-side navigation.

```tsx
import Link from 'next/link';
import { Col, Title, Text } from '@vaneui/ui';

<Col href="/docs" tag={Link} padding border rounded>
  <Title>Documentation</Title>
  <Text secondary>Browse guides and API reference.</Text>
</Col>
```

## Frequently asked questions

### How do I make a Col scroll?

Give it a height limit and `overflowYAuto`. The limit can be a class such as `max-h-96` or `style={{ maxHeight: 400 }}`; without one the Col grows with its content and there is nothing to scroll. When a column flex parent sets the height instead, such as a full-height sidebar, the Col also needs `min-h-0`, because a flex item does not shrink below its content otherwise.

### How do I keep a sidebar Col in view while the page scrolls?

Add `sticky`, which sticks the Col at the top edge of the scroll area. Set the `--sticky-top` CSS variable on it to stop it lower, below a fixed header. Give the Row that holds the sidebar `itemsStart`: a Col stretched to the full height of the row has no room to move, so it scrolls away with the page.

### Why does `mobileStack` do nothing on my Col?

A Col is already a column, and `mobileStack` only turns a row into a column, so on a Col it changes nothing. Put `mobileStack` on the `Row` that holds the Cols, as under [Responsive layout](/docs/layout-components/row#responsive-layout) on the Row page, and add `itemsStretch` to that Row if the stacked Cols should fill its width.

## Props

| Prop | Category | Default | Description |
| --- | --- | --- | --- |
| `primary` | Appearance |  | Primary color appearance (gray) |
| `accent` | Appearance |  | Accent color appearance (rose) |
| `secondary` | Appearance |  | Secondary color appearance (gray) |
| `tertiary` | Appearance |  | Tertiary color appearance |
| `success` | Appearance |  | Success color appearance (green) |
| `danger` | Appearance |  | Danger color appearance (red) |
| `warning` | Appearance |  | Warning color appearance (amber) |
| `info` | Appearance |  | Info color appearance (cyan) |
| `inheritAppearance` | Appearance |  | Inherit appearance from parent — suppresses own data-appearance/data-variant, uses parent's CSS variables |
| `aspectSquare` | Aspect |  | Square box (aspect-ratio: 1 / 1) |
| `aspectVideo` | Aspect |  | Video box (aspect-ratio: 16 / 9) |
| `aspectAuto` | Aspect |  | The content's own ratio (aspect-ratio: auto) |
| `desktopStack` | Breakpoint |  | Stack into a column at desktop width and below (max-desktop: 80rem) |
| `tabletStack` | Breakpoint |  | Stack into a column at tablet width and below (max-tablet: 64rem) |
| `mobileStack` | Breakpoint |  | Stack into a column at mobile width and below (max-mobile: 48rem) |
| `flex1` | Flex |  | Take up remaining space (= `flex-1`, i.e. `flex: 1 1 0%`) |
| `flexAuto` | Flex |  | Grow but respect intrinsic size (= `flex-auto`, i.e. `flex: 1 1 auto`) |
| `flexNone` | Flex |  | Don't grow and don't shrink (= `flex-none`, i.e. `flex: none`) |
| `margin` | Margin |  | Enable margin on all sides |
| `marginX` | Margin |  | Enable only horizontal (inline) margin |
| `marginY` | Margin |  | Enable only vertical (block) margin |
| `marginT` | Margin |  | Enable only top margin |
| `marginB` | Margin |  | Enable only bottom margin |
| `noMargin` | Margin |  | Disable margin (reset to 0) |
| `padding` | Padding |  | Enable internal padding |
| `paddingX` | Padding |  | Enable only horizontal padding |
| `paddingY` | Padding |  | Enable only vertical padding |
| `noPadding` | Padding | yes | Disable internal padding |
| `pill` | Shape |  | Fully rounded corners (circular) |
| `sharp` | Shape | yes | No rounded corners (square) |
| `rounded` | Shape |  | Medium rounded corners (default) |
| `noShrink` | Shrink |  | Prevent the flex item from shrinking below its content size (= `shrink-0`) |
| `xs` | Size |  | Extra small size |
| `sm` | Size |  | Small size |
| `md` | Size | yes | Medium size (default) |
| `lg` | Size |  | Large size |
| `xl` | Size |  | Extra large size |
| `skeleton` | Skeleton |  | Show the component as a loading placeholder in its own size and shape. On a container, every component inside it becomes a placeholder too |
| `strongBorder` | Strong Border |  | Paint the border in the appearance's strong color instead of its soft one |
| `textLeft` | Text Align |  | Align text to left (physical side, does not flip under RTL) |
| `textCenter` | Text Align |  | Align text to center |
| `textRight` | Text Align |  | Align text to right (physical side, does not flip under RTL) |
| `textJustify` | Text Align |  | Justify text |
| `textStart` | Text Align |  | Align text to the reading-direction start (left in LTR, right in RTL) |
| `textEnd` | Text Align |  | Align text to the reading-direction end (right in LTR, left in RTL) |
| `filled` | Variant |  | Filled variant - solid background with contrasting text color |
| `outline` | Variant | yes | Outline variant - transparent background with border and colored text (default) |
| `ghost` | Variant |  | Ghost variant - transparent background, no border, appearance-colored text, tinted hover background |

Layout and utility props (Border, Display, Flex Direction, Focus Visible, Gap, Height, Hide, Items, Justify, Overflow, Pointer Events, Position, Responsive Sizing, Responsive Width, Ring, Shadow, Show, Transparent, Whitespace, Width, Wrap) are listed on [Common Props](https://vaneui.com/docs/reference/common-props.md).
