The weather an assistant returns in a chat reply: the place, the temperature now, the sky, the day's high and low, the next hours and the week ahead. A full card for one forecast, a row that opens in place when there are several.
A header that names the place and the time, and the content under it: the weather now, the details, the next hours and the days ahead. Every part is droppable: a quick answer needs only the place and the temperature now.
Nine skies from Koala Icons, drawn for this card on the same grid as the rest of the set; clear and partly cloudy have a night glyph too. Set the sky once on the root with condition and night; the glyph and the wording follow it. WeatherIcon is the same map on its own, for a forecast anywhere else.
WeatherCardHourly lays the next hours out as a strip that runs to the card's edges and scrolls sideways, snapping hour by hour, with the edge fading while there is more to see. The chance of rain is the one thing in colour, and only when there is a chance. Tab into the strip and the arrow keys scroll it.
WeatherCardDaily sets one scale for the week from the coldest low to the warmest high, so every day's bar sits where it falls on it and a cold snap reads at a glance. The bar takes a quiet hue from the day's mean, cold to hot. Pass current on today to mark the temperature now on its bar.
layout="compact" turns the header into one line you can click: the glyph, the place over the sky and the time, the temperature and the range. The card grows to show the forecast underneath, the same object getting taller rather than a panel swapping in. Stack a few for “weather in my three cities”.
NowPartly cloudy, 21°21 degrees Celsius
3 PMPartly cloudy, 22°22 degrees Celsius
4 PMCloudy, 22°22 degrees Celsius, chance of rain 10%
5 PMCloudy, 21°21 degrees Celsius, chance of rain 20%
6 PMDrizzle, 20°20 degrees Celsius, chance of rain 40%
7 PMRain, 19°19 degrees Celsius, chance of rain 60%
8 PMRain, 18°18 degrees Celsius, chance of rain 70%
9 PMRain, 17°17 degrees Celsius, chance of rain 50%
10 PMPartly cloudy, 17°17 degrees Celsius, chance of rain 20%
Inside a reply the card takes the message column's width, with no bubble around it. The answer leads in words and the card backs it up with the numbers.
Will it rain in Lisbon tomorrow?
Yes, take an umbrella. Friday brings rain most of the day, an 80% chance, with a high of 19°. The weekend stays unsettled and clears up from Tuesday.
One forecast, an <article>, and the context every part reads: the unit, the sky now and whether it is night. Every part accepts className, merged last, and every part is droppable. weatherCardVariants is the recipe.
Prop
Type
Default
Description
unit
"c" | "f"
"c"
The unit the temperatures are in. It words what a screen reader hears ("21 degrees Celsius") and sets the range bar's colour bands; the numbers are yours.
condition
WeatherCondition
-
The sky now. WeatherCardGlyph and WeatherCardCondition draw and word it.
night
boolean
false
Draws the night glyph (moon) and the night wording ("Clear" instead of "Sunny").
layout
"full" | "compact"
"full"
full shows everything at once. compact makes the header a one-line disclosure and folds WeatherCardContent under it.
open
boolean
-
Controlled open state of a compact card.
defaultOpen
boolean
false
Initial open state of a compact card.
onOpenChange
(open: boolean) => void
-
Called when a compact card opens or closes.
Data attribute
Description
data-slot
"weather-card".
data-layout
"full" or "compact".
data-unit
"c" or "f".
data-condition
The condition.
data-night
Present when night.
data-state
open or closed, on a compact card only.
WeatherCardHeader
The top line, a flex row. In a compact card it is the Radix Collapsible.Trigger (a <button>) holding the glyph, the place, the temperature and the range, and adds the caret; in a full card it is a <div>.
Data attribute
Description
data-slot
"weather-card-header".
WeatherCardLocation
The place (the children) over a muted line for the time, a <span> that takes the row's free width. Both truncate.
Prop
Type
Default
Description
time
React.ReactNode
-
When the forecast is for: "Now", "Tomorrow · Fri, Nov 7". Pass formatted text.
Data attribute
Description
data-slot
"weather-card-location"; the lines are "weather-card-place" and "weather-card-time".
WeatherCardContent
Everything under the header, a <div> stacking its parts 16px apart. In a compact card it is the Radix Collapsible.Content: its height tweens open and shut and the parts fade in with it.
Data attribute
Description
data-slot
"weather-card-content".
data-state
open or closed, in a compact card.
WeatherCardCurrent
The weather now, a grid: the glyph, the temperature, then the condition over the range on the right. Drop any of them and the rest close up.
Data attribute
Description
data-slot
"weather-card-current".
WeatherCardGlyph
The root's condition as a WeatherIcon: 44px in a full card, 28px in a compact one. Forwards icon props.
Prop
Type
Default
Description
condition
WeatherCondition
-
Overrides the root's condition.
night
boolean
-
Overrides the root's night.
Data attribute
Description
data-slot
"weather-card-glyph".
WeatherCardTemperature
The hero number, 48px semibold in tabular-nums (20px in a compact card), its degree sign set lighter and tucked in. Rounds, writes a true minus, and rolls its digits when the value changes. Reads "21 degrees Celsius".
Prop
Type
Default
Description
value*
number
-
The temperature, in the card's unit.
Data attribute
Description
data-slot
"weather-card-temperature".
WeatherCardCondition
The sky in words, a <span>, worded from the root's condition ("Partly cloudy").
Prop
Type
Default
Description
condition
WeatherCondition
-
Overrides the root's condition.
night
boolean
-
Overrides the root's night.
children
React.ReactNode
-
Your own wording, such as "Light rain".
Data attribute
Description
data-slot
"weather-card-condition".
WeatherCardRange
The day's high and low, "H 24° L 16°", read as "High 24 degrees, Low 16 degrees".
Prop
Type
Default
Description
high*
number
-
The high.
low*
number
-
The low.
highLabel
string
"H"
The visible mark before the high.
lowLabel
string
"L"
The visible mark before the low.
Data attribute
Description
data-slot
"weather-card-range".
WeatherCardStats
The details, a <dl> under a hairline: two columns, four once the card is 448px wide.
Data attribute
Description
data-slot
"weather-card-stats".
WeatherCardStat
One detail: a muted label with an optional glyph over the value. A <dt> and <dd> in a <div>.
Prop
Type
Default
Description
label*
React.ReactNode
-
What it measures: "Feels like", "Wind".
icon
React.ReactNode
-
A 14px glyph before the label.
children*
React.ReactNode
-
The value, formatted: "14 km/h NW".
Data attribute
Description
data-slot
"weather-card-stat".
WeatherCardHourly
The next hours, a <section> holding a horizontal strip that runs to the card's edges, scrolls, snaps hour by hour and fades at the edge with more to see. The strip takes focus, so the arrow keys scroll it.
Prop
Type
Default
Description
label
React.ReactNode
-
A small caption above the strip. Without it the section is named "Hourly forecast".
Data attribute
Description
data-slot
"weather-card-hourly"; the scroller is "weather-card-hourly-viewport".
WeatherCardHour
One hour: the time, the glyph, the temperature and, when there is one, the chance of rain in the info hue. A role="listitem".
Prop
Type
Default
Description
time*
React.ReactNode
-
"Now", "3 PM". Pass formatted text.
temperature*
number
-
The temperature that hour.
condition*
WeatherCondition
-
The sky that hour.
night
boolean
false
Draws the night glyph.
precipitation
number
-
The chance of rain, 0 to 100. Hidden at 0.
Data attribute
Description
data-slot
"weather-card-hour".
WeatherCardDaily
The days ahead, a <section> of rows. It reads every day's low and high to set one scale for the week, so each range bar sits where its day falls between the coldest night and the warmest afternoon. Days must be direct children.
Prop
Type
Default
Description
label
React.ReactNode
-
A small caption above the rows. Without it the section is named "Daily forecast".
min
number
-
Overrides the bottom of the scale.
max
number
-
Overrides the top of the scale.
Data attribute
Description
data-slot
"weather-card-daily".
WeatherCardDay
One day: the name, the glyph, the chance of rain, the low, the range bar and the high. The bar's hue follows the day's mean: cold, mild, warm or hot.
Prop
Type
Default
Description
day*
React.ReactNode
-
"Today", "Fri". Pass formatted text.
low*
number
-
The low.
high*
number
-
The high.
condition*
WeatherCondition
-
The day's sky.
night
boolean
false
Draws the night glyph.
precipitation
number
-
The chance of rain, 0 to 100. Hidden at 0.
current
number
-
Today's temperature now, marked as a dot on the bar.
Data attribute
Description
data-slot
"weather-card-day"; the bar is "weather-card-day-bar".
WeatherCardSkeleton
Holds a forecast's place while it streams in, in the same frame, hidden from assistive tech.
Prop
Type
Default
Description
layout
"full" | "compact"
"full"
Which card it stands in for.
Data attribute
Description
data-slot
"weather-card-skeleton".
WeatherIcon
The condition-to-glyph map on its own, for a forecast outside the card. Day and night glyphs from Koala Icons. WEATHER_CONDITIONS exposes the map and its wording, weatherConditionLabel the wording alone.
Prop
Type
Default
Description
condition*
WeatherCondition
-
clear, partly-cloudy, cloudy, rain, drizzle, storm, snow, fog or wind.
From your tool call. The card draws what it is given: numbers for temperatures, a condition for the sky, and formatted text for times and days. Map your provider's codes (Open-Meteo, OpenWeather, Apple WeatherKit) to the nine conditions once, in the tool that fetches the forecast.