Plant care app
A houseplant home screen: the thirstiest plant gets a big photo card with a glass water gauge that fills with a moving waterline when you water it.
"use client";
import { useState, type CSSProperties } from "react";
import "./plant-care.css";
export type Plant = {
name: string;
species: string;
room: string;
photo: string;
/** Soil moisture right now, 0 to 1. */
moisture: number;
/** Days since the last watering. */
days: number;
};
type PlantCareProps = { plants: Plant[]; owner?: string };
const THIRSTY = 0.35;
/**
* PlantCare: a home screen for looking after houseplants.
* - The thirstiest plant gets the big photo card, with a water gauge on its side.
* - "Water" fills the gauge with a moving waterline, then the plant counts as done.
* - Tap any plant in the list to bring it into the big card; chips filter by room.
*/
export function PlantCare({ plants: initial, owner = "Alex" }: PlantCareProps) {
const [plants, setPlants] = useState(initial);
const [room, setRoom] = useState("All");
const [picked, setPicked] = useState(() =>
initial.reduce(
(low, p, i) => (p.moisture < initial[low].moisture ? i : low),
0,
),
);
const rooms = ["All", ...Array.from(new Set(initial.map((p) => p.room)))];
const thirsty = plants.filter((p) => p.moisture < THIRSTY).length;
const hero = plants[picked];
const water = (i: number) =>
setPlants((list) =>
list.map((p, k) => (k === i ? { ...p, moisture: 1, days: 0 } : p)),
);
const shown = plants
.map((p, i) => ({ p, i }))
.filter(({ p, i }) => i !== picked && (room === "All" || p.room === room));
const last = (d: number) =>
d === 0 ? "Watered just now" : `Watered ${d} day${d === 1 ? "" : "s"} ago`;
return (
<div className="gu-plants">
<header className="gu-plants__head">
<div>
<p className="gu-plants__hello">Good morning, {owner}</p>
<h2 className="gu-plants__title" aria-live="polite">
{thirsty === 0
? "Everyone is happy today"
: `${thirsty} plant${thirsty === 1 ? " is" : "s are"} thirsty`}
</h2>
</div>
<span className="gu-plants__avatar" aria-hidden="true">
{owner[0]}
</span>
</header>
<div
className="gu-plants__chips"
role="group"
aria-label="Filter by room"
>
{rooms.map((r) => (
<button
key={r}
type="button"
aria-pressed={room === r}
onClick={() => setRoom(r)}
>
{r}
</button>
))}
</div>
{/* The big card: photo, name, and the gauge that fills when watered. */}
<article
className="gu-plants__hero"
key={picked}
style={{ "--level": hero.moisture } as CSSProperties}
data-thirsty={hero.moisture < THIRSTY}
>
<img src={hero.photo} alt="" className="gu-plants__photo" />
<div className="gu-plants__shade" aria-hidden="true" />
<div
className="gu-plants__gauge"
role="meter"
aria-label={`${hero.name} soil moisture`}
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={Math.round(hero.moisture * 100)}
>
<span className="gu-plants__water" aria-hidden="true">
<span className="gu-plants__wave" />
</span>
<span className="gu-plants__pct" aria-hidden="true">
{Math.round(hero.moisture * 100)}%
</span>
</div>
<div className="gu-plants__info">
<p className="gu-plants__room">{hero.room}</p>
<h3 className="gu-plants__name">{hero.name}</h3>
<p className="gu-plants__species">{hero.species}</p>
<div className="gu-plants__row">
<span className="gu-plants__last">{last(hero.days)}</span>
<button
type="button"
className="gu-plants__water-btn"
onClick={() => water(picked)}
disabled={hero.moisture >= 0.95}
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 3s6 6.4 6 11a6 6 0 0 1-12 0c0-4.6 6-11 6-11Z" />
</svg>
{hero.moisture >= 0.95 ? "Done" : "Water"}
</button>
</div>
</div>
</article>
<h3 className="gu-plants__label">Your plants</h3>
<ul className="gu-plants__list">
{shown.map(({ p, i }) => (
<li key={p.name}>
<button
type="button"
className="gu-plants__item"
onClick={() => setPicked(i)}
aria-label={`Show ${p.name}`}
>
<img src={p.photo} alt="" className="gu-plants__thumb" />
<span className="gu-plants__text">
<strong>{p.name}</strong>
<span>{last(p.days)}</span>
<span
className="gu-plants__bar"
style={{ "--level": p.moisture } as CSSProperties}
data-thirsty={p.moisture < THIRSTY}
/>
</span>
</button>
<button
type="button"
className="gu-plants__drop"
aria-label={
p.moisture >= 0.95 ? `${p.name} is watered` : `Water ${p.name}`
}
data-done={p.moisture >= 0.95}
onClick={() => water(i)}
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 3s6 6.4 6 11a6 6 0 0 1-12 0c0-4.6 6-11 6-11Z" />
</svg>
</button>
</li>
))}
{shown.length === 0 && (
<li className="gu-plants__empty">No other plants in this room.</li>
)}
</ul>
<nav className="gu-plants__tabs" aria-label="App">
{["Plants", "Schedule", "Explore", "Profile"].map((t, i) => (
<a
key={t}
href="#"
aria-current={i === 0 ? "page" : undefined}
onClick={(e) => e.preventDefault()}
>
<span className="gu-plants__tab-dot" aria-hidden="true" />
{t}
</a>
))}
</nav>
</div>
);
}
Paste this into ChatGPT, Claude, Cursor, v0, Lovable or Bolt. It describes the layout, motion, colors and accessibility and includes the code, so the AI can rebuild it in any framework.
# Build this UI piece: Plant care app
You are a senior front-end engineer. Recreate the piece below in my project. If I don't say which framework I use, ask once, then build it in that framework (React, Vue, Svelte, Angular, Astro, plain HTML/CSS/JS or anything else). Keep the behavior, motion, colors, spacing and accessibility exactly as described. Keep the code clean and commented for beginners.
## What it is
A houseplant care app home screen for phones. The thirstiest plant gets a big photo card with a frosted glass water gauge; pressing Water fills the gauge with a moving waterline. A list shows the other plants, filterable by room.
## Layout and look
- Fills its parent and scrolls inside itself; warm paper background #f1eee4, deep green ink #15261c, muted #66705f, leaf green #2f6b45, water blue #3d86ff, dry orange #e0742c. System font.
- Safe areas: top padding = safe-area-inset-top + 8px; the tab bar sits above safe-area-inset-bottom.
- Header: "Good morning, <name>" (14px muted) and a live headline "3 plants are thirsty" (30px, weight 750, -0.03em), round initial avatar on the right.
- Room chips: horizontally scrolling 38px pills; the active one is filled ink.
- Big card: 380px tall, radius 28px, the plant photo with object-fit cover and a dark gradient at the bottom. Room pill (frosted), plant name 30px, species in italics, "Watered 6 days ago" and a white Water pill button.
- Gauge: a 46px wide frosted glass tube on the right edge (backdrop blur 14px, inner hairline). The water inside has a height equal to the moisture level and a repeating SVG wave on top that slides sideways forever. Orange when below 35%, blue otherwise. Percentage at the bottom.
- List: cards with a 60px rounded photo, name, last watered and a thin moisture bar, plus a 48px round water button that fills blue when done.
- Tab bar: floating, sticky at the bottom, frosted (blur 20px, saturate 1.6), radius 26px.
## Behavior and motion
1. On load the plant with the lowest moisture is shown in the big card.
2. Water sets moisture to 100% and days to 0; the waterline rises over 1.4s (cubic-bezier(0.16, 1, 0.3, 1)) and the headline count updates.
3. Tapping a plant row moves it into the big card (fades and scales in from 0.97).
4. Room chips filter the list; an empty room says "No other plants in this room."
## Accessibility
- The gauge is role="meter" with the plant's name and a value from 0 to 100.
- The headline is aria-live so watering announces the new count.
- Chips use aria-pressed; water buttons have labels like "Water Monty".
- prefers-reduced-motion: the wave stops, levels change instantly.
## Props
plants: { name, species, room, photo, moisture (0 to 1), days }[], owner?: string
## Reference implementation
The original is written in React with one plain CSS file. Dependencies: none (plain React and CSS). Translate it faithfully; do not add new libraries unless my framework needs them.
### PlantCare.tsx
```tsx
"use client";
import { useState, type CSSProperties } from "react";
import "./plant-care.css";
export type Plant = {
name: string;
species: string;
room: string;
photo: string;
/** Soil moisture right now, 0 to 1. */
moisture: number;
/** Days since the last watering. */
days: number;
};
type PlantCareProps = { plants: Plant[]; owner?: string };
const THIRSTY = 0.35;
/**
* PlantCare: a home screen for looking after houseplants.
* - The thirstiest plant gets the big photo card, with a water gauge on its side.
* - "Water" fills the gauge with a moving waterline, then the plant counts as done.
* - Tap any plant in the list to bring it into the big card; chips filter by room.
*/
export function PlantCare({ plants: initial, owner = "Alex" }: PlantCareProps) {
const [plants, setPlants] = useState(initial);
const [room, setRoom] = useState("All");
const [picked, setPicked] = useState(() =>
initial.reduce(
(low, p, i) => (p.moisture < initial[low].moisture ? i : low),
0,
),
);
const rooms = ["All", ...Array.from(new Set(initial.map((p) => p.room)))];
const thirsty = plants.filter((p) => p.moisture < THIRSTY).length;
const hero = plants[picked];
const water = (i: number) =>
setPlants((list) =>
list.map((p, k) => (k === i ? { ...p, moisture: 1, days: 0 } : p)),
);
const shown = plants
.map((p, i) => ({ p, i }))
.filter(({ p, i }) => i !== picked && (room === "All" || p.room === room));
const last = (d: number) =>
d === 0 ? "Watered just now" : `Watered ${d} day${d === 1 ? "" : "s"} ago`;
return (
<div className="gu-plants">
<header className="gu-plants__head">
<div>
<p className="gu-plants__hello">Good morning, {owner}</p>
<h2 className="gu-plants__title" aria-live="polite">
{thirsty === 0
? "Everyone is happy today"
: `${thirsty} plant${thirsty === 1 ? " is" : "s are"} thirsty`}
</h2>
</div>
<span className="gu-plants__avatar" aria-hidden="true">
{owner[0]}
</span>
</header>
<div
className="gu-plants__chips"
role="group"
aria-label="Filter by room"
>
{rooms.map((r) => (
<button
key={r}
type="button"
aria-pressed={room === r}
onClick={() => setRoom(r)}
>
{r}
</button>
))}
</div>
{/* The big card: photo, name, and the gauge that fills when watered. */}
<article
className="gu-plants__hero"
key={picked}
style={{ "--level": hero.moisture } as CSSProperties}
data-thirsty={hero.moisture < THIRSTY}
>
<img src={hero.photo} alt="" className="gu-plants__photo" />
<div className="gu-plants__shade" aria-hidden="true" />
<div
className="gu-plants__gauge"
role="meter"
aria-label={`${hero.name} soil moisture`}
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={Math.round(hero.moisture * 100)}
>
<span className="gu-plants__water" aria-hidden="true">
<span className="gu-plants__wave" />
</span>
<span className="gu-plants__pct" aria-hidden="true">
{Math.round(hero.moisture * 100)}%
</span>
</div>
<div className="gu-plants__info">
<p className="gu-plants__room">{hero.room}</p>
<h3 className="gu-plants__name">{hero.name}</h3>
<p className="gu-plants__species">{hero.species}</p>
<div className="gu-plants__row">
<span className="gu-plants__last">{last(hero.days)}</span>
<button
type="button"
className="gu-plants__water-btn"
onClick={() => water(picked)}
disabled={hero.moisture >= 0.95}
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 3s6 6.4 6 11a6 6 0 0 1-12 0c0-4.6 6-11 6-11Z" />
</svg>
{hero.moisture >= 0.95 ? "Done" : "Water"}
</button>
</div>
</div>
</article>
<h3 className="gu-plants__label">Your plants</h3>
<ul className="gu-plants__list">
{shown.map(({ p, i }) => (
<li key={p.name}>
<button
type="button"
className="gu-plants__item"
onClick={() => setPicked(i)}
aria-label={`Show ${p.name}`}
>
<img src={p.photo} alt="" className="gu-plants__thumb" />
<span className="gu-plants__text">
<strong>{p.name}</strong>
<span>{last(p.days)}</span>
<span
className="gu-plants__bar"
style={{ "--level": p.moisture } as CSSProperties}
data-thirsty={p.moisture < THIRSTY}
/>
</span>
</button>
<button
type="button"
className="gu-plants__drop"
aria-label={
p.moisture >= 0.95 ? `${p.name} is watered` : `Water ${p.name}`
}
data-done={p.moisture >= 0.95}
onClick={() => water(i)}
>
<svg viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 3s6 6.4 6 11a6 6 0 0 1-12 0c0-4.6 6-11 6-11Z" />
</svg>
</button>
</li>
))}
{shown.length === 0 && (
<li className="gu-plants__empty">No other plants in this room.</li>
)}
</ul>
<nav className="gu-plants__tabs" aria-label="App">
{["Plants", "Schedule", "Explore", "Profile"].map((t, i) => (
<a
key={t}
href="#"
aria-current={i === 0 ? "page" : undefined}
onClick={(e) => e.preventDefault()}
>
<span className="gu-plants__tab-dot" aria-hidden="true" />
{t}
</a>
))}
</nav>
</div>
);
}
```
### plant-care.css
```css
/* PlantCare: warm paper background, deep green ink, water in clear blue. */
.gu-plants {
--bg: #f1eee4;
--card: #fbfaf5;
--ink: #15261c;
--muted: #66705f;
--leaf: #2f6b45;
--water: #3d86ff;
--dry: #e0742c;
--line: rgb(21 38 28 / 0.1);
--focus: #2b35ff;
--ease: cubic-bezier(0.16, 1, 0.3, 1);
position: relative;
height: 100%;
min-height: 640px;
overflow-y: auto;
overscroll-behavior: contain;
scrollbar-width: none;
padding: calc(var(--gu-safe-top, env(safe-area-inset-top, 0px)) + 8px) 20px 0;
background: var(--bg);
color: var(--ink);
font-family: -apple-system, "SF Pro Text", system-ui, sans-serif;
-webkit-font-smoothing: antialiased;
}
.gu-plants button,
.gu-plants a {
font: inherit;
color: inherit;
-webkit-tap-highlight-color: transparent;
}
.gu-plants button {
border: 0;
background: none;
cursor: pointer;
}
.gu-plants :focus-visible {
outline: 2px solid var(--focus);
outline-offset: 2px;
}
.gu-plants svg {
width: 20px;
height: 20px;
fill: currentColor;
}
.gu-plants__head {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
}
.gu-plants__hello {
margin: 4px 0 0;
font-size: 14px;
color: var(--muted);
}
.gu-plants__title {
margin: 4px 0 0;
font-size: 30px;
font-weight: 750;
letter-spacing: -0.03em;
line-height: 1.05;
max-width: 11ch;
}
.gu-plants__avatar {
display: grid;
place-items: center;
width: 44px;
height: 44px;
flex-shrink: 0;
border-radius: 50%;
background: var(--leaf);
color: #f1eee4;
font-weight: 700;
}
.gu-plants__chips {
display: flex;
gap: 8px;
margin: 18px -20px 0;
padding: 0 20px;
overflow-x: auto;
scrollbar-width: none;
}
.gu-plants__chips button {
flex-shrink: 0;
min-height: 38px;
padding: 0 16px;
border-radius: 999px;
border: 1px solid var(--line);
font-size: 14px;
font-weight: 600;
transition:
background-color 0.3s,
color 0.3s;
}
.gu-plants__chips button[aria-pressed="true"] {
background: var(--ink);
color: var(--bg);
border-color: var(--ink);
}
/* Hero card */
.gu-plants__hero {
position: relative;
height: 380px;
margin-top: 18px;
overflow: hidden;
border-radius: 28px;
background: #c9c3ad;
color: #fff;
box-shadow: 0 24px 40px -26px rgb(21 38 28 / 0.6);
animation: gu-plants-in 0.6s var(--ease);
}
@keyframes gu-plants-in {
from {
opacity: 0;
scale: 0.97;
}
}
.gu-plants__photo {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.gu-plants__shade {
position: absolute;
inset: 0;
background: linear-gradient(transparent 38%, rgb(10 20 14 / 0.78));
}
/* The gauge: a glass tube whose waterline moves. */
.gu-plants__gauge {
position: absolute;
top: 16px;
right: 16px;
bottom: 16px;
width: 46px;
overflow: hidden;
border-radius: 23px;
background: rgb(255 255 255 / 0.22);
-webkit-backdrop-filter: blur(14px) saturate(1.4);
backdrop-filter: blur(14px) saturate(1.4);
box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.35);
}
.gu-plants__water {
position: absolute;
inset: auto 0 0;
height: calc(var(--level) * 100%);
background: linear-gradient(#69a6ff, var(--water));
transition: height 1.4s var(--ease);
}
[data-thirsty="true"] .gu-plants__water {
background: linear-gradient(#f2a05d, var(--dry));
}
.gu-plants__wave {
position: absolute;
left: 0;
top: -7px;
width: 200%;
height: 14px;
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='46' height='14'><path d='M0 7 Q11.5 0 23 7 T46 7 V14 H0Z' fill='%2369a6ff'/></svg>")
0 0 / 46px 14px repeat-x;
animation: gu-plants-wave 2.4s linear infinite;
}
[data-thirsty="true"] .gu-plants__wave {
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='46' height='14'><path d='M0 7 Q11.5 0 23 7 T46 7 V14 H0Z' fill='%23f2a05d'/></svg>");
}
@keyframes gu-plants-wave {
to {
translate: -46px 0;
}
}
.gu-plants__pct {
position: absolute;
inset: auto 0 12px;
text-align: center;
font-size: 12px;
font-weight: 700;
font-variant-numeric: tabular-nums;
text-shadow: 0 1px 4px rgb(0 0 0 / 0.3);
}
.gu-plants__info {
position: absolute;
left: 20px;
right: 80px;
bottom: 18px;
}
.gu-plants__room {
display: inline-block;
margin: 0;
padding: 4px 10px;
border-radius: 999px;
background: rgb(255 255 255 / 0.2);
-webkit-backdrop-filter: blur(10px);
backdrop-filter: blur(10px);
font-size: 12px;
font-weight: 600;
}
.gu-plants__name {
margin: 10px 0 0;
font-size: 30px;
font-weight: 750;
letter-spacing: -0.03em;
line-height: 1;
}
.gu-plants__species {
margin: 4px 0 0;
font-size: 14px;
font-style: italic;
opacity: 0.8;
}
.gu-plants__row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-top: 14px;
}
.gu-plants__last {
font-size: 13px;
opacity: 0.85;
}
.gu-plants__water-btn {
display: inline-flex;
align-items: center;
gap: 6px;
min-height: 44px;
padding: 0 18px 0 14px;
border-radius: 999px;
background: #fff !important;
color: var(--ink) !important;
font-size: 15px !important;
font-weight: 700 !important;
transition:
scale 0.25s var(--ease),
opacity 0.3s;
}
.gu-plants__water-btn svg {
color: var(--water);
}
.gu-plants__water-btn:active {
scale: 0.94;
}
.gu-plants__water-btn:disabled {
opacity: 0.75;
cursor: default;
}
/* List */
.gu-plants__label {
margin: 26px 0 8px;
font-size: 18px;
font-weight: 700;
letter-spacing: -0.02em;
}
.gu-plants__list {
display: grid;
gap: 10px;
margin: 0;
padding: 0 0 108px;
list-style: none;
}
.gu-plants__list > li {
display: flex;
align-items: center;
gap: 8px;
padding: 10px;
border-radius: 22px;
background: var(--card);
box-shadow: 0 1px 0 var(--line);
}
.gu-plants__item {
display: flex;
flex: 1;
align-items: center;
gap: 14px;
min-width: 0;
text-align: left;
}
.gu-plants__thumb {
width: 60px;
height: 60px;
flex-shrink: 0;
border-radius: 16px;
object-fit: cover;
background: #d6d1bd;
}
.gu-plants__text {
display: grid;
flex: 1;
gap: 2px;
min-width: 0;
}
.gu-plants__text strong {
font-size: 16px;
}
.gu-plants__text > span {
font-size: 13px;
color: var(--muted);
}
.gu-plants__bar {
position: relative;
height: 5px;
margin-top: 6px;
overflow: hidden;
border-radius: 3px;
background: var(--line);
}
.gu-plants__bar::after {
content: "";
position: absolute;
inset: 0;
width: calc(var(--level) * 100%);
border-radius: inherit;
background: var(--water);
transition: width 1.2s var(--ease);
}
.gu-plants__bar[data-thirsty="true"]::after {
background: var(--dry);
}
.gu-plants__drop {
display: grid;
place-items: center;
width: 48px;
height: 48px;
flex-shrink: 0;
border-radius: 50%;
background: rgb(61 134 255 / 0.12) !important;
color: var(--water);
transition:
background-color 0.3s,
color 0.3s,
scale 0.25s var(--ease);
}
.gu-plants__drop:active {
scale: 0.9;
}
.gu-plants__drop[data-done="true"] {
background: var(--water) !important;
color: #fff;
}
.gu-plants__empty {
justify-content: center;
color: var(--muted);
font-size: 14px;
}
/* Tab bar: floats over the content on frosted glass. */
.gu-plants__tabs {
position: sticky;
bottom: calc(var(--gu-safe-bottom, env(safe-area-inset-bottom, 0px)) + 4px);
display: flex;
justify-content: space-around;
margin: -96px 0 0;
padding: 10px 8px;
border-radius: 26px;
background: rgb(251 250 245 / 0.72);
-webkit-backdrop-filter: blur(20px) saturate(1.6);
backdrop-filter: blur(20px) saturate(1.6);
box-shadow:
0 0 0 1px var(--line),
0 18px 30px -18px rgb(21 38 28 / 0.5);
}
.gu-plants__tabs a {
display: grid;
justify-items: center;
gap: 5px;
min-width: 64px;
padding: 4px 0;
font-size: 12px;
font-weight: 600;
text-decoration: none;
color: var(--muted);
}
.gu-plants__tabs a[aria-current="page"] {
color: var(--ink);
}
.gu-plants__tab-dot {
width: 22px;
height: 22px;
border-radius: 8px;
border: 2px solid currentColor;
}
.gu-plants__tabs a[aria-current="page"] .gu-plants__tab-dot {
background: var(--leaf);
border-color: var(--leaf);
}
@media (prefers-reduced-motion: reduce) {
.gu-plants__hero,
.gu-plants__wave {
animation: none;
}
.gu-plants__water,
.gu-plants__bar::after {
transition: none;
}
}
```
You might also want
Next piece: Private chef portfolio with a dinner builderCook mode app
Apps, intermediate
Run tracker app
Apps, advanced
Boarding pass app
Apps, intermediate
