Elige una ruta
HTML + CSSRadio buttons

Route options on a map

Three possible routes on a small map: the chosen one is drawn in colour from end to end and the rest stay dotted.

Settings

16px
1x

Code

<fieldset class="uvq04-map"><legend>Choose a route</legend><div class="mp" aria-hidden="true"><svg viewBox="0 0 200 100" preserveAspectRatio="xMidYMid slice"><rect class="ld" width="200" height="100"/><path class="pk" d="M128 60c14-8 34-6 40 6s-8 26-26 24-26-22-14-30z"/><path class="pk" d="M30 18c10-8 28-4 30 6s-12 18-24 14-14-14-6-20z"/><path class="st" d="M0 52H200M0 30H200M62 0V100M112 0V100M150 0V100M0 80H200"/><path class="rv" d="M-5 72C35 52 50 64 72 49S102 24 128 32S166 24 205 8"/><path class="r r1" pathLength="100" d="M22 80C60 98 96 92 122 70S166 42 178 22"/><path class="r r2" pathLength="100" d="M22 80H62V52H112V30H170L178 22"/><path class="r r3" pathLength="100" d="M22 80C40 60 56 70 76 55S106 30 130 37S164 30 178 22"/><circle class="pa" cx="22" cy="80" r="5"/><circle class="pb" cx="178" cy="22" r="6"/><circle class="pc" cx="178" cy="22" r="2.4"/></svg></div><div class="op"><label><input type="radio" name="uvq04-map" checked><span class="cd"><b>18 min</b><span>Via the motorway</span><small>6,2 km</small></span></label><label><input type="radio" name="uvq04-map"><span class="cd"><b>24 min</b><span>Through the centre</span><small>4,8 km</small></span></label><label><input type="radio" name="uvq04-map"><span class="cd"><b>27 min</b><span>Along the river</span><small>5,5 km</small></span></label></div></fieldset>

Prompt for AI

Paste it into ChatGPT, Claude or Cursor and it will adapt the block to your project with these settings, even if you don’t use React.

Markdown version with all the code, for AI assistants

More in Radio buttons

See all Radio buttons

Where to use it

This radio group pairs three route cards with an inline SVG map of streets, parks and a river. Choosing a card draws its path in the accent colour from start to finish, while the other routes stay as thin dotted lines. Land, parks and water mix with the page colours, so it works in light and dark themes for delivery, travel and fitness apps.

The main color marks the active route and the destination pin, the secondary color the parks and the start point. Edit the three path shapes in the SVG to match your own map, and keep each card to a time, a short name and a distance.