Data Displayratingdatagraph
Rating Distribution
Five-star review distribution breakdown.
Live Preview
5β
4β
3β
Usage
Copy and paste this code into your React component:
tsx
import { RatingBreakdownBar } from 'react-component-kit-ui/data';
<RatingBreakdownBar>Content</RatingBreakdownBar>Manual Installation
If you are not using the npm package, create a new file and paste the following code: src/components/RatingBreakdownBar.tsx + RatingBreakdownBar.css:
RatingBreakdownBar.tsx
'use client';
import './RatingBreakdownBar.css';
/** RatingBreakdownBar β ported from astro-component-kit. */
export interface RatingBreakdownBarProps {
}
export function RatingBreakdownBar({}: RatingBreakdownBarProps) {
return (
<>
<div className="rating-box" data-rk-5d3b8d="">
<div className="r-row" data-rk-5d3b8d=""><span data-rk-5d3b8d="">5β
</span><div className="bar-bg" data-rk-5d3b8d=""><div className="bar-val" style={{ width: "80%" }} data-rk-5d3b8d=""></div></div></div>
<div className="r-row" data-rk-5d3b8d=""><span data-rk-5d3b8d="">4β
</span><div className="bar-bg" data-rk-5d3b8d=""><div className="bar-val" style={{ width: "15%" }} data-rk-5d3b8d=""></div></div></div>
<div className="r-row" data-rk-5d3b8d=""><span data-rk-5d3b8d="">3β
</span><div className="bar-bg" data-rk-5d3b8d=""><div className="bar-val" style={{ width: "5%" }} data-rk-5d3b8d=""></div></div></div>
</div>
</>
);
}
export default RatingBreakdownBar;RatingBreakdownBar.css
/* RatingBreakdownBar β ported from astro-component-kit (data/RatingBreakdownBar.astro) */
.rating-box:where([data-rk-5d3b8d]) { display: flex; flex-direction: column; gap: 8px; width: 220px; }
.r-row:where([data-rk-5d3b8d]) { display: flex; align-items: center; gap: 10px; color: #94a3b8; font-size: 0.75rem; font-weight: 700; }
.bar-bg:where([data-rk-5d3b8d]) { flex: 1; height: 6px; background: rgba(255,255,255,0.05); border-radius: 3px; border: 1px solid rgba(255, 255, 255, 0.03); }
.bar-val:where([data-rk-5d3b8d]) { height: 100%; background: #fbbf24; border-radius: inherit; box-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }Quick Info
- Category
- Data Display
- Filename
RatingBreakdownBar.tsx- Dependencies
- None β pure React + CSS
- Tags
- ratingdatagraph