shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Let people take a map with them, with this snapshot export map for React with Ark UI. Framepin, a map-poster maker, pins ten places of a three-day trip round Venice on a live Map, from the Ghetto in Cannaregio to the Redentore on Giudecca, with the lagoon city's islands and canals as the picture's silhouette, and lays a frame over it that shows exactly what the picture will hold; everything outside the frame is dimmed. The panel beside the map sets the picture: a title (Input), a size (Toggle Group: Wide 1600 × 900, Square 1200 × 1200 or Tall 1080 × 1350, the frame reshaping to match), a theme (as the page, light or dark, the map redrawn in it) and whether the pins carry their names (Checkbox). Download PNG (Download Trigger with a Shine Button) copies the map's own canvas inside the frame and draws the numbered pins, their names, the title card and the map's credits over it at the picture's size, so the file matches the frame on screen. The places' buttons under the map aim the frame at one place, and the frame button fits all ten again. Built from Map, Input, Toggle Group, Checkbox, Download Trigger, Shine Button and Guides. For trip planners, real estate flyers, event pages and any map someone wants to share as an image.
FAQ
How is the picture made?
The map is drawn with preserveDrawingBuffer on, so its WebGL canvas can be copied. Once every tile has loaded, the part inside the frame is scaled onto a canvas of the chosen size; the pins, their names, the title card and the credits are then drawn over it with the 2D canvas at the same scale, in the theme's own colours, and the result goes to the browser as a PNG through Download Trigger. The map renders at no less than twice the screen's pixels, so the picture stays sharp; on a small screen, whose frame is small, the pins and cards are drawn as for a wider frame so they keep their size in the picture.
Is anything uploaded or saved?
No. The picture is drawn and handed to the browser on your device; nothing leaves the page but the map's own tile requests. The ten places, from the Rialto Bridge to San Giorgio Maggiore, are typed into LINES at the top of the file with their real coordinates, and Framepin and the trip are invented.
How does the theme option work?
As page keeps the map in the page's theme. Dark puts the map in a dark scope, so the basemap, the pins and the title card draw dark. Light on a dark page swaps the page's background and text colours inside the map and mixes the quiet colours from them. The basemap follows each change and the download waits for its new tiles.
Can I use it without a mouse?
Yes. The title, the two toggle groups, the checkbox and Download PNG are all in the tab order, and the ten places are buttons under the map that aim the frame at each one; the zoom and fit buttons sit over the map, which takes the arrow keys and plus and minus once focused. A polite message names the file as it's saved.
Why are the map's credits on the picture?
The basemap is CARTO's over OpenStreetMap data, and both ask to be credited wherever the map is shown. The picture keeps a small credit line at its bottom end, as the live map does.
How does it look on a phone?
The map comes first with its frame, then the places, then the panel with the settings and Download PNG. The frame is small there, so the pins shrink and their names stay in the list under the map; the picture still draws the names when the box is ticked, at the size a wider frame would give them. Scrolling over the map scrolls the page; two fingers pan it. Phones save the PNG to their downloads or files, as any download.





