DocsGitHub
Getting Started
  • Overview
  • Design Tokens
Components
  • Accordion
  • Alert
  • Announcement
  • Avatar
  • Badge
  • BigCalendar
  • Breadcrumb
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Checkbox
  • Chip
  • CloseButton
  • Combobox
  • CommandPalette
  • ContextMenu
  • Currency
  • DatePicker
  • DescriptionList
  • Drawer
  • DropdownMenu
  • EmptyState
  • Field
  • FileUpload
  • FormGrid
  • Hotkey
  • Icon
  • Input
  • Metric
  • Modal
  • MultiSelect
  • NumberInput
  • Pagination
  • Popover
  • ProgressBar
  • Radio
  • Rating
  • SegmentedControl
  • Select
  • SelectionCard
  • Sidebar
  • Skeleton
  • Slider
  • Spinner
  • Stepper
  • Switch
  • Table
  • Tabs
  • Textarea
  • Timeline
  • TimePicker
  • Toast
  • Tooltip
  • TransferList
  • TreeView
  • Wizard
Charts
  • Overview
  • Area Chart
  • Bar Chart
  • Donut Chart
  • Line Chart
  • Pie Chart
  • Stacked Bar Chart

Rating

An interactive star rating component for user feedback with hover preview and keyboard navigation.

Installation

tsx
import { Rating } from "madagent";

Default

Sizes

With Description

Rate the overall quality of this product

Read Only

Disabled

Custom Max

PropTypeDefaultDescription
value
number
-Controlled rating value
defaultValue
number
0Initial rating value (uncontrolled)
onChange
(value: number) => void
-Called when the rating changes
max
number
5Maximum number of stars
size
"sm""md""lg"
"md"Star size
disabled
boolean
falseDisables the rating
readOnly
boolean
falseShows rating without interaction
label
ReactNode
-Label text next to the stars
description
string
-Description text below the control
name
string
-Form input name for hidden input

RTL Support

Components automatically adapt to right-to-left languages using CSS logical properties.

Preview

هل توصي بهذا المنتج؟

Usage

tsx
<div style={{ display: "flex", flexDirection: "column", gap: 12 }}>
  <Rating label="تقييم المنتج" defaultValue={4} />
  <Rating label="جودة الخدمة" defaultValue={3} />
  <Rating label="التوصية" description="هل توصي بهذا المنتج؟" defaultValue={5} />
</div>