BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcncraft/star-rating

Star Rating

shadcncraft/star-rating
FreeComponent

A component that displays ratings with stars and an optional label. This component builds trust with visual feedback.

Install it

npx shadcn@latest add https://shadcncraft.com/r/star-rating.json

Source

components/shadcncraft/pro-marketing/star-rating.tsxshadcncraft.com/r/star-rating.json
1import * as React from "react";
2
3import { IconPlaceholder } from "@/registry/icons/icon-placeholder";
4import { cn } from "@/lib/utils";
5
6type StarRatingProps = {
7 value: number;
8 max?: number;
9 label?: string;
10 size?: "sm" | "md" | "lg";
11 orientation?: "vertical" | "horizontal";
12 /**
13 * Precision for partial stars. If set, the component will fill each star
14 * proportionally (e.g., 3.2 -> 60% of the 4th star). Defaults to true.
15 */
16 allowPartial?: boolean;
17 containerClassName?: string;
18};
19
20export function StarRating({
21 value,
22 max = 5,
23 label,
24 size = "lg",
25 orientation = "vertical",
26 allowPartial = true,
27 className,
28 containerClassName,
29 ...props
30}: StarRatingProps & Omit<React.ComponentProps<"div">, "children">) {
31 const safeMax = Math.max(1, Math.floor(max));
32 const clampedValue = Math.max(0, Math.min(value, safeMax));
33
34 return (
35 <div
36 data-size={size}
37 data-orientation={orientation}
38 data-slot="star-rating"
39 className={cn(
40 "flex flex-col items-center gap-1.5",
41 "data-[orientation=horizontal]:flex-row",
42 "data-[size=lg]:[--star-size:calc(--spacing(5))] data-[size=md]:[--star-size:calc(--spacing(4))] data-[size=sm]:[--star-size:calc(--spacing(3))]",
43 containerClassName
44 )}
45 aria-label={`${clampedValue} out of ${safeMax} stars`}
46 role="img"
47 {...props}
48 >
49 <div className={cn("flex items-center gap-0.5", className)}>
50 {Array.from({ length: safeMax }).map((_, index) => {
51 const starIndex = index + 1;
52 const filledRatio = allowPartial
53 ? Math.max(0, Math.min(1, clampedValue - index))
54 : clampedValue >= starIndex
55 ? 1
56 : 0;
57
58 return (
59 <span key={index} className="relative inline-flex" aria-hidden="true">
60 {/* Base (unfilled) star */}
61 <IconPlaceholder
62 lucide="Star"
63 tabler="IconStar"
64 hugeicons="StarIcon"
65 phosphor="StarIcon"
66 remixicon="RiStarLine"
67 className="size-(--star-size)"
68 />
69 {/* Filled overlay */}
70 {filledRatio > 0 ? (
71 <span
72 className="absolute inset-0 overflow-hidden"
73 style={{ width: `${filledRatio * 100}%` }}
74 >
75 <IconPlaceholder
76 lucide="Star"
77 tabler="IconStar"
78// … truncated

Files it writes

  • components/shadcncraft/pro-marketing/star-rating.tsx

Facts

Registry
shadcncraft
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
In the index
at or before 2026-08-05
Last confirmed
today

Go to the source

shadcncraft.com Raw registry item This item as JSON

More from shadcncraft

All 26 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Avatar Stackavatar-stackshadcncraftComponentsFreeno deps
BadgebadgeshadcncraftComponentsFreeno deps
Featured Iconfeatured-iconshadcncraftComponentsFreeno deps
Image Zoomimage-zoomshadcncraftComponentsFree1 dep
MarqueemarqueeshadcncraftComponentsFreeno deps
Page Headingpage-headingshadcncraftComponentsFreeno deps
Placeholder Logoplaceholder-logoshadcncraftComponentsFreeno deps
Profile Cardprofile-cardshadcncraftComponentsFreeno deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex