shadcn.io is an independent project built on shadcn/ui
On this page5 sections
Installation
Overview
Select many places at once by drawing round them, with this lasso select map for React with Ark UI. Kerbline, a street repairs planner, puts thirty-two open work orders across central Barcelona on a live Map that follows your theme, from Sant Antoni to the Sagrada Família, each a small marker carrying its crew's letter, hollow and dashed while nobody has it. Click the map to drop the lasso's points and click point 1, or press Close lasso, to close it: every order inside is selected and turns solid on the map. A Toggle Group floating over the map sets what the next lasso does: start a new selection, add to it or take away from it. A click on a marker picks it alone; with Shift, Ctrl or ⌘ held it goes in or out of the selection. The card at the start of the map lists the selection with what it holds ("4 unassigned, 1 urgent") and acts on it in bulk: assign one of three crews, mark the orders urgent, or export them as a CSV file. Built from Map, Toggle Group, Button and Guides. For field service, city maintenance, sales territories and any tool that hands out work by area.
FAQ
How does the lasso decide what is inside?
Once the lasso closes, idsInside casts a ray from each order's point and counts how many of the lasso's edges it crosses: an odd count is inside. At a city's scale longitude and latitude can be treated as flat, so no projection is needed. A lasso can be any shape, even one that folds back on itself; New replaces the selection with what is inside, Add joins the two and Remove takes the inside out.
Where do the orders come from, and what stays local?
The thirty-two orders are typed into LINES at the top of the file: an id, a kind, a real street and neighbourhood with coordinates on that street, a crew and an urgent flag. Kerbline, the orders and the crews are invented. Assigning and marking change the block's own state only, and the CSV file is built in the page from the selected rows; nothing is fetched or sent except the map's tiles.
What do the bulk actions do?
Pick a crew (A, B or C) and press Assign: every selected order takes that crew and its marker shows the letter. Mark urgent flags them all, with a dot on each marker, and pressing it again while all of them are urgent clears the flag. Export CSV downloads the selection as a file with one row per order, crews and coordinates included.
Can I draw a lasso without a mouse?
Yes. Focus the map and pan it with the arrow keys; a crosshair marks its centre, and the crosshair button beside the zoom buttons drops a lasso point there. Press Close lasso once there are three points, and the remove-last-point button steps back. The mode, the crews and every action are buttons in the tab order, each selected order can be taken out from the list, and a polite message says what changed.





