Skip to main contentSkip to Content
Skip to Content
DevelopersHTML & JS

HTML & JS

Reviews are rendered with Liquid, so they are readable without JavaScript. The FiveOh script, loaded by the FiveOh Core app embed, only adds interaction: loading more reviews, sorting, filtering, searching, submitting forms and moving sliders. It reacts to the custom elements and data-fo-* attributes below, never to CSS classes, so your markup and classes stay entirely yours.

For complete examples, see the Review List, Review Form and Reviews Slider.

JS reacts only to the elements and data-fo-* attributes below, never to CSS classes.

Elements

ElementPurpose
<fo-reviews>Review list with load more, sort, filter, search
<fo-review-form>Review form: validation, uploads, submit
<fo-slider>Carousel buttons for any scroll-snap track

Actions (data-fo-action)

ValueWhereEffect
load-more<fo-reviews>Appends the next page
sort<fo-reviews>, on a <select> or a button with valueReloads sorted by the value; sets aria-pressed on sort buttons
search<fo-reviews>, on an <input>Reloads with the search term on Enter or on submit of its form
filter<fo-reviews>, with data-fo-filterToggles the filter; sets aria-pressed
filter<fo-reviews>, on a <select>Sets the selected filter, replacing the one it set before; empty value clears it
slide-prev, slide-next<fo-slider>Scrolls the track
open-modalanywhereOpens the <dialog> named by aria-controls; on a media link without it, opens the image or video in a dialog
close-modalanywhereCloses the <dialog> named by aria-controls, else the one it is in
submit-all<fo-review-form> with itemsSubmits every item that is idle or error

Slots

AttributeMeaning
data-fo-itemsContainer the review items or form items are rendered into
data-fo-template="review"<template> with the markup for loaded reviews
data-fo-template="item"<template> inside <fo-review-form>: the form loads the review request from the URL’s id and renders one item per product into data-fo-items
data-fo-itemRoot of one rendered form item; holds its own <form data-fo-form> and data-fo-state
data-fo-field="name"Sets the element’s text; name:attribute sets an attribute, name:--property a CSS custom property
data-fo-if="name"Removed when the value is empty; outside templates (has_next_page, error_message) hidden instead
data-fo-repeat="name"Repeats a child <template> per entry, e.g. media
data-fo-show="state"Shown only in these states, separated by spaces, e.g. idle error. Follows the nearest data-fo-item, else <fo-review-form>
data-fo-trackScroll container of <fo-slider>
data-fo-formThe <form> inside <fo-review-form>
data-fo-review-handleHandle of a rendered review
data-fo-filterFilter value: rating:1 … rating:5, status:verified, status:unverified, product:<id> (only reviews of the whole product, not of one of its variants), variant:<id>

Fields of a loaded review, for data-fo-field, data-fo-if and data-fo-repeat in <template data-fo-template="review">:

FieldHolds
handleThe review’s handle
titleTitle, translated
bodyReview text, translated
authorPublic author name
ratingStar rating, 1 to 5. Draw stars with <span class="fo-stars" data-fo-field="rating:--fo-rating"></span>
dateWhen it was written, as a short date in the shopper’s language, like Oct 13, 2026
statusverified_buyer, verified_reviewer or unverified
status_labelThe status as text, like “Verified Buyer”
merchant_replyYour reply, translated
reply_dateWhen you replied, formatted like date
product, variantProduct and variant title, for reviews of the current page’s product
mediaPhotos and videos; each entry has url, image_url and video_url
additional_attributesAttribute answers; each entry has attribute_id, question, label, left_label, right_label and, for scales, percent
has_next_pageWhether more reviews can be loaded
error_messageThe error, when loading failed

Fields inside <fo-review-form>:

FieldHolds
error_messageThe error, when sending failed
progressUpload progress, 0 to 100
filesThe picked files, for data-fo-repeat; each entry has name

Fields of a form item, inside <template data-fo-template="item">:

FieldHolds
product_title, variant_titleTitles of the product to review
image_urlThe variant’s image, else the product’s
urlThe product’s page
review_handle, submitted_atSet when the item was already reviewed

State

WhereAttributeValues
<fo-review-form>, [data-fo-item]data-fo-stateloading (items load) | idle | submitting | success | error | reviewed (already reviewed)
<fo-reviews>aria-busytrue while loading
Filter and sort buttonsaria-pressedtrue | false
Slider buttonsdisabledSet at the start and end of the track

Config (on the element)

AttributeHolds
data-fo-product-idThe product whose reviews to load or review
data-fo-variant-idThe variant
data-fo-page-sizeReviews per page
data-fo-totalTotal number of reviews; load more hides once all are shown
data-fo-sortStart order: submitted_at:desc, submitted_at:asc, rating:desc or rating:asc
data-fo-scopeWhich reviews: product, store or mixed
data-fo-text-*Texts only the script shows. English when not set: see the table below

Texts for data-fo-text-*:

AttributeElementShown when
data-fo-text-error<fo-reviews>, <fo-review-form>Loading or sending failed
data-fo-text-anonymous<fo-reviews>A loaded review has no author name
data-fo-text-missing-rating<fo-review-form>The form is sent without a star rating
data-fo-text-upload-failed<fo-review-form>A photo or video could not be uploaded
data-fo-text-test-mode<fo-review-form>A review is sent from the post-purchase form’s preview

Form fields

rating, title, body, author, media; attribute[<attribute_id>] is reserved. Layout is free. An author input outside the item forms applies to all items and is pre-filled with the order’s first name.

CSS custom properties

--fo-rating (0–5) and --fo-percent (0–100) on any element; the optional base CSS uses them for stars and bars.

<span class="fo-stars" style="--fo-rating: 4.6"></span> draws five stars filled to the rating (fo-base.css, loaded by our blocks and the card ratings embed). Style with --fo-star-color and --fo-star-size.

Last updated on