Element UI User Manual

This manual will help you quickly get started with Element UI and master commonly used components.

Quick Start

Before using Element UI, make sure installation is complete.

Basic Usage

Use components directly in Vue components:

<template>
  <el-button>Default Button</el-button>
  <el-button type="primary">Primary Button</el-button>
  <el-button type="success">Success Button</el-button>
  <el-button type="warning">Warning Button</el-button>
  <el-button type="danger">Danger Button</el-button>
</template>

Common Components

Button

<el-button>Default</el-button>
<el-button type="primary">Primary</el-button>
<el-button size="small">Small</el-button>
<el-button disabled>Disabled</el-button>
<el-button icon="el-icon-search">Search</el-button>

Input

<el-input v-model="input" placeholder="Please enter" />
<el-input v-model="input" prefix-icon="el-icon-search" />
<el-input v-model="input" clearable />

Select

<el-select v-model="value" placeholder="Select">
  <el-option label="Option 1" value="1" />
  <el-option label="Option 2" value="2" />
</el-select>

Table

<el-table :data="tableData" stripe border>
  <el-table-column prop="date" label="Date" width="180" />
  <el-table-column prop="name" label="Name" width="180" />
  <el-table-column prop="address" label="Address" />
</el-table>

Form

<el-form :model="form" label-width="80px">
  <el-form-item label="Name">
    <el-input v-model="form.name" />
  </el-form-item>
</el-form>

Dialog

<el-dialog :visible.sync="dialogVisible" title="Title" width="30%">
  <span>Content</span>
</el-dialog>

Message

import { Message } from 'element-ui'

Message.success('Success message')
Message.warning('Warning message')
Message.error('Error message')

Layout

Grid System

Element UI uses 24-column grid system:

<el-row :gutter="20">
  <el-col :span="12">Column</el-col>
  <el-col :span="12">Column</el-col>
</el-row>

Container

<el-container>
  <el-header>Header</el-header>
  <el-main>Main</el-main>
  <el-footer>Footer</el-footer>
</el-container>

Theme Customization

Use SCSS variables:

$--color-primary: #409eff;

Online theme generator: https://elementui.github.io/theme-chalk-preview/

Best Practices

Responsive Design

<el-row>
  <el-col :xs="24" :sm="12" :md="8" :lg="6">Responsive</el-col>
</el-row>

Form Validation

Always validate user input and provide clear error messages.