shadcn.io is not affiliated with official shadcn/ui
Last Reviewed FAQ Block for React
A FAQ for a returns portal that shows how recently each answer was reviewed, with four dots and words in a mark column, and a switch to keep this quarter's.
Installation
Overview
A FAQ that says how fresh each answer is, for React with Base UI. Five questions sit in hairline rows that run from rail to rail, with a mark column at the end of every row: four small dots filled by how recently the answer was reviewed, and the words beside them. The server renders neutral words; once the page is in the browser they become relative time, such as "Reviewed last month". A switch in the header keeps only the answers reviewed this quarter. There is never a printed date. It's built from Accordion, Switch and Guides, with CSS transitions for the entrance and your theme's tokens for every colour. For returns, shipping and policy pages whose answers go out of date.
FAQ
Where do the words come from?
From days on each question, the number of days since it was reviewed. On the server, and on the first paint in the browser, the words are the neutral ones for its level (this month, this quarter, this year, over a year ago), so what the server sends and what hydrates match. Right after, an effect switches them to relative time from Intl.RelativeTimeFormat ("Reviewed 3 days ago", "Reviewed last week"). days is a stand-in: in your app, compute it from the page's real review time, for example Math.floor((Date.now() - reviewedAt) / 86_400_000) inside that effect.
What do the dots mean?
Four filled is reviewed within a month, three within a quarter, two within a year, one is older. The dots are decorative and hidden from assistive technology; the words carry the same meaning as text.
What does the switch do?
Reviewed this quarter keeps the questions reviewed within about three months and hides the rest, with the count in a polite live region ("3 of 5 questions"). The list keeps its height for the full set.
The switch takes checked and onCheckedChange, with a plain boolean.
Can I change the language of the relative time?
Yes. RELATIVE is created with the "en" locale: pass your page's own, and change the "Reviewed" prefix and the neutral words in bucketWords to match.
Related
- Pro
Revision History FAQ
Proof and freshnessA FAQ for a policy-management app whose answers carry a revision history: a Revised badge, a revision number on every row, and a switch to show only what changed.
- Pro
Status FAQ
Proof and freshnessAn FAQ for a hosting platform where each question belongs to a service and shows that service's state, with a summary counted from the rows.
- Pro
Popularity Bars FAQ
Votes and reactionsA FAQ for a tea shop ordered by how often each answer is read: a count column at the end of every row and a thin bar under each question, as long as its count.
- Pro
Print-Friendly FAQ
Reading and sharingAn FAQ you can take on the trail, for a park visitor service: eight accordion rows, a Print this FAQ button and real print styles that open every answer and drop the controls.
- Pro
Accordion FAQ
Accordion listsA side-header FAQ for a web analytics tool: the title, one sentence and a contact prompt beside seven questions in an accordion, behind a split divider.
- Pro
Animated Counter FAQ
Proof and freshnessA side-header FAQ for an analytics tool: one large figure that counts up to this week's answered questions, the topics behind it, and seven questions in an accordion.