1080 × 1080 px1080 × 1350 px1920 × 1080 px
Capture
React + Tailwind
import { useId } from 'react';
const OPTIONS = [{"value": "photo", "label": "Photo"}, {"value": "video", "label": "Video"}, {"value": "portrait", "label": "Portrait"}];
const css = `
.radio-capture { --i: 0; display: grid; justify-items: center; gap: 12px; width: 260px; }
.radio-capture:has(.radio-capture__opt:nth-child(1) input:checked) { --i: 0; }
.radio-capture:has(.radio-capture__opt:nth-child(2) input:checked) { --i: 1; }
.radio-capture:has(.radio-capture__opt:nth-child(3) input:checked) { --i: 2; }
@keyframes radio-capture-rec { 50% { opacity: 0.25; } }
.radio-capture__finder { position: relative; width: 200px; height: 112px; border-radius: 12px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); overflow: hidden; }
.radio-capture__subject { position: absolute; left: 50%; bottom: -10px; width: 56px; height: 76px; margin-left: -28px; }
.radio-capture__subject::before { content: ''; position: absolute; left: 14px; top: 0; width: 28px; height: 28px; border-radius: 50%; background: light-dark(#6d7179, #7d8087); }
.radio-capture__subject::after { content: ''; position: absolute; left: 0; right: 0; top: 32px; bottom: 0; border-radius: 28px 28px 0 0; background: light-dark(#6d7179, #7d8087); }
/* Portrait: the background melts away behind the subject. */
.radio-capture__bg { position: absolute; inset: 0; background: radial-gradient(circle at 20% 30%, light-dark(#dbdde1, #2e3035) 0 10px, transparent 11px), radial-gradient(circle at 82% 26%, light-dark(#dbdde1, #2e3035) 0 14px, transparent 15px), radial-gradient(circle at 70% 70%, light-dark(#ebedf0, #232529) 0 18px, transparent 19px); transition: filter 0.5s, transform 0.5s; }
.radio-capture__tag { position: absolute; top: 8px; left: 10px; display: inline-flex; align-items: center; gap: 5px; color: light-dark(#42454c, #e5e6e9); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; opacity: 0; transition: opacity 0.3s; }
.radio-capture__tag i { width: 6px; height: 6px; border-radius: 50%; background: light-dark(#373a40, #f1f2f3); animation: radio-capture-rec 1s steps(1) infinite; }
.radio-capture__tag--p { left: auto; right: 10px; }
/* The shutter: a full disc for photo, a small rounded square for video, a disc inside a ring for portrait. */
.radio-capture__shutter { position: absolute; right: 12px; top: 50%; display: grid; place-items: center; width: 36px; height: 36px; margin-top: -18px; border-radius: 50%; box-shadow: inset 0 0 0 2.5px light-dark(#373a40, #f1f2f3); }
.radio-capture__core { width: 26px; height: 26px; border-radius: 50%; background: light-dark(#373a40, #f1f2f3); transition: width 0.4s cubic-bezier(0.3, 1.4, 0.5, 1), height 0.4s cubic-bezier(0.3, 1.4, 0.5, 1), border-radius 0.4s; }
.radio-capture:has(.radio-capture__opt:nth-child(2) input:checked) .radio-capture__core { width: 14px; height: 14px; border-radius: 3px; }
.radio-capture:has(.radio-capture__opt:nth-child(2) input:checked) .radio-capture__tag--v { opacity: 1; }
.radio-capture:has(.radio-capture__opt:nth-child(3) input:checked) .radio-capture__core { width: 18px; height: 18px; }
.radio-capture:has(.radio-capture__opt:nth-child(3) input:checked) .radio-capture__bg { filter: blur(5px); transform: scale(1.1); }
.radio-capture:has(.radio-capture__opt:nth-child(3) input:checked) .radio-capture__tag--p { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
.radio-capture * { transition: none !important; animation: none !important; }
}
.radio-capture__opts { display: flex; gap: 3px; padding: 4px; border-radius: 12px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); }
.radio-capture__opt { position: relative; flex: 1; padding: 7px 10px; border-radius: 8px; color: light-dark(#5f626a, #a7abb2); font-size: 12.5px; font-weight: 500; text-align: center; white-space: nowrap; cursor: pointer; transition: background-color 0.25s, color 0.25s; }
.radio-capture__opt:hover { color: light-dark(#42454c, #e5e6e9); }
.radio-capture__opt:has(input:checked) { background: light-dark(#373a40, #f1f2f3); color: light-dark(#fbfcfd, #121417); }
.radio-capture__opt:has(input:focus-visible) { outline: 2px solid light-dark(#50535b, #c6c8cd); outline-offset: 2px; }
.radio-capture__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
`;
export function CaptureRadio() {
const name = useId();
return (
<>
<style>
{css}
</style>
<div className="radio-capture">
<div className="radio-capture__finder" aria-hidden="true">
<span className="radio-capture__bg" />
<span className="radio-capture__subject" />
<span className="radio-capture__tag radio-capture__tag--v">
<i />
REC 00:12
</span>
<span className="radio-capture__tag radio-capture__tag--p">f/1.8</span>
<span className="radio-capture__shutter">
<span className="radio-capture__core" />
</span>
</div>
<div className="radio-capture__opts" role="radiogroup" aria-label="Camera mode">
{OPTIONS.map((o, i) => (
<label key={o.value} className="radio-capture__opt">
<input className="radio-capture__input" type="radio" name={name} value={o.value} defaultChecked={i === 0} />
{o.label}
</label>
))}
</div>
</div>
</>
);
}Markup where the component goes, CSS in your stylesheet. No JavaScript.
HTML
<div class="radio-capture">
<div class="radio-capture__finder" aria-hidden="true">
<span class="radio-capture__bg"></span>
<span class="radio-capture__subject"></span>
<span class="radio-capture__tag radio-capture__tag--v"><i></i>REC 00:12</span>
<span class="radio-capture__tag radio-capture__tag--p">f/1.8</span>
<span class="radio-capture__shutter">
<span class="radio-capture__core"></span>
</span>
</div>
<div class="radio-capture__opts" role="radiogroup" aria-label="Camera mode">
<label class="radio-capture__opt"><input class="radio-capture__input" type="radio" name="radio-capture" checked="" value="photo"/>Photo</label>
<label class="radio-capture__opt"><input class="radio-capture__input" type="radio" name="radio-capture" value="video"/>Video</label>
<label class="radio-capture__opt"><input class="radio-capture__input" type="radio" name="radio-capture" value="portrait"/>Portrait</label>
</div>
</div>CSS
.radio-capture { --i: 0; display: grid; justify-items: center; gap: 12px; width: 260px; }
.radio-capture:has(.radio-capture__opt:nth-child(1) input:checked) { --i: 0; }
.radio-capture:has(.radio-capture__opt:nth-child(2) input:checked) { --i: 1; }
.radio-capture:has(.radio-capture__opt:nth-child(3) input:checked) { --i: 2; }
@keyframes radio-capture-rec { 50% { opacity: 0.25; } }
.radio-capture__finder { position: relative; width: 200px; height: 112px; border-radius: 12px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); overflow: hidden; }
.radio-capture__subject { position: absolute; left: 50%; bottom: -10px; width: 56px; height: 76px; margin-left: -28px; }
.radio-capture__subject::before { content: ''; position: absolute; left: 14px; top: 0; width: 28px; height: 28px; border-radius: 50%; background: light-dark(#6d7179, #7d8087); }
.radio-capture__subject::after { content: ''; position: absolute; left: 0; right: 0; top: 32px; bottom: 0; border-radius: 28px 28px 0 0; background: light-dark(#6d7179, #7d8087); }
/* Portrait: the background melts away behind the subject. */
.radio-capture__bg { position: absolute; inset: 0; background: radial-gradient(circle at 20% 30%, light-dark(#dbdde1, #2e3035) 0 10px, transparent 11px), radial-gradient(circle at 82% 26%, light-dark(#dbdde1, #2e3035) 0 14px, transparent 15px), radial-gradient(circle at 70% 70%, light-dark(#ebedf0, #232529) 0 18px, transparent 19px); transition: filter 0.5s, transform 0.5s; }
.radio-capture__tag { position: absolute; top: 8px; left: 10px; display: inline-flex; align-items: center; gap: 5px; color: light-dark(#42454c, #e5e6e9); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; opacity: 0; transition: opacity 0.3s; }
.radio-capture__tag i { width: 6px; height: 6px; border-radius: 50%; background: light-dark(#373a40, #f1f2f3); animation: radio-capture-rec 1s steps(1) infinite; }
.radio-capture__tag--p { left: auto; right: 10px; }
/* The shutter: a full disc for photo, a small rounded square for video, a disc inside a ring for portrait. */
.radio-capture__shutter { position: absolute; right: 12px; top: 50%; display: grid; place-items: center; width: 36px; height: 36px; margin-top: -18px; border-radius: 50%; box-shadow: inset 0 0 0 2.5px light-dark(#373a40, #f1f2f3); }
.radio-capture__core { width: 26px; height: 26px; border-radius: 50%; background: light-dark(#373a40, #f1f2f3); transition: width 0.4s cubic-bezier(0.3, 1.4, 0.5, 1), height 0.4s cubic-bezier(0.3, 1.4, 0.5, 1), border-radius 0.4s; }
.radio-capture:has(.radio-capture__opt:nth-child(2) input:checked) .radio-capture__core { width: 14px; height: 14px; border-radius: 3px; }
.radio-capture:has(.radio-capture__opt:nth-child(2) input:checked) .radio-capture__tag--v { opacity: 1; }
.radio-capture:has(.radio-capture__opt:nth-child(3) input:checked) .radio-capture__core { width: 18px; height: 18px; }
.radio-capture:has(.radio-capture__opt:nth-child(3) input:checked) .radio-capture__bg { filter: blur(5px); transform: scale(1.1); }
.radio-capture:has(.radio-capture__opt:nth-child(3) input:checked) .radio-capture__tag--p { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
.radio-capture * { transition: none !important; animation: none !important; }
}
.radio-capture__opts { display: flex; gap: 3px; padding: 4px; border-radius: 12px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); }
.radio-capture__opt { position: relative; flex: 1; padding: 7px 10px; border-radius: 8px; color: light-dark(#5f626a, #a7abb2); font-size: 12.5px; font-weight: 500; text-align: center; white-space: nowrap; cursor: pointer; transition: background-color 0.25s, color 0.25s; }
.radio-capture__opt:hover { color: light-dark(#42454c, #e5e6e9); }
.radio-capture__opt:has(input:checked) { background: light-dark(#373a40, #f1f2f3); color: light-dark(#fbfcfd, #121417); }
.radio-capture__opt:has(input:focus-visible) { outline: 2px solid light-dark(#50535b, #c6c8cd); outline-offset: 2px; }
.radio-capture__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }Goal: Create a "Capture" radio.
Visual behavior: A camera mode picker: the shutter button morphs between photo, record and portrait, video adds a blinking record tag and portrait melts the background behind the subject.
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().
- The shutter core transitions its width, height and border radius between a full disc, a small rounded square and a smaller disc inside the ring, on an overshooting curve.
- Portrait blurs and slightly scales the radial-gradient background behind the subject; video shows a tag with a dot blinking on steps(1). 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 modes change instantly and the dot does not blink.
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 "Capture" radio.
Visual behavior: A camera mode picker: the shutter button morphs between photo, record and portrait, video adds a blinking record tag and portrait melts the background behind the subject.
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().
- The shutter core transitions its width, height and border radius between a full disc, a small rounded square and a smaller disc inside the ring, on an overshooting curve.
- Portrait blurs and slightly scales the radial-gradient background behind the subject; video shows a tag with a dot blinking on steps(1). 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 modes change instantly and the dot does not blink.
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 camera mode picker: the shutter button morphs between photo, record and portrait, video adds a blinking record tag and portrait melts the background behind the subject.
- Dependencies
- None
- Difficulty
- Beginner
- Triggers
- click, state change, morph
- Techniques
- css transition, filter, radial gradient, border radius
- 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 modes change instantly and the dot does not blink.