shadcn.io is not affiliated with official shadcn/ui
Weekly Breakdown Bar Chart Stats Block for Radix UI
A week of screen time as seven cells in one band from rail to rail, each with the day, its time and a meter that fills from the foot, the lightest day marked with a badge; seven rows with horizontal meters on a phone.
Installation
Overview
A weekly breakdown for React with Radix UI. A start-aligned header names the lightest day of the week and its time, with the week total and the daily average at the end of the row. Under it the week is seven cells in one band that runs from rail to rail and ends the block: each cell has the weekday, the time as hours and minutes, and a meter that fills from the foot up to a full meter of seven hours. The lightest day carries an outline badge and a full-weight meter; the others are drawn at 35%. Below lg the seven cells become seven rows and the meters lie down, filling from the start. Every time, meter and total is computed from one list of daily minutes. The meters are CSS boxes in your theme's foreground colour, and the badge is the catalog's. For screen-time, usage and activity reports, between a hero and pricing.
FAQ
How do I change the days, the scale and the badge?
Edit DAYS (a name and the minutes for each day) and CEILING, the number of minutes a full meter stands for. The badge goes to whichever day has the fewest minutes; for a "busiest day" report, change LIGHTEST to Math.max and the badge's words to match. The times, the week total and average and the headline are computed from DAYS.
How do the two meters work?
Each cell draws one fill for a phone and one for lg and wider, from the same share, and shows only one of them: a horizontal fill from the start on a phone, a vertical fill from the foot from lg. Both are decorative and hidden from assistive technology, because the time is written in the cell. The meter box is left to right, so the fill starts at the same side in right-to-left pages.
Is it accessible?
The week is a list: each item reads the weekday, its time and, for the lightest day, the badge ("Thursday, 2h 48m, Lightest day"). The times sit in bdi elements, so a right-to-left page keeps "2h 48m" in order. The week total and average are a description list in the header.
Why is there no line under the band?
The band ends the block. The next section draws its own top rule along the band's foot, so a bottom border here would double it, and the column has no bottom padding for the same reason. The band's top rule, with a + on each rail, comes from the Guides component.