salla-rating-modal
The modal where a customer rates an order: its products, and (when available) the store and shipping, with optional comments, images and videos.
The modal where a customer rates an order: its products, and (when available) the store and shipping, with
optional comments, images and videos. Add it once to the order details page (or any page that lets customers
review) and open it with open() or by dispatching the rating::open event. It loads the order's rating data
itself and renders the rating UI through an inner salla-rating-modal-v2 element.
Events it listens to: rating::open (detail {orderId?, productId?}; orderId defaults to the current page ID),
rating::edit and rating::delete (open the edit and delete-confirmation dialogs). It dispatches rating::ready
with the component instance once loaded.
Use it
In HTML or JSX, use the tag <salla-rating-modal> with the Attribute names below. In React, the wrapper takes the Property names (camelCase).
import { SallaRatingModal } from '@salla.sa/twilight-components-react/rating-modal';Client-only. On the server this wrapper renders a placeholder (a skeleton, or nothing), and the real component mounts in the browser. Do not rely on it for content that search engines must see.
Example
import { SallaRatingModal } from '@salla.sa/twilight-components-react/rating-modal';
export function Example() {
return (
<SallaRatingModal />
);
}import { SallaRatingModal } from '@salla.sa/twilight-components-react/rating-modal';
export function Example() {
return (
<SallaRatingModal orderId="123456" productId="789" />
);
}// Open it for an order from JavaScript
salla.event.dispatch('rating::open', { orderId: 123456 });Properties
| Property | Attribute | Description | Type | Default |
|---|---|---|---|---|
orderId | order-id | The ID of the order to rate its products and shipping. Defaults to the current page ID (page.id in the store config). Explicitly null means an unverified (no order) product review, which also needs product-id. | number | string | |
productId | product-id | Limits the rating to a single product of the order (and skips the testimonial step). Leave unset to rate all unrated products. Combine with order-id set to null (via setOrder) for an unverified product review. | number | string |
Methods
Call these on the element or a React ref.
close() => Promise<HTMLElement>
Closes the rating modal.
Returns Promise<HTMLElement>: A Promise that resolves when the modal has been asked to close.
open() => Promise<unknown>
Opens the rating modal for the current orderId (or page ID) and productId.
Returns Promise<unknown>: A Promise that resolves when the modal has been asked to open.
setOrder(orderId: number | string | null, productId?: number | string) => Promise<void>
Point the modal at a different order/product and invalidate any cached
order so the next open() re-fetches instead of reusing stale data.
Pass orderId as null for an eligible-but-unverified product review.
| Parameter | Type | Description |
|---|---|---|
orderId | string | number | The order ID, or null for an unverified product review. |
productId | string | number | Optional product ID to limit the rating to one product. |
Related
Renders: <salla-modal>, <salla-button>, <salla-rating-stars>, <salla-file-upload>, <salla-rating-modal-v2>, <salla-skeleton>, <salla-placeholder>.
Used inside: <salla-orders>, <salla-verified-review>.
salla-comments
Lists the comments or reviews for a page, product or blog post, with a sort dropdown, a "load more" button and, unless hidden, a form to add a comment.
salla-rating-stars
Shows a five star rating, either as a read-only display of a score or as an input the customer clicks to pick a rating.