Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Street Map Contact Block for React

A contact section for a print shop: a form with a team select beside a framed street-map drawing with a dashed walking route from the station, and the address and hours under it.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A contact section for React with Base UI. A compact header, then two columns: at the start, a form with name, email, a select for which team should get the note and what needs printing; at the end, a framed street map drawn in greyscale, with two streets across and two down, a river, a rail line with its station, the shop's pin and a dashed walking route between them marked "6 min". The caption says the same in words, and under the map the address and the opening hours sit in two cells that share a hairline. Submitting checks every field, shows each problem under its field and moves focus to the first one; a valid note turns into a confirmation in the same space. It's built from Field, Input, Select, Textarea, Guides, Shine Button and Button.

FAQ

Is the map a real map?

No: it's an SVG drawing of made-up streets, so there's no map tile, key or consent banner to deal with. It's decorative and hidden from assistive technology; the caption under it gives the route in words ("A 6 minute walk from Harbourgate Station: down Harbour Road, then along Quay Street"), and the address and hours are real text. To use a real map, replace StreetMap with your provider's embed and keep the caption.

Does the map flip in a right-to-left layout?

No. A map shows places, so it keeps its direction: the SVG is set to left-to-right layout, and the station stays where it is on the street grid. The form and the text around it follow the page direction.

How is the select labelled?

The label above it names the select's button for screen readers, and focus can land on that button when nothing is chosen. The select's trigger takes the id, and the label points to it with htmlFor.

Where does the form send its data?

Nowhere yet. The submit handler waits 800 milliseconds, as a stand-in for a request, then shows the confirmation, which names the team that was chosen. Replace that timer in submit with your own call: details holds the name, email, team and message; the options are in TEAMS.

How does the form check what's typed?

The form has noValidate, so the browser's own bubbles stay away and the block shows its own messages. On submit, problems checks a name, an email address with an @ and a domain, a team and a message. Each problem appears under its field with an icon, the control gets aria-invalid and an aria-describedby that points to the message, and focus moves to the first one. Typing in a field, or choosing a team, clears its message.

How does it fit on a phone?

Below lg the columns stack: the header, the form, then the map with its caption and the two cells (which also stack below sm). Name and email go one per row, and the submit button goes full width. The map scales with its column, so nothing scrolls sideways at 320 pixels.

  • Pro

    A contact section for a coffee roaster with four cafes: city tabs over a panel with address, hours and a street map, and a form addressed to the cafe you picked.

  • Pro

    A contact split for a photo lab: a short form beside a framed drawing of the email thread, whose first bubble fills with your name and words as you type.

  • Pro

    A reverse split contact hero on solid rails: an abstract dot map with a pulsing marker per office fills the first half up to a divider, beside a headline, a Shine Button and three offices as ruled rows.

  • Pro

    A card-in-card contact section for a bookkeeping service: the details of the desk you pick beside a raised form with a live message counter.

  • Pro

    A talk-to-sales split for a scheduling platform: what happens next as three numbered steps and a band of contact details beside a form that checks itself, shows each problem under its field and confirms in place.

  • Pro

    A contact split for a design studio: a tall tinted panel of email, phone and address with a copy button each, hours and profile links, beside a raised brief form.