Home / Blog / How to create a Rating & Review screen

How to create a Rating & Review screen

Ionic Design Kit, built on a design base of Ionic Framework components, simplifies app development by providing designers with a range of pre-made elements. Designers can effortlessly pick and place elements, eliminating the need to create components from scratch. For developers, this means no complex coding – all components are sourced from the Ionic Framework. The result is a speedy, efficient, and collaborative process, making the Ionic Design Kit essential for both designers and developers.

A Rating & Review Screen is essential for apps that rely on user feedback, such as e-commerce, food delivery, booking, and service-based platforms. It allows users to leave feedback, share opinions, and rate their experiences. A well-designed Rating & Review Screen can boost credibility, enhance user trust, and help future users make informed decisions.

This guide will walk you through the process of designing and implementing a Rating & Review Screen using the Ionic Design Kit. By leveraging its design elements and the Ionic Framework, you can create a visually appealing, intuitive, and functional screen that encourages user engagement.

1. Install Ionic CLI with the command

Creating a project with the Ionic CLI

npm i -g @ionic/cli

2. Create a new project

To create a new project, run the following command.

ionic start feedback blank --type=react

3. Get inside the project directory

cd feedback

4. Create a Feedback page

Create page Feedback.tsx inside src/pages and add code.

import { IonPage } from '@ionic/react';

const Feedback: React.FC = () => {
  return (
    <IonPage></IonPage>
  );
};

export default Feedback;

Please make sure that you've added routing in src/App.tsx for the created page. All Ionic framework components that will be used below should be imported similarly to the IonPage component.

5. Select the layout structure

For convenience, we will be using the layout structure recommended by Ionic for all screens. This allows us to add header code and content inside the IonPage.

<IonPage>
  <IonHeader>
    <IonToolbar>
    ...
    </IonToolbar>
  </IonHeader>
  <IonContent>
  ...
  </IonContent>
</IonPage>

6. Place the Back button component

Inside the IonToolbar component, add an IonButtons component with the slot set to start, positioning the button at the beginning of the toolbar. Also, add className='ion-padding-start' to provide padding at the start.

Within the IonButtons component, include an IonBackButton component with the properties defaultHref='#' and text=''. This creates a back button that navigates back in the app's history when clicked. To customize the default icon, set the icon property to {chevronBack}. Ensure that {chevronBack} has been imported correctly from Ionic icons.

import { chevronBack } from "ionicons/icons";
...
<IonHeader>
    <IonToolbar>
        <IonButtons slot='start' className='ion-padding-start'>
            <IonBackButton defaultHref='#' text='' icon={chevronBack} />
        </IonButtons>
    </IonToolbar>
</IonHeader>

7. Put the title on top of the page

Place the IonTitle with the text 'Feedback' to add a title for this page.

<IonHeader>
    <IonToolbar>
        <IonButtons slot='start' className='ion-padding-start'>
            <IonBackButton defaultHref='#' text='' icon={chevronBack} />
        </IonButtons>
        <IonTitle>Feedback</IonTitle>
    </IonToolbar>
</IonHeader>

8. Place the Close button

Inside the IonToolbar component, add an IonButtons component with the slot set to end, positioning the button at the ending of the toolbar. Also, add className='ion-padding-end' to provide padding at the end.

Within the IonButtons component, incorporate the IonButton with IonIcon component inside with slot property to icon-only and icon to {closeOutline}.

<IonHeader>
    <IonToolbar>
        <IonButtons slot='start' className='ion-padding-start'>
            <IonBackButton defaultHref='#' text='' icon={chevronBack} />
        </IonButtons>
        <IonTitle>Feedback</IonTitle>
        <IonButtons slot='end' className='ion-padding-end'>
            <IonButton>
                <IonIcon icon={closeOutline} color='primary'/>
            </IonButton>
        </IonButtons>
    </IonToolbar>
</IonHeader>

This concludes our work with IonHeader, and the following sections will cover working with IonContent.

9. Add the heading

Inside the IonContent, the IonText component is used to wrap an <h1> heading element with the text 'Pizza'. The heading is styled with a class, ion-text-center, to align the text at the center. This structure ensures semantic and visually appealing text content in Ionic applications.

<IonContent>
    <IonText>
        <h1 className='ion-text-center'>
          Pizza
        </h1>
    </IonText>
</IonContent>

10. Display an image

The IonCard acts as a container for the content, while the IonImg component is used to display an image. The src attribute specifies the image file, and the alt attribute provides alternative text for accessibility and cases where the image cannot load. This structure is ideal for presenting visual content with a clean, card-based design.

<IonContent>
    ...
    <IonCard>
        <IonImg src='pizza.jpg' alt='image' />
    </IonCard>
</IonContent>

11. Create a star button

The IonButton component is styled with the fill='clear' property, which removes the button's background and border, making it blend seamlessly with the design. Inside the button, an IonIcon component displays a star icon, with slot='icon-only' ensuring only the icon is visible. Wrapping this in a <div> with a stars-box class provides a container for additional styling or layout adjustments. This setup is perfect for rating systems or decorative elements in an app.

<IonContent>
    ...
    <div className='stars-box'>
        <IonButton fill='clear'>
            <IonIcon icon={star} slot='icon-only'/>
        </IonButton>
    </div>
</IonContent>

12. Add more star buttons

Repeat the previous step to add other buttons.

<IonContent>
    ...
    <div className='stars-box'>
        <IonButton fill='clear'>
            <IonIcon icon={star} slot='icon-only'/>
        </IonButton>
        <IonButton fill='clear'>
            <IonIcon icon={star} slot='icon-only'/>
        </IonButton>
        <IonButton fill='clear'>
            <IonIcon icon={star} slot='icon-only'/>
        </IonButton>
        <IonButton fill='clear'>
            <IonIcon icon={star} slot='icon-only'/>
        </IonButton>
        <IonButton fill='clear'>
            <IonIcon icon={starHalf} slot='icon-only'/>
        </IonButton>
    </div>
</IonContent>

13. Add a text

This code demonstrates how to create a prompt in an Ionic application using the IonText component. The text 'What did you enjoy the most?' is wrapped inside a <p> tag for semantic correctness, while the ion-padding-start class adds left padding to align the content visually. This setup is useful for displaying questions or instructions within a form or feedback section in a user-friendly layout.

<IonContent>
    ...
    <IonText>
        <p className='ion-padding-start'>
          What did you enjoy the most?
        </p>
    </IonText>
</IonContent>

14. Display feedback options

Use the IonChip component to create a set of interactive chips for user feedback. The chips are placed inside a <div> with the ion-padding-horizontal class to add horizontal spacing. Each IonChip is styled with the color='primary' property for a consistent appearance, while the outline={true} property is applied to some chips to make them appear outlined instead of filled. These chips are ideal for presenting feedback options, tags, or categories in an aesthetically pleasing and functional layout.

<IonContent>
    ...
    <div className='ion-padding-horizontal'>
        <IonChip color='primary' outline={true}>
            Excellent value for money
        </IonChip>
        <IonChip color='primary'>
            Good amount of food
        </IonChip>
        <IonChip color='primary'>
            Delicious food
        </IonChip>
        <IonChip color='primary' outline={true}>
            Fast delivery
        </IonChip>
    </div>
</IonContent>

15. Add a comment section

To create a simple comment section using the IonText and IonTextarea components. The IonText component includes a paragraph with the label 'Comment', styled using the ion-padding-start class for proper alignment. Below it, the IonTextarea component provides a multi-line text input field with a placeholder text, 'Tell us what you liked and didn’t like...'. This layout is ideal for collecting user feedback or comments in a structured and user-friendly format.

<IonContent>
    ...
    <IonText>
        <p className='ion-padding-start'>
          Comment
        </p>
    </IonText>
    <IonTextarea placeholder="Tell us what you liked and didn't like..." />
</IonContent>

16. Add the Feedback button

To create a feedback submission button using the IonButton component. The expand='block' property makes the button span the full width of its container, creating a prominent call-to-action element. The ion-padding-horizontal class ensures consistent horizontal padding for alignment with other components. The button text, 'Send feedback', clearly conveys its purpose, making it suitable for forms or feedback sections.

<IonContent>
    ...
    <IonButton expand='block' className='ion-padding-horizontal'>
        Send feedback
    </IonButton>
</IonContent>

Thank you for joining us on this exciting journey thus far. Stay tuned for more guides in our comprehensive series, where we'll not only delve into various aspects of mobile app development but also showcase how the Ionic Kit can be your game-changer.

Are you prepared to elevate your Ionic experience? Explore the advantages of incorporating the Ionic Design Kit for intuitive designs and seamless development. May your coding journey be marked by continual innovation and triumphant achievements!

Looking for Ionic kit for you platform?
Ionic Sketch
Ionic Figma
Ionic XD