Bloom
import { useId } from 'react';
const css = `
.radio-bloom { --radio-bloom-sp: 5deg; --radio-bloom-sc: 0.6; --radio-bloom-c: 0.25; display: grid; justify-items: center; gap: 12px; }
.radio-bloom:has(.radio-bloom__input[value='half']:checked) { --radio-bloom-sp: 20deg; --radio-bloom-sc: 0.85; --radio-bloom-c: 0.65; }
.radio-bloom:has(.radio-bloom__input[value='full']:checked) { --radio-bloom-sp: 45deg; --radio-bloom-sc: 1; --radio-bloom-c: 1; }
.radio-bloom__plant { position: relative; width: 110px; height: 104px; }
.radio-bloom__stem { position: absolute; left: 54px; top: 44px; width: 3px; height: 60px; border-radius: 2px; background: light-dark(#cbced3, #393c41); }
.radio-bloom__leaf { position: absolute; top: 72px; width: 18px; height: 8px; border-radius: 0 100% 0 100%; background: light-dark(#cbced3, #393c41); }
.radio-bloom__petal {
position: absolute;
left: 49px;
top: 16px;
width: 13px;
height: 28px;
border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
background: linear-gradient(light-dark(#373a40, #f1f2f3), light-dark(#5f626a, #a7abb2));
box-shadow: inset 0 0 0 1px color-mix(in oklab, light-dark(#6d7179, #7d8087) 50%, transparent);
transform-origin: 50% 100%;
transform: rotate(calc((var(--i) - 3.5) * var(--radio-bloom-sp))) scale(var(--radio-bloom-sc));
transition: transform 0.75s cubic-bezier(0.3, 1.3, 0.5, 1) calc(var(--o) * 40ms);
}
.radio-bloom__heart {
position: absolute;
left: 49px;
top: 38px;
width: 13px;
height: 13px;
border-radius: 50%;
background: radial-gradient(circle at 40% 35%, light-dark(#42454c, #e5e6e9), light-dark(#6d7179, #7d8087));
box-shadow: 0 0 10px color-mix(in oklab, light-dark(#373a40, #f1f2f3) 40%, transparent);
transform: scale(var(--radio-bloom-c));
transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1) 0.15s;
}
.radio-bloom__opts { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); }
.radio-bloom__opt {
position: relative;
padding: 5px 12px;
border-radius: 7px;
color: light-dark(#5f626a, #a7abb2);
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: color 0.2s, background-color 0.2s;
}
.radio-bloom__opt:hover { color: light-dark(#42454c, #e5e6e9); }
.radio-bloom__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.radio-bloom__opt:has(.radio-bloom__input:focus-visible) { outline: 2px solid light-dark(#5f626a, #a7abb2); outline-offset: 2px; }
.radio-bloom__opt:has(.radio-bloom__input:checked) { background: light-dark(#42454c, #e5e6e9); color: light-dark(#fbfcfd, #121417); }
@media (prefers-reduced-motion: reduce) {
.radio-bloom * { transition-duration: 0.01s !important; transition-delay: 0s !important; }
}
`;
const STAGES = [
{ value: 'bud', label: 'Bud' },
{ value: 'half', label: 'Opening' },
{ value: 'full', label: 'In bloom' },
];
export function BloomRadio() {
const name = useId();
return (
<>
<style>
{css}
</style>
<div className="radio-bloom">
<span className="radio-bloom__plant" aria-hidden="true">
<span className="radio-bloom__stem" />
<span className="radio-bloom__leaf" style={{ left: 57 }} />
<span className="radio-bloom__leaf" style={{ left: 36, transform: 'scaleX(-1)' }} />
{Array.from({ length: 8 }, (_, i) => (
// The outer petals open last.
<span key={i} className="radio-bloom__petal" style={{ '--i': i, '--o': Math.abs(i - 3.5) } as React.CSSProperties} />
))}
<span className="radio-bloom__heart" />
</span>
<div className="radio-bloom__opts" role="radiogroup" aria-label="Stage">
{STAGES.map((s, i) => (
<label key={s.value} className="radio-bloom__opt">
<input className="radio-bloom__input" type="radio" name={name} value={s.value} defaultChecked={i === 0} />
{s.label}
</label>
))}
</div>
</div>
</>
);
}Markup where the component goes, CSS in your stylesheet. No JavaScript.
<div class="radio-bloom">
<span class="radio-bloom__plant" aria-hidden="true">
<span class="radio-bloom__stem"></span>
<span class="radio-bloom__leaf" style="left:57px"></span>
<span class="radio-bloom__leaf" style="left:36px;transform:scaleX(-1)"></span>
<span class="radio-bloom__petal" style="--i:0;--o:3.5"></span>
<span class="radio-bloom__petal" style="--i:1;--o:2.5"></span>
<span class="radio-bloom__petal" style="--i:2;--o:1.5"></span>
<span class="radio-bloom__petal" style="--i:3;--o:0.5"></span>
<span class="radio-bloom__petal" style="--i:4;--o:0.5"></span>
<span class="radio-bloom__petal" style="--i:5;--o:1.5"></span>
<span class="radio-bloom__petal" style="--i:6;--o:2.5"></span>
<span class="radio-bloom__petal" style="--i:7;--o:3.5"></span>
<span class="radio-bloom__heart"></span>
</span>
<div class="radio-bloom__opts" role="radiogroup" aria-label="Stage">
<label class="radio-bloom__opt"><input class="radio-bloom__input" type="radio" name="radio-bloom" checked="" value="bud"/>Bud</label>
<label class="radio-bloom__opt"><input class="radio-bloom__input" type="radio" name="radio-bloom" value="half"/>Opening</label>
<label class="radio-bloom__opt"><input class="radio-bloom__input" type="radio" name="radio-bloom" value="full"/>In bloom</label>
</div>
</div>.radio-bloom { --radio-bloom-sp: 5deg; --radio-bloom-sc: 0.6; --radio-bloom-c: 0.25; display: grid; justify-items: center; gap: 12px; }
.radio-bloom:has(.radio-bloom__input[value='half']:checked) { --radio-bloom-sp: 20deg; --radio-bloom-sc: 0.85; --radio-bloom-c: 0.65; }
.radio-bloom:has(.radio-bloom__input[value='full']:checked) { --radio-bloom-sp: 45deg; --radio-bloom-sc: 1; --radio-bloom-c: 1; }
.radio-bloom__plant { position: relative; width: 110px; height: 104px; }
.radio-bloom__stem { position: absolute; left: 54px; top: 44px; width: 3px; height: 60px; border-radius: 2px; background: light-dark(#cbced3, #393c41); }
.radio-bloom__leaf { position: absolute; top: 72px; width: 18px; height: 8px; border-radius: 0 100% 0 100%; background: light-dark(#cbced3, #393c41); }
.radio-bloom__petal {
position: absolute;
left: 49px;
top: 16px;
width: 13px;
height: 28px;
border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
background: linear-gradient(light-dark(#373a40, #f1f2f3), light-dark(#5f626a, #a7abb2));
box-shadow: inset 0 0 0 1px color-mix(in oklab, light-dark(#6d7179, #7d8087) 50%, transparent);
transform-origin: 50% 100%;
transform: rotate(calc((var(--i) - 3.5) * var(--radio-bloom-sp))) scale(var(--radio-bloom-sc));
transition: transform 0.75s cubic-bezier(0.3, 1.3, 0.5, 1) calc(var(--o) * 40ms);
}
.radio-bloom__heart {
position: absolute;
left: 49px;
top: 38px;
width: 13px;
height: 13px;
border-radius: 50%;
background: radial-gradient(circle at 40% 35%, light-dark(#42454c, #e5e6e9), light-dark(#6d7179, #7d8087));
box-shadow: 0 0 10px color-mix(in oklab, light-dark(#373a40, #f1f2f3) 40%, transparent);
transform: scale(var(--radio-bloom-c));
transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1) 0.15s;
}
.radio-bloom__opts { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); }
.radio-bloom__opt {
position: relative;
padding: 5px 12px;
border-radius: 7px;
color: light-dark(#5f626a, #a7abb2);
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: color 0.2s, background-color 0.2s;
}
.radio-bloom__opt:hover { color: light-dark(#42454c, #e5e6e9); }
.radio-bloom__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.radio-bloom__opt:has(.radio-bloom__input:focus-visible) { outline: 2px solid light-dark(#5f626a, #a7abb2); outline-offset: 2px; }
.radio-bloom__opt:has(.radio-bloom__input:checked) { background: light-dark(#42454c, #e5e6e9); color: light-dark(#fbfcfd, #121417); }
@media (prefers-reduced-motion: reduce) {
.radio-bloom * { transition-duration: 0.01s !important; transition-delay: 0s !important; }
}Goal: Create a "Bloom" radio.
Visual behavior: A growth stage picker on a flower: from a closed bud the petals spread out to half open and then to a full flower, the outer ones last, and the centre grows and glows.
Technique:
- Real native radios (visually hidden: absolute, 1x1, opacity 0) inside <label>s; the scene is aria-hidden and every state is read from the checked input with :has().
- Eight petals hinged at the centre are rotated by (i - 3.5) x a spread variable; a small spread makes a bud and 45 degrees fills the circle.
- Each petal is delayed by its distance from the middle. Pure CSS, no script.
Accessibility: A role="radiogroup" with an aria-label around native radio inputs sharing one name, so the arrow keys move the choice and Tab enters the group once; :focus-visible on the input outlines its option. Under prefers-reduced-motion the flower changes instantly.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: neutral only. Black, white and grays, no hues. Use the color values above as written, or my project's closest neutral tokens.
Return a single self-contained component. No dependencies.Goal: Create a "Bloom" radio.
Visual behavior: A growth stage picker on a flower: from a closed bud the petals spread out to half open and then to a full flower, the outer ones last, and the centre grows and glows.
Technique:
- Real native radios (visually hidden: absolute, 1x1, opacity 0) inside <label>s; the scene is aria-hidden and every state is read from the checked input with :has().
- Eight petals hinged at the centre are rotated by (i - 3.5) x a spread variable; a small spread makes a bud and 45 degrees fills the circle.
- Each petal is delayed by its distance from the middle. Pure CSS, no script.
Accessibility: A role="radiogroup" with an aria-label around native radio inputs sharing one name, so the arrow keys move the choice and Tab enters the group once; :focus-visible on the input outlines its option. Under prefers-reduced-motion the flower changes instantly.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: use my project's existing color tokens. The color values above are grayscale placeholders. Map each one by its role (surface, text, border, accent, glow) to my theme, and keep their relative lightness so contrast and the effect still read.
Return a single self-contained component. No dependencies.Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Free to use in any project, commercial included. MIT-0, no attribution required. Licence
About this component
A growth stage picker on a flower: from a closed bud the petals spread out to half open and then to a full flower, the outer ones last, and the centre grows and glows.
- Dependencies
- None
- Difficulty
- Beginner
- Triggers
- click, state change, spring, delay stagger
- Techniques
- css variables, css transition, transition delay stagger
- Reduced motion
- Respected
- Theme
- Light and dark (follows your page's color-scheme)
A role="radiogroup" with an aria-label around native radio inputs sharing one name, so the arrow keys move the choice and Tab enters the group once; :focus-visible on the input outlines its option. Under prefers-reduced-motion the flower changes instantly.