shadcn.io is not affiliated with official shadcn/ui
Count By Year Awards Block for React
A split for a flood-risk analytics tool: a header and a toggle at the start and, at the end, a ruled list of years from 2019 to 2025, each a horizontal bar and its count, counting either awards or programmes.
Installation
Overview
A count of awards by year for React with Base UI. At the start of a split sit a header with the tally counted from the list ("23 awards from 3 programmes since 2019") and a two-option toggle, Awards or Programmes. At the end is a ruled list of years, 2019 to 2025, each with a bar drawn from the count over the highest count and the number beside it; the best year is outlined and named in its row. Switching the toggle redraws every bar in place and a polite line says which year is best. The page's rails and top rule come from the Guides spine, and a divider with a + mark where it meets the top rule separates the halves. It's built from Guides, Toggle Group and your theme's tokens, with CSS transitions for the bars. The programmes and awards are made up for the example: replace them with your own.
FAQ
How do I change the awards?
Edit AWARDS at the top of the file. Each entry is a programme and a year, a fixed number: an award given in 2024 stays 2024. The years on the list run from the earliest to the latest year in the data, a year with no awards shows a zero, and the header's tally is counted from the same list, so it can't disagree with the bars.
What does the Programmes option count?
How many different programmes gave at least one award in that year, so a year with six awards from three programmes shows 6 under Awards and 3 under Programmes. Add a metric by adding an entry to METRICS whose rows come from rowsOf with a function that counts one year. The best year is the one with the highest count, and a tie goes to the newer year.
How long is a bar?
Its count divided by the highest count in the list, so the longest bar always fills its track and the others are in proportion. Bars change length with a short CSS transition, and under reduced motion they change at once. The bars are drawn in the same order on a right-to-left page; only the year and the count follow the reading direction.
How does it read to a screen reader?
The years are a list named after the metric. Each row reads as its year and count with the unit ("2024, 6 awards"), and the best row adds "Best year". The bars are drawings hidden from assistive technology. After each change the polite status line speaks the metric and the best year, so the change is announced without moving focus.
Related
- Pro
Growth Staircase Awards
Charts and figuresA reverse split for a garden-centre till system: a framed staircase chart of the running total of awards by year with the three biggest years marked, beside the header and a list of three facts.
- Pro
Running Total Counter Awards
Charts and figuresA single framed cell for a usage-metering API with one large rolling number and a row of year buttons: choosing a year rolls the running total of awards to that year and lists its three newest awards.
- Pro
Category Counts Awards
Charts and figuresNine count tiles on shared hairlines for a sports-league manager: a drawn category glyph, the count in large type, its share of all awards and a bar scaled to the largest, with the largest outlined.
- Pro
Distribution Bar Filter Awards
Charts and figuresOne 100% bar split by award category above eight count pills; pressing a pill emphasises its segments and filters the list below.
- Pro
Year In Review Awards
Charts and figuresA recap of 2025 for a podcast app: a 2025 compared with 2024 description list of four figures with their change in words, a ranked list of the top three awards with drawn seals and three dated milestones.
- Pro
Year Rail Timeline Awards
TimelinesA vertical rail of awards by year for a planning tool, a node for each year on a solid hairline with its awards as rows, and the older years behind a View earlier years Collapsible.