React Native MantineInputs

Rating

Interactive star rating

Import: import { Rating } from 'react-native-mantine';

Usage

import { Rating } from 'react-native-mantine';
import { useState } from 'react';

const [value, setValue] = useState(3);

<Rating
  value={value}
  onChange={setValue}
  count={5}
  size="lg"
  color="yellow"
/>

// Read-only rating
<Rating value={4.5} readOnly />

Props

PropTypeDefaultDescription
valuenumberRating value (controlled) - current rating value
defaultValuenumber0Default value (uncontrolled) - initial rating value
onChange(value: number) => voidCalled when rating value changes
countnumber5Number of rating items to display
size'xs' | 'sm' | 'md' | 'lg' | 'xl'"md"Rating size that controls symbol size
colorMantineColor"yellow"Rating color from theme for filled symbols
emptyColorMantineColor"gray"Empty symbol color from theme
symbolReact.ReactNodeCustom symbol for filled state (e.g., custom icon)
emptySymbolReact.ReactNodeCustom symbol for empty state
fractionsnumber1Allow fractional ratings for display (not input)
readOnlybooleanfalseRead-only mode - prevents user interaction
highlightSelectedOnlybooleanfalseHighlight only selected items, not hovered items
styleViewStyleAdditional styles to apply to the rating container

Source on GitHub · npm