···1616}
17171818export const toasts = new ToastQueue<ToastContentType>({
1919- // Wrap state updates in a CSS view transition.
1919+ // Run toast updates synchronously. Do NOT use startViewTransition here: it
2020+ // captures the entire page and animates elements with view-transition-name
2121+ // (e.g. recipe card images when hovered), causing a "loses shape" glitch when
2222+ // favoriting recipes. Toasts use their own React Stately animations.
2023 wrapUpdate(fn) {
2121- if ("startViewTransition" in document) {
2222- document.startViewTransition(() => {
2323- // eslint-disable-next-line @eslint-react/dom/no-flush-sync
2424- flushSync(fn);
2525- });
2626- } else {
2727- fn();
2828- }
2424+ flushSync(fn);
2925 },
3026});
···11+---
22+title: Star Rating
33+description: A rating component with half-star support.
44+---
55+66+import { PropDocs } from "../../../lib/PropDocs";
77+import { Example } from "../../../lib/Example";
88+import { Basic } from "../../../examples/star-rating/basic";
99+import { Interactive } from "../../../examples/star-rating/interactive";
1010+import { Sizes } from "../../../examples/star-rating/sizes";
1111+1212+<Example src={Basic} />
1313+1414+## Installation
1515+1616+Run the following command to add the star-rating component to your project.
1717+1818+```bash
1919+pnpm hip install star-rating
2020+```
2121+2222+## Props
2323+2424+<PropDocs components={["StarRating", "StarRatingInput"]} />
2525+2626+## Features
2727+2828+### Interactive
2929+3030+Use `StarRatingInput` for user-selectable ratings.
3131+Supports click, hover preview, and keyboard (arrow keys).
3232+Use `value` and `onChange` for controlled mode, or `defaultValue` for uncontrolled.
3333+3434+<Example src={Interactive} />
3535+3636+### Half-star support
3737+3838+The component supports decimal ratings from 0 to 5.
3939+Values between 0.25 and 0.74 display a half star.
4040+Values of 0.75 and above round up to a full star.
4141+4242+### Sizes
4343+4444+The `size` prop controls the star icon size in pixels (default 16).
4545+Both read-only and interactive variants support custom sizes.
4646+4747+<Example src={Sizes} />
4848+4949+### Review count
5050+5151+Optionally display the number of reviews next to the rating.
5252+5353+## Related Components
5454+5555+- [Badge](/docs/components/badge) - For status indicators
5656+- [Meter](/docs/components/meter) - For numeric gauges and progress
5757+- [ProgressBar](/docs/components/progress-bar) - For completion status
···11+import type { ComponentConfig } from "../../types";
22+33+export const starRatingConfig: ComponentConfig = {
44+ name: "star-rating",
55+ filepath: "./index.tsx",
66+};
+3
pnpm-lock.yaml
···5367536753685368 glob@10.4.5:
53695369 resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==}
53705370+ deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
53705371 hasBin: true
5371537253725373 glob@11.0.3:
53735374 resolution: {integrity: sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==}
53745375 engines: {node: 20 || >=22}
53765376+ deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me
53755377 hasBin: true
5376537853775379 globals@14.0.0:
···80118013 whatwg-encoding@3.1.1:
80128014 resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==}
80138015 engines: {node: '>=18'}
80168016+ deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation
8014801780158018 whatwg-mimetype@4.0.0:
80168019 resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==}