Skip to content

shadcn.io is an independent project built on shadcn/ui

Bottom Sheet Map Block for React

A full-bleed live map with a bottom sheet on phones that snaps to peek, half and full by drag, press or keys, and a side panel on wider screens.

On this page5 sections

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

Put the results in a sheet over the map, the way phone map apps do, with this bottom sheet map for React with Base UI. Swimlark, a swimming app, reads the water at eight places to swim round Copenhagen (three harbour baths, three beaches and two sea baths) on a live Map that fills the panel and follows your theme, light or dark. On a phone the results ride in a sheet over the map's foot with three heights, peek, half and full: drag its handle, press it to step through them, use the arrow keys on it, or press the button beside the title. From md up the same sheet becomes a panel at the map's start. The sheet holds a Toggle Group to filter by kind, the list, and the chosen place's card with its water temperature, quality and lifeguards, and a way back to the list. The camera keeps what it frames clear of the sheet, its padding following the sheet's height on a phone and the panel's width above, and the map's credits ride above the sheet. Each place's pill gives the water's temperature and its ring the water's quality. Built from Map, Toggle Group, Button and Guides. For finders, store locators, travel apps and any map people use one-handed.

FAQ

How does the sheet move?

It has three heights, peek, half and full, typed in pixels for the phone's 40rem box. Dragging the handle follows the finger or the pointer (a pointer capture on the handle) and lets go at the nearest height; a press without a drag steps up through them and back to peek. Choosing a place from peek lifts the sheet to half so its card shows. The height is a CSS variable, so the sheet's own transition does the easing, and none when reduced motion is on.

How does the map stay clear of the sheet?

MapCamera gets padding from the sheet: on a phone its bottom is the sheet's height plus a margin (the half height when the sheet is full, since then the map hardly shows), from md up its start is the panel's width, on the right in a right-to-left page. A new padding is a new aim, so the camera moves as the sheet settles and the chosen place, or every place in the filter, stays in the part of the map you can see. The map's credits move up with the sheet.

Can I use it without a mouse?

Yes. The handle is a button: Enter or Space steps the sheet, the up and down arrows grow and shrink it, Home and End go to peek and full. The filter is a toggle group, every place in the list is a button that opens its card, and the card's back button returns to the list. The pills on the map are a pointer shortcut to the same choice, and a polite message says what the sheet shows once a choice settles.

Where do the places and readings come from, and what stays local?

The eight places sit at their real coordinates, looked up once on OpenStreetMap. The water temperatures, the quality and the lifeguards in LINES are invented for one summer morning, AS_OF; nothing is fetched or saved except the map's tiles. In your app, fill the list from your readings and keep the sheet as it is.

What do the pills mean?

The number is the water's temperature in degrees Celsius. A solid ring means good water, a dashed ring fair water, and a faint pill reading Closed means nobody should swim there today; the list says the same in words, so nothing is told by the ring alone. The chosen place's pill turns solid and its name stays beside it.

What changes on a wider screen?

From md up the sheet is a panel the full height of the map at its start, with no handle, the list scrolling inside it, and the map's zoom buttons at the bottom end. On a phone they move to the top end, above the sheet.