shadcn.io is not affiliated with official shadcn/ui
Renewable Energy Map Block for React
Twelve solar, wind and hydro sites on a drawn coast, resized by a time-of-day toggle from typed profiles, with a stacked bar of the mix against a demand line and the share of demand met.
Installation
Overview
Show how a portfolio's output follows the clock, with this renewable energy map for React with Base UI. Fieldwatt, a renewable portfolio, draws the coast and uplands of an invented county, Marrowden, with twelve installations: solar as circles, wind as squares and hydro as triangles, each pin sized by what it makes. A Toggle Group in the dock under the map steps through Midnight, 06:00, Noon and 18:00 and the pins resize from typed profiles: solar follows the sun, wind barely moves and hydro is steady. Beside the toggle a stacked bar splits the output into solar, wind and hydro, in three weights of foreground, and a line marks the demand at that hour; the sentence above says how much of demand is met, such as "Noon: 118 percent of demand". Three lists below, one per kind, give every installation's output as a Progress bar against its capacity, and pressing a row or a pin rings the other. A polite status line speaks the new mix. It's built from Toggle Group, Progress and Guides, with CSS transitions only. For energy portfolios, grid operators and sustainability reports.
FAQ
How do I use my own installations?
Edit SITE_LINES: an id, the kind (solar, wind or hydro), a name, a position in the drawing's 480 by 360 units and the capacity in MW. The profiles are three arrays of four percentages (SOLAR, WIND, HYDRO) and DEMAND holds the demand in MW for each time. In your app feed the output from your metering and keep the toggle for looking at other hours.
How is the output worked out?
Each site's output is its capacity times the profile for that kind and hour, held in tenths of a megawatt. Noon gives solar 78 percent of capacity, wind 44 and hydro 60; at midnight solar is zero and its circles become dashed outlines. The total over the demand is rounded to a whole percent. These are sample figures for the demo, not a forecast.
How do I read the bar without colour?
The three kinds are three weights of foreground (dark, mid, light), always in the same order, and the legend under the bar names each with its megawatts. The demand is a vertical line with a ring around it, and the same figure is in the legend and the sentence. The bar itself is decoration; every number is in text.
Can I use it without a mouse?
Yes. The time toggle is one tab stop and takes the arrow keys, and the installations are lists of buttons, one tab stop each, that mark the matching pin. The pins are hidden from assistive technology and skipped by the Tab key because the lists say the same things in text.