Rate

Install

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

Usage

Basic Usage

<Rate currentRate={4} />

Custom Icon

<Rate currentRate={4} icon='like' voidIcon='like-o' />

Custom Color

<Rate currentRate={4} icon='like' voidIcon='like-o' color='#1989fa' />

Custom Count

<Rate
      count={10}
      currentRate={4}
      icon='like'
      voidIcon='like-o'
      color='#1989fa'
/>

Disabled

Read Only

Custom Gutter

Listen On Change

API

Props

Attribute

Description

Type

Default

Required

currentRate

Current rate

number

-

optional

text

Count

number

-

optional

size

Icon size

string

-

optional

icon

Selected icon

string

-

optional

gutter

Icon gutter

string

-

optional

voidIcon

Void icon

string

-

optional

*allowHalf

Whether to allow half star

boolean

false

optional

readonly

Whether to be readonly

boolean

false

optional

*touchable

Whether to allow select rate by touch gesture

boolean

true

optional

disabled

Whether to disable rate

boolean

false

optional

color

Selected color

string

-

optional

voidColor

Void color

string

-

optional

disabledColor

Disabled color

string

-

optional

Event

Event

Description

Parameters

change

Triggered when rate changed

current rate

Last updated

Was this helpful?