Skip to content

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

School Districts Map Block for React

Five school zones along real Denver streets on a live map: drag Home, click the map or use the arrow keys to see the zoned school and how far it is.

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

Tell families which school an address belongs to, with this school districts map for React with Base UI. Classwick, a school-zone lookup, draws five zones over south-east Denver on a live Map that follows your theme, light or dark, each one along real streets (Downing, University, Colorado and Holly; 6th, Alameda, Mississippi and Evans) with its school as an icon pin. A house-shaped Home pin can be dragged, dropped anywhere with a click on the map, or focused and moved with the arrow keys; the zone it sits in, found by ray casting on the zone's outline, is shaded, and a card over the map names the zoned school with its distance and the year the zone was drawn, while a dashed line joins Home to it. Crossing a street that is a border changes the answer, and a polite message says so. Under the map, five cards hold the schools with their distance from home, pupils on roll and class size; pressing one outlines its zone and labels its pin, while the map keeps all five zones in view, and the zoned one carries a Badge. Built from Map, Badge, Button and Guides. For school finders, property sites and local-government apps.

FAQ

How is the zoned school found?

zonedAt casts a ray east from Home and counts how many edges of each zone's outline it crosses: an odd count means Home is inside. The zones share their borders, so a point is in one zone at most; a point outside all five gets no zoned school and the card says so. The outlines are typed in OUTLINES from the eight street lines at the top of the file.

What is real, and what stays local?

The streets and their positions are real. Classwick, the five zones, the schools, their pupils, class sizes and years are invented sample data, not advice: zones in your area come from your school district. Nothing is fetched at runtime but the map tiles, no location is asked for, and the address never leaves the page.

How far is far?

The distance on the card and on each school's card is the straight line from Home to the school (the haversine formula over the earth's radius), to a tenth of a kilometre. It is a guide, not a walking route; the dashed line on the map shows the same straight line.

Can I use it without a mouse?

Yes. Home is a focusable draggable marker: the arrow keys move it ten pixels a step, with Shift forty, and the answer follows as it crosses a border. Every school card is a button with a pressed state, and the zoom and put-Home-back buttons work from the keyboard. A polite message gives the zoned school and its distance once Home comes to rest.

What do the school cards do?

Pressing a card outlines that school's zone with a heavier line, tints it and labels its pin; pressing it again clears it. The camera stays on all five zones, so the outline is always in view, and pressing a card never moves Home, so you can look round other zones and keep your answer.

How does it look on a phone?

The map comes first with the answer card over its top, then the caption, then the five school cards as a row that scrolls sideways and snaps card by card; from the md breakpoint they sit in one row of five. The page scrolls over the map; two fingers pan it, and one finger drags Home.