Skip to content

Rating

A score from 1 to 5 with stars. Arrow keys move, and each star says its number.

import { Rating } from '@sypnia/ui/react'

On this page
  1. How useful was this page
  2. When to use it
  3. For everyone
  4. Props

How useful was this page

Code
import { useState } from 'react';
import { Rating } from '@sypnia/ui/react';

// Choose with the pointer or the arrow keys. The second one only shows a score.
export default function Feedback() {
  const [v, setV] = useState(4);
  return <div className="sy-stack"><Rating label="How useful was this page?" value={v} onChange={setV} /><Rating label="Average score" value={4} readOnly /></div>;
}

When to use it

Use it when

  • Feedback on a page or an answer.

Do not use it when

  • Scores that need a reason: ask for words too.

For everyone

  • It is a radio group: «4 of 5». The read-only one is an image with the score in words.

Props

RatingTypeDefault
labelrequired string
valuerequired number
max number 5
onChange ((v: number) => void)
readOnly boolean
  1. How useful was this page
  2. When to use it
  3. For everyone
  4. Props

    Search pages, sections and terms