Skip to content
rating
AutoXXS (320px)XS (375px)SM (640px)MD (768px)LG (1024px)XL (1280px)XXL (1536px)
SketchMaterialiOSTamagui
DataInjectionKeyPatternsServiceTransactionProcessResearchProductQualityPerformanceSpecDomainFunctionTechnologyArchitectureConfigMiddlewareDataDatabaseDrizzleMigrationModelop-sqliteSchemaSQLState ManagementDraftKeystoneMergePatchPatchesPersistenceReactiveRedoStoreUndoTestingDeviceFactoryIsolationTypeScriptZodTopicsCommunicationBidsNVCDesignDesign ImplicationsEducationPedagogyFoundationsPsychologyAttachmentFloodingRelatingAuthentic RelatingUIEditorReact Native

rating

Fragment reference rating
tags
ui

Ratings give users a way to quickly view and provide feedback. Integrates with standard form elements.

Usage

rating(label="Rate this" value=3)

Labels

Always provide a label for assistive devices β€” it is not displayed visually but is required for accessibility.

rating(label="Rate this component")

Maximum Value

Use max to change the highest rating. Default is 5.

rating(label="Rating" max=3)
rating(label="Rating" max=10)

Precision

Use precision to allow fractional ratings.

rating(label="Rating" precision=0.5 value=2.5)

Sizing

Use size to adjust the component size.

rating(label="Rating" size="small")
rating(label="Rating" size="medium")
rating(label="Rating" size="large")

Readonly

Use readonly to display a rating that users cannot change.

rating(label="Rating" readonly value=4)

Disabled

Use disabled to prevent all interaction.

rating(label="Rating" disabled value=3)

Attributes

NameTypeDefaultDescription
labelstring''Accessible label for assistive devices (not displayed visually).
valuenumber0The current rating value.
maxnumber5The highest rating to show.
precisionnumber1Increment precision. Use 0.5 for half-star ratings.
size'small' | 'medium' | 'large''medium'The component’s size.
readonlybooleanfalsePrevents user interaction without disabling the element.
disabledbooleanfalseDisables the rating entirely.
requiredbooleanfalseMakes the rating required in a form context.
namestringnullForm field name submitted with form data.