{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"review-cards-compact","type":"registry:component","title":"Review cards · Compact list","description":"Dense rows with star lines and optimistic helpful votes whose counts roll.","author":"GetUrUI <hello@geturui.dev>","dependencies":["motion","lucide-react"],"registryDependencies":[],"files":[{"path":"registry/geturui/examples/review-cards/compact.tsx","type":"registry:component","target":"components/examples/review-cards/compact.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { Star, ThumbsDown, ThumbsUp } from \"lucide-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface CompactReview {\n  id: string;\n  author: string;\n  initials: string;\n  rating: number;\n  /** Formatted date, e.g. \"2 days ago\" or \"Sep 28\". */\n  date: string;\n  text: string;\n  /** Existing helpful votes. */\n  up: number;\n  down: number;\n}\n\nexport interface CompactReviewListProps {\n  title?: string;\n  reviews?: CompactReview[];\n  onVote?: (id: string, vote: \"up\" | \"down\" | null) => void;\n  className?: string;\n}\n\nconst DEFAULT_REVIEWS: CompactReview[] = [\n  { id: \"r1\", author: \"Jonas Weber\", initials: \"JW\", rating: 5, date: \"Sep 29\", text: \"Battery easily lasts a full week of commuting. The case magnets are strong without being fiddly.\", up: 24, down: 1 },\n  { id: \"r2\", author: \"Amara Osei\", initials: \"AO\", rating: 4, date: \"Sep 26\", text: \"Great noise cancelling on trains. Ear tips run a little small, the medium pair is tight for me.\", up: 11, down: 2 },\n  { id: \"r3\", author: \"Leo Martín\", initials: \"LM\", rating: 3, date: \"Sep 21\", text: \"Sound is good, but the touch controls trigger when I adjust them. Turned gestures off in the app.\", up: 7, down: 4 },\n];\n\nconst focus = \"outline-none focus-visible:shadow-[var(--focus-ring)]\";\n\nfunction Count({ value, reduce }: { value: number; reduce: boolean }) {\n  return (\n    <span className=\"relative inline-flex h-4 min-w-[1.25rem] overflow-hidden tabular-nums\">\n      <AnimatePresence mode=\"popLayout\" initial={false}>\n        <motion.span\n          key={value}\n          initial={reduce ? { opacity: 0 } : { y: \"100%\", opacity: 0 }}\n          animate={{ y: 0, opacity: 1 }}\n          exit={reduce ? { opacity: 0 } : { y: \"-100%\", opacity: 0 }}\n          transition={{ type: \"spring\", stiffness: 500, damping: 34 }}\n        >\n          {value}\n        </motion.span>\n      </AnimatePresence>\n    </span>\n  );\n}\n\n/** Dense review list: one row per review with a star line, and optimistic helpful votes whose counts roll as you tap. */\nexport function CompactReviewList({ title = \"Most helpful reviews\", reviews = DEFAULT_REVIEWS, onVote, className }: CompactReviewListProps) {\n  const reduce = useReducedMotion() ?? false;\n  const [votes, setVotes] = React.useState<Record<string, \"up\" | \"down\" | undefined>>({});\n\n  function vote(id: string, v: \"up\" | \"down\") {\n    const next = votes[id] === v ? undefined : v;\n    setVotes((s) => ({ ...s, [id]: next }));\n    onVote?.(id, next ?? null);\n  }\n\n  return (\n    <section aria-label={title} className={cn(\"w-full max-w-[460px] rounded-xl border border-border bg-surface-raised shadow-sm\", className)}>\n      <header className=\"flex items-center justify-between px-5 pb-2 pt-4\">\n        <h3 className=\"text-sm font-semibold text-ink\">{title}</h3>\n        <span className=\"font-mono text-[11px] text-ink-subtle\">{reviews.length} reviews</span>\n      </header>\n      <ul className=\"divide-y divide-border\">\n        {reviews.map((r, i) => {\n          const mine = votes[r.id];\n          return (\n            <motion.li\n              key={r.id}\n              initial={reduce ? false : { opacity: 0, y: 8 }}\n              animate={{ opacity: 1, y: 0 }}\n              transition={{ type: \"spring\", stiffness: 320, damping: 30, delay: reduce ? 0 : i * 0.06 }}\n              className=\"flex gap-3 px-5 py-4\"\n            >\n              <span aria-hidden className=\"grid size-8 shrink-0 place-items-center rounded-full bg-surface-sunken font-mono text-[11px] font-semibold text-ink\">\n                {r.initials}\n              </span>\n              <div className=\"min-w-0 flex-1\">\n                <div className=\"flex flex-wrap items-center gap-x-2 gap-y-0.5\">\n                  <p className=\"text-[13px] font-semibold text-ink\">{r.author}</p>\n                  <span className=\"flex gap-px\" role=\"img\" aria-label={`${r.rating} out of 5`}>\n                    {Array.from({ length: 5 }, (_, s) => (\n                      <Star key={s} aria-hidden className={cn(\"size-3\", s < r.rating ? \"text-volt-ink\" : \"text-ink-subtle/35\")} fill=\"currentColor\" strokeWidth={0} />\n                    ))}\n                  </span>\n                  <span className=\"ml-auto text-[11px] text-ink-subtle\">{r.date}</span>\n                </div>\n                <p className=\"mt-1 text-[13px] leading-relaxed text-ink-muted\">{r.text}</p>\n                <div className=\"mt-2.5 flex items-center gap-1.5 text-[11.5px] text-ink-subtle\">\n                  <span className=\"mr-1\">Helpful?</span>\n                  {([\"up\", \"down\"] as const).map((v) => {\n                    const on = mine === v;\n                    const Icon = v === \"up\" ? ThumbsUp : ThumbsDown;\n                    const n = (v === \"up\" ? r.up : r.down) + (on ? 1 : 0);\n                    return (\n                      <motion.button\n                        key={v}\n                        type=\"button\"\n                        aria-pressed={on}\n                        aria-label={`${v === \"up\" ? \"Yes\" : \"No\"}, ${n} votes`}\n                        whileTap={reduce ? undefined : { scale: 0.9 }}\n                        onClick={() => vote(r.id, v)}\n                        className={cn(\n                          \"inline-flex h-7 items-center gap-1 rounded-full px-2 font-medium transition-colors\",\n                          on ? (v === \"up\" ? \"bg-volt-soft text-volt-ink\" : \"bg-surface-sunken text-ink\") : \"hover:bg-surface-hover hover:text-ink\",\n                          focus,\n                        )}\n                      >\n                        <Icon aria-hidden className=\"size-3.5\" fill={on ? \"currentColor\" : \"none\"} />\n                        <Count value={n} reduce={reduce} />\n                      </motion.button>\n                    );\n                  })}\n                </div>\n              </div>\n            </motion.li>\n          );\n        })}\n      </ul>\n    </section>\n  );\n}\n"},{"path":"LICENSE-geturui.md","type":"registry:file","target":"LICENSE-geturui.md","content":"MIT License\n\nCopyright (c) 2026 geturui.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"}],"categories":["examples","reviews","rating","stars","testimonial","ecommerce","feedback","histogram","card"],"meta":{"tier":"free","license":"MIT","docs":"https://geturui.com/docs/review-cards#compact"}}