Skip to content

Layout - Vant 4 📐

📐 Layout

Flexible grid system for responsive mobile layouts

🌟 Introduction

Build beautiful, responsive layouts effortlessly with our powerful grid system. Use van-row and van-col to create flexible, mobile-first designs that adapt to any screen size.

📦 Installation

Register component globally via app.use, refer to Component Registration for more registration ways.

js
import { createApp } from'vue'; import { Col, Row } from'vant'; const app = createApp(); app.use(Col); app.use(Row);

🎨 Usage Examples

🌟 Basic Usage

Create responsive layouts with our 24-column grid system. Use span to control column width and offset for precise positioning:

html

📏 Column Spacing

Add perfect spacing between columns with the gutter attribute for clean, organized layouts:

html

↕️ Vertical Spacing

Control both horizontal and vertical spacing by passing an array [horizontal, vertical] for complete layout control:

html

🎯 Justify Content

Align your content exactly where you want it with flexible justification options:

html

🔧 API Reference

🏗️ Row Props

Configure your row container with these powerful layout options:

AttributeDescriptionTypeDefault
gutterGrid spacing��px��*numberstring
tagCustom element tagstringdiv
justifyFlex main axis, can be set to end/center/space-around/space-betweenstringstart
alignFlex cross axis, be set to center/bottomstringtop
wrapWhether to wrapbooleantrue

📦 Col Props

Control individual column behavior and positioning:

AttributeDescriptionTypeDefault
spannumber of column the grid spans*numberstring*
offsetnumber of spacing on the left side of the grid*numberstring*
tagCustom element tagstringdiv

📡 Row Events

Listen to user interactions with row containers:

EventDescriptionArguments
clickEmitted when the row is clickedevent: MouseEvent

📡 Col Events

Track interactions with individual columns:

EventDescriptionArguments
clickEmitted when the col is clickedevent: MouseEvent

📝 Types

Access comprehensive TypeScript definitions for better development experience:

ts
importtype { ColProps, RowProps, RowAlign, RowJustify } from'vant';

Explore more components and resources to enhance your development experience:

Layout Components

  • Grid - Advanced grid layout system
  • Space - Spacing and alignment utilities
  • Divider - Visual content separation

Container Components

  • Cell - List item containers
  • Card - Content cards with styling
  • List - Scrollable content lists

Development Resources

Enterprise-level mobile solution based on Vant