logoAnt Design

⌘ K
  • Design
  • Development
  • Components
  • Blog
  • Resources
YouMindTRACTIANLobeHubCodeRabbit
6.4.5
  • Components Overview
  • Changelog
    v6.4.5
  • General
    • Button
    • FloatButton
    • Icon
    • Typography
  • Layout
    • Divider
    • Flex
    • Grid
    • Layout
    • Masonry
      6.0.0
    • Space
    • Splitter
  • Navigation
    • Anchor
    • Breadcrumb
    • Dropdown
    • Menu
    • Pagination
    • Steps
    • Tabs
  • Data Entry
    • AutoComplete
    • Cascader
    • Checkbox
    • ColorPicker
    • DatePicker
    • Form
    • Input
    • InputNumber
    • Mentions
    • Radio
    • Rate
    • Select
    • Slider
    • Switch
    • TimePicker
    • Transfer
    • TreeSelect
    • Upload
  • Data Display
    • Avatar
    • Badge
    • Calendar
    • Card
    • Carousel
    • Collapse
    • Descriptions
    • Empty
    • Image
    • List
      DEPRECATED
    • Popover
    • QRCode
    • Segmented
    • Statistic
    • Table
    • Tag
    • Timeline
    • Tooltip
    • Tour
    • Tree
  • Feedback
    • Alert
    • Drawer
    • Message
    • Modal
    • Notification
    • Popconfirm
    • Progress
    • Result
    • Skeleton
    • Spin
    • Watermark
  • Other
    • Affix
    • App
    • BorderBeam
      6.4.0
    • ConfigProvider
    • Util
When To Use
Examples
Basic
Sizes
Half star
Show copywriting
Read only
Clear star
Other Character
Customize character
API
Methods
Design Token

Rate

Used for rating operation on something.
Importimport { Rate } from 'antd';
GitHub
components/rateIssueOpen issues
Docs
Edit this pageLLMs.md
RadioSelect

Resources

Ant Design X
Ant Design Charts
Ant Design Pro
Pro Components
Ant Design Mobile
Ant Design Mini
Ant Design Web3
Ant Design Landing-Landing Templates
Scaffolds-Scaffold Market
Umi-React Application Framework
dumi-Component doc generator
qiankun-Micro-Frontends Framework
Ant Motion-Motion Solution
China Mirror 🇨🇳

Community

Awesome Ant Design
Medium
X
yuque logoAnt Design in YuQue
Ant Design in Zhihu
Experience Cloud Blog
seeconf logoSEE Conf-Experience Tech Conference

Help

GitHub
Change Log
FAQ
For Agents
Bug Report
Issues
Discussions
StackOverflow
SegmentFault

Ant XTech logoMore Products

yuque logoYuQue-Document Collaboration Platform
AntV logoAntV-Data Visualization
Egg logoEgg-Enterprise Node.js Framework
Kitchen logoKitchen-Sketch Toolkit
Galacean logoGalacean-Interactive Graphics Solution
WeaveFox logoWeaveFox-AI Development with WeaveFox 🦊
xtech logoAnt Financial Experience Tech
Theme Editor
Made with ❤ by
Ant Group and Ant Design Community
loading

When To Use

  • Show evaluation.
  • A quick rating operation on something.

Examples

API

Common props ref:Common props

PropertyDescriptionTypeDefaultVersionGlobal Config
allowClearWhether to allow clear when click againbooleantrue×
allowHalfWhether to allow semi selectionbooleanfalse×
characterThe custom character of rateReactNode | (RateProps) => ReactNode<StarFilled />function(): 4.4.0×
countStar countnumber5×
defaultValueThe default valuenumber0×
disabledIf read only, unable to interactbooleanfalse×
keyboardSupport keyboard operationbooleantrue5.18.0×
sizeStar size'small' | 'medium' | 'large''medium'×
tooltipsCustomize tooltip by each characterTooltipProps[] | string[]-×
valueThe current valuenumber-×
onBlurCallback when component lose focusfunction()-×
onChangeCallback when select valuefunction(value: number)-×
onFocusCallback when component get focusfunction()-×
onHoverChangeCallback when hover itemfunction(value: number)-×
onKeyDownCallback when keydown on componentfunction(event)-×

Methods

NameDescription
blur()Remove focus
focus()Get focus

Design Token

Component TokenHow to use?
Token NameDescriptionTypeDefault Value
starBgStar background colorstringrgba(0,0,0,0.06)
starColorStar colorstring#fadb14
starHoverScaleScale of star when hoverreadonly string[] | Transform | readonly Transform[] | { _multi_value_?: boolean; _skip_check_?: boolean; value: readonly string[] | Transform | (readonly string[] | Transform | undefined)[] | undefined } | undefinedscale(1.1)
starSizeStar sizenumber20
starSizeLGLarge star sizenumber25
starSizeSMSmall star sizenumber15
Global TokenHow to use?
Token NameDescriptionTypeDefault Value
colorTextDefault text color which comply with W3C standards, and this color is also the darkest neutral color.stringrgba(0,0,0,0.88)
fontFamilyThe font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.string-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'
fontSizeThe most widely used font size in the design system, from which the text gradient will be derived.number14
lineHeightLine height of text.number1.5714285714285714
lineWidthBorder width of base componentsnumber1
marginXSControl the margin of an element, with a small size.number8
motionDurationMidMotion speed, medium speed. Used for medium element animation interaction.string0.2s
Basic

The simplest usage.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Half star

Support select half star.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Read only

Read only, can't use mouse to interact.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Other Character

Replace the default star to other character like alphabet, digit, iconfont or even Chinese word.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Sizes

Three sizes.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
6.0.0
Show copywriting

Add copywriting in rate components.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Clear star

Allow clearing the rating when clicking the same star again.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
Customize character

Can customize each character using (RateProps) => ReactNode.

CodeSandbox Icon
Hitu Icon
codepen icon
External Link Icon
Expand Icon
  • A
    A
  • A
    A
  • A
    A
  • A
    A
  • A
    A
  • 好
    好
  • 好
    好
  • 好
    好
  • 好
    好
  • 好
    好
normal
allowClear: true
allowClear: false
  • 1
    1
  • 2
    2
  • 3
    3
  • 4
    4
  • 5
    5