Button

Install

import React from 'react';
import { Button } from 'vant-react';

Usage

Type

<Button type="default">Default</Button>
<Button type="primary">Primary</Button>
<Button type="info">Info</Button>
<Button type="danger">Danger</Button>
<Button type="warning">Warning</Button>

Plain

<Button plain type="primary">Primary</Button
<Button plain type="danger">Danger</Button>

Hairline

<Button hairline type="primary">Primary</Button
<Button hairline type="danger">Danger</Button>

Disable

Loading

Shape

Custom Color

Tags

Native Type

Block

Icon

Action

URL

API

Props

Attribute

Description

Type

Default

Required

type

Can be set to primary info warning danger

string

default

optional

text

Text to be displayed in button

string

-

optional

color

Color, in hex value:a9s7dn, in gradient value:linear-gradient(to right, #4bb0ff, #6149f6),in rgb: rgb(210,210,210)

string

-

optional

fontColor

Css Color

string

-

optional

icon

Button icon that appears on the left

string

-

optional

tag

HTML Tag

string

-

optional

nativeType

Native Type Attribute

string

' '

optional

plain

Whether to be plain button

boolean

false

optional

round

Whether to be round button

boolean

false

optional

square

Whether to be square button

boolean

false

optional

disabled

Whether to disable button

boolean

false

optional

loading

Whether to show loading status

boolean

false

optional

loadingText

Loading text

string

-

optional

loadingType

Loading type, can be set tospinner

string

circular

optional

url

Link URL

string

-

optional

replace

Whether open in current tab

boolean

false

optional

Event

Event

Description

Arguments

click

Triggered when click button and not disabled or loading

event: Event

touchstart

Triggered when touch start on mobile

event:TouchEvent

Last updated

Was this helpful?