2016-07-21 10:10:04 +08:00
|
|
|
---
|
|
|
|
category: Components
|
2016-11-09 14:43:32 +08:00
|
|
|
type: Data Entry
|
2016-07-21 10:10:04 +08:00
|
|
|
title: Rate
|
|
|
|
---
|
|
|
|
|
|
|
|
Rate component.
|
|
|
|
|
2016-09-10 13:43:30 +08:00
|
|
|
## When To Use
|
2016-07-21 10:10:04 +08:00
|
|
|
|
2016-11-16 21:33:37 +08:00
|
|
|
- Show evaluation.
|
2016-07-21 10:10:04 +08:00
|
|
|
- A quick rating operation on something.
|
|
|
|
|
|
|
|
## API
|
|
|
|
|
2017-10-25 10:25:44 +08:00
|
|
|
| Property | Description | type | Default |
|
|
|
|
| -------- | ----------- | ---- | ------- |
|
|
|
|
| allowHalf | whether to allow semi selection | boolean | false |
|
2017-12-15 15:30:38 +08:00
|
|
|
| allowClear | whether to allow clear when click again | boolean | true |
|
2017-12-01 19:28:41 +08:00
|
|
|
| autoFocus | get focus when component mounted | boolean | false |
|
2017-03-06 14:23:38 +08:00
|
|
|
| character | custom character of rate | ReactNode | `<Icon type="star" />` |
|
2017-02-21 14:44:13 +08:00
|
|
|
| className | custom class name of rate | string | - |
|
2017-10-25 10:25:44 +08:00
|
|
|
| count | star count | number | 5 |
|
|
|
|
| defaultValue | default value | number | 0 |
|
|
|
|
| disabled | read only, unable to interact | boolean | false |
|
2017-02-21 14:44:13 +08:00
|
|
|
| style | custom style object of rate | object | - |
|
2017-10-25 10:25:44 +08:00
|
|
|
| value | current value | number | - |
|
2017-11-28 10:48:58 +08:00
|
|
|
| onBlur | callback when component lose focus | Function() | - |
|
2017-10-25 10:25:44 +08:00
|
|
|
| onChange | callback when select value | Function(value: number) | - |
|
2017-11-28 10:48:58 +08:00
|
|
|
| onFocus | callback when component get focus | Function() | - |
|
2017-10-25 10:25:44 +08:00
|
|
|
| onHoverChange | callback when hover item | Function(value: number) | - |
|
2017-11-28 10:48:58 +08:00
|
|
|
| onKeyDown | callback when keydown on component | Function(event) | - |
|
2017-12-01 19:28:41 +08:00
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
| Name | Description |
|
|
|
|
| ---- | ----------- |
|
|
|
|
| focus() | get focus |
|
|
|
|
| blur() | remove focus |
|