Skip to content

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

Time Range Filter Map Block for Vue

A year of water main breaks in Montréal as counted clusters, filtered by a two-thumb month range under a bar chart, with Play to step through the year.

On this page5 sections
UI library: Ark UI

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

Narrow a year of incidents to the months that matter, with this time range filter map for Vue with Ark UI. Fuitelog, a utility's incident log, puts a year of water main breaks across eighteen Montréal neighbourhoods on a live Map that follows your theme, light or dark, where nearby breaks merge into counted circles that split as you zoom in. Under the map a dock holds the filter: a bar for each month with its count (the freeze and thaw of January and February the tallest), and a two-thumb Slider under the bars that picks the months to show, so the bars outside the window fade. The clusters and their counts, the chip over the map and four readouts (the breaks, the breaks a day, the busiest month and the median repair time) follow every move. Play slides the window along the year a month at a time and stops at December; the same button pauses it, and it stays off under reduced motion. A lone break opens its card with the pipe, the date and the hours until the water came back. Built from Map, Slider, Button and Guides. For utilities, city services, incident and safety dashboards.

FAQ

Where do the breaks come from, and what stays local?

They are a seeded sample made when the file loads: a monthly count for 2025 in SEASON, each break placed on a bell round one of the neighbourhood centres in AREA_LINES by its share, and given a day, a pipe, a kind and a repair time. The same stream gives the same year on every render and every target. The neighbourhoods are real; Fuitelog and every break are invented. Nothing is fetched or sent except the map's tiles.

How does the month range work?

The slider's two values are month boundaries from 0 (the start of January) to 12 (the end of December), so a window of January to March is 0 to 3. A break is shown when its month is inside the window; the clusters are rebuilt from those breaks only, so their counts are always the window's. Pull both thumbs together and the window is empty: the map clears and the readouts say so.

What does Play do, and can I stop it?

It keeps the window's width and slides it a month at a time, about once a second, until it reaches December, then stops by itself. With the whole year chosen it plays one month at a time from January. Press the button again to pause, or move the slider. With reduced motion on, Play stays off and a line asks you to drag the months instead.

How do the circles count?

The Map's cluster layer groups the breaks that are close together at the current zoom into one circle with their count, a little darker and larger as it grows. Pressing a circle zooms into it; past street level every break stands alone as a dot, and pressing a dot opens its card.

Can I use it without a mouse?

Yes. Play, Whole year and both slider thumbs are in the tab order, and the thumbs move a month with the arrow keys; each bar's month and count are read out as a list. The map takes the arrow keys and plus and minus once focused. A polite message gives the window's count and its busiest month once the slider settles, never while it moves or plays.

How does it look on a phone?

The map comes first with the window's chip over it, then the dock: Play and the window's name, the twelve bars with their counts and month initials, the slider, and the four readouts in two rows. Scrolling over the map scrolls the page; two fingers pan it.