Popup

Install

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

Usage

Every popup should have its own state.

const [centerPopup, setCenterPopup] = useState(false);

<Button click={() => {setCenterPopup(true)}}/>
<Popup isActive={centerPopup} setActive={setCenterPopup} />

Type

<Popup type='top'/>
<Popup type='bottom'/>
<Popup type='left'/>
<Popup type='right'/>

Size

Content

CloseIcon

Round Corner

Custom Color

Action

API

Props

Attribute

Description

Type

Default

Required

type

Can be set to left right top bottom

string

center

optional

text

Text to be displayed in popup ,{text,color,size,

textAlign}

object

-

optional

color

Popup background-color, in hex value:#b90000, in gradient value in rgba:rgb(210,210,210,0.4)

string

-

optional

borderRadius

round corner

string

-

optional

size

popup size , { width: '10px', height: '100vh' }

object

-

optional

padding

content padding ,

10px 0 20px

string

-

optional

content

Component to be displayed in popup

React

Element

-

optional

closeable

show close icon in popup

boolean

false

optional

closeIcon

custom your close icon ,{iconName, iconSize}

object

-

optional

closeIconPosition

Ex: { top: '40px', left: '40px' }

object

-

optional

Event

Event

Description

Arguments

click

Triggered when click text in popup

and not disabled or loading

event: Event

Last updated

Was this helpful?