App Store Rating Prompt Modal — Free HTML CSS JS Snippet

App Store Rating Prompt Modal · Modals · Plain HTML, CSS & JS · Live preview

Share & Support

What's included

Features

Star-gated branching flow
A single if statement on the clicked star value decides between the public and private paths.
Four steps, one visibility switch
showStep() hides every step but the target, keeping all flow state in one simple function.
Hover preview with committed-state restore
Mouseleave restores the highlight to the last clicked rating, not to zero.
Shared terminal "done" step
Both the store and feedback paths reuse one confirmation step with outcome-specific text.
Escape hatch on every step
"Not now", "Maybe later", and "Skip" all close the modal without forcing completion.
Click-outside-to-close overlay
Clicking the dimmed backdrop closes the modal, matching standard modal conventions.
Animated entrance
A spring-like scale-and-fade keyframe animation gives the modal a polished pop-in.
Zero dependencies
Pure HTML, CSS, and vanilla JavaScript — no modal or star-rating library.

About this UI Snippet

App Store Rating Prompt — Star-Gated Branching Flow

Screenshot of the App Store Rating Prompt Modal snippet rendered live

Native mobile apps rarely ask "please leave a public review" outright — instead they ask an in-app star question first, then route the response: happy users get sent to the App Store or Play Store to leave a public review, while unhappy users are redirected to a private feedback form instead of a public one-star review. This snippet reproduces that exact branching flow with four self-contained modal steps.

Four steps, one visibility switch

showStep(step) loops all four step elements and sets hidden on every one except the target, so only one step is ever visible at a time. This keeps all the flow's markup and state in a single DOM tree — no step needs to be dynamically created or destroyed, which keeps the routing logic in showStep() trivially simple.

The routing decision

Clicking a star calls highlightStars() to update the visual state, then branches on the star value: if (value >= 4) showStep(stepStore); else showStep(stepFeedback). This single if statement is the entire mechanism behind the pattern — a high rating leads to the public ask, a low rating leads to the private one, protecting the app's visible store rating from frustrated one-off complaints while still capturing that feedback internally.

Hover preview mirrors the half-star pattern

stars.forEach(star => star.addEventListener('mouseenter', () => highlightStars(value))) previews the rating on hover the same way a checkout star-rating input would, and mouseleave restores the highlight to the last *committed* star count (tracked by counting how many stars currently carry the .on class) rather than resetting to zero — so browsing past the stars without clicking doesn't lose the visual state.

A shared "done" step for two different outcomes

Both the store-redirect button and the feedback-submit button ultimately call showStep(stepDone), but each first sets doneTitle.textContent and doneSub.textContent to outcome-specific copy. Reusing one terminal step for both paths avoids duplicating the "all set" UI while still giving each path its own confirmation message.

Escape hatches at every step

"Not now," "Maybe later," and "Skip" are all wired to the same close() function, so a user can exit the flow from any point without being forced through every step — an unhappy user is never trapped between "give feedback" and "leave a review" with no way out.

Customizing it

Replace the asrpGoToStore handler's placeholder with a real window.location.href to your platform's store review URL (using the App Store's itms-apps:// deep link or the Play Store's review intent), and wire asrpSendFeedback to your actual support or feedback API.

Build with AI

Build, Understand, Optimize, and Extend It With AI

You don't have to work out the branching logic by hand. Paste this snippet's HTML, CSS, and JS into an AI coding assistant like Claude and ask it to explain how the single if (value >= 4) check in the star click handler drives the entire public-versus-private routing decision, and why showStep() hiding every step but one keeps the flow's state management simple compared to mounting and unmounting separate modals. The same assistant can help optimize it too — ask whether the flow should remember a user's previous rating in localStorage to avoid re-prompting too often. It's also useful for extending it: ask it to add a real analytics event on each step transition, support a configurable star threshold instead of a hardcoded 4, or add a "remind me later" delay using a stored timestamp. Treat the code less like a finished artifact and more like a starting point for a conversation.

Prompt to recreate it

Copy this into your AI assistant of choice to build the effect from scratch, or as a jumping-off point for your own variant:

text
Build an "app store rating prompt" modal in plain HTML, CSS, and JavaScript with no framework or library, using a branching multi-step flow.

Requirements:
- A trigger button that opens a centered modal overlay with a dimmed backdrop; clicking the backdrop itself (not the modal content) closes it.
- The modal's first step shows an app icon, a headline, and a row of 5 star icons that preview on hover (restoring to the last clicked rating when the pointer leaves the row, not resetting to zero) and commit on click.
- Clicking a star of value 4 or 5 must transition the modal to a "public review" step showing a button that represents redirecting to the platform's App Store or Play Store review page.
- Clicking a star of value 1, 2, or 3 must instead transition the modal to a private "feedback" step with a textarea for the user to describe what went wrong, and a submit button.
- Both the public-review step and the feedback step must ultimately lead to a single shared "done" confirmation step, with each path setting different heading and subtext content on that shared step before showing it.
- Every intermediate step must include an escape action (like "Not now", "Maybe later", or "Skip") that closes the modal entirely without forcing the user through the remaining steps.
- Manage all step visibility through one function that shows exactly one of the four steps at a time and hides the rest, rather than creating or destroying DOM elements per step.

Want to tighten it up first? Run this prompt through the AI Prompt Studio to score it across 8 quality dimensions, catch anti-patterns, and tune the wording for Claude, ChatGPT, or Gemini before you paste it in.

Step by step

How to Use

  1. 1
    Paste HTML, CSS, and JSA trigger button opens the rating prompt modal with a 5-star row.
  2. 2
    Hover and click a starHovering previews the rating; clicking commits it and routes the flow.
  3. 3
    Rate 4 or 5 starsThe flow shows a "Rate on the App Store" step with a public review call to action.
  4. 4
    Rate 1-3 starsThe flow instead shows a private feedback textarea, keeping the complaint out of the public store.
  5. 5
    Complete either pathBoth paths end on a shared "done" step with outcome-specific confirmation text.
  6. 6
    Wire up real destinationsReplace the store button's placeholder with your real App Store or Play Store review deep link, and connect the feedback form to your support API.

Real-world uses

Common Use Cases

Mobile app review requests
Reproduce the native "gate before store review" pattern inside a web or hybrid app shell.
SaaS product NPS-style prompts
Route happy users to a public review site (G2, Capterra) and unhappy ones to internal feedback.
Browser extension review prompts
Ask extension users for a Chrome Web Store or Firefox Add-ons rating using the same gate.
Post-purchase satisfaction surveys
Route satisfied customers to a public review platform and dissatisfied ones to support.
In-app support triage
Capture negative feedback privately before it becomes a public complaint.
Learning multi-step modal state
A clear example of driving a branching wizard flow from one shared step-visibility function.

Got questions?

Frequently Asked Questions

It's a widely used and generally accepted pattern (most major consumer apps use some version of it), but it does shape which sentiment becomes public. Many teams pair it with genuinely acting on the private feedback from low-rating users, rather than using it purely to suppress visible criticism — how you use the routed feedback matters more than the routing mechanism itself.

The star's click handler reads its data-v attribute as a number and checks if (value >= 4). Four or five stars shows the store-review step; one through three stars shows the private feedback step instead. Everything else in the flow is the same regardless of which branch is taken.

Both outcomes need the same basic "thanks, you're done" UI shell, so reusing one step avoids duplicating that markup and styling. Before showing it, each button handler sets doneTitle.textContent and doneSub.textContent to outcome-specific copy, so the shared step still shows the right message for whichever path was taken.

Replace the placeholder logic inside the asrpGoToStore click handler with window.location.href set to your app's actual store review URL — for iOS, an itms-apps:// URL with the action=write-review query parameter and your app's numeric ID; for Android, a Play Store URL with the same intent.

Yes — the "Not now" button already closes the modal without any rating being recorded. If you want an explicit "just leave feedback" option regardless of star count, add a link on the first step that calls showStep(stepFeedback) directly, bypassing the star-based routing.