Krizaka UI
Krizaka UI

Map

Maps that cost nothing per view — MapLibre (open source) over Protomaps tiles on the Krizaka CDN, painted from the tokens in dark or light and in the product's accent — with markers, clusters, the person's position, a radius and a location picker.

Web · ✓Mobile · ✓Desktop · ✓BetaData display
Support level
Beta
Size
12.7 kB gzip, budget 17.3 kB
Who uses it
6 files of the live products and sites import it (Folioviv: 3) Counted in the dated inventory of 2026-11-23.
import { Map, Marker, Cluster, UserPosition, RadiusCircle, Route, Pulse, LocationPicker, StaticMap, mapStyle, distanceMeters, formatDistance, pathLength, pointAlong, sliceLine } from "@krizaka/ui/map";

Web and mobile — the same component for React and React Native. Beta: its API may still change in a minor version.

Why it is here. Used by Folioviv.

When to use

  • To show where things are: pick-up points, creators near you, an event's venue.
  • Cluster for many points (dozens to thousands): they group while close and open by zooming in.
  • LocationPicker to choose a place: a meeting point, a delivery address, the centre of a search with its radius.
  • StaticMap where a live map is too much (a card, a list, an e-mail) and as the fallback of every Map.

When not to use

  • For an address typed or searched: a text field (geocoding is a server's job — Nominatim or Photon self-hosted later), the map only confirms it.Use instead: Field
  • For figures by country or region (a choropleth): a chart.Use instead: Stat

Installation

Install

npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcss

Styles

@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";

Import

import { Map, Marker, Cluster, UserPosition, RadiusCircle, Route, Pulse, LocationPicker, StaticMap, mapStyle, distanceMeters, formatDistance, pathLength, pointAlong, sliceLine } from "@krizaka/ui/map";

Examples

Places

Pick-up points in Montréal: markers are buttons, the chosen one shows its name.

Cluster

Sixty creators grouped while they are close; a group opens by zooming in.

Location picker

A meeting point under the pin, its distance from the person, a 1-km zone and Near me.

Full-screen map

A map that is the whole screen takes the wheel and one finger with gestures="map"; in a page the default leaves them to the page.

Route

A delivery: pins that drop, a route that draws itself, a courier that travels it, a demand pulse — still under reduced motion.

Place sheet

A non-modal sheet over the map (snap points on a phone, a side card from md): an info card with one action and a route card that opens the person's own navigation app.

Pins

MapPin in its three shapes (drop, disc, the Cahier's tag) and four states (default, selected, visited, closed): the state is said by shape as well as colour.

Static map

The places on the map's paper, without an engine: a card, a list item, a fallback.

Props

LocationPicker

A position picked by moving the map under a pin; its distance from the person; "near me" on request.

PropTypeDefaultDescription
labelrequiredstring—The picker's accessible name ("Meeting point"), passed translated.
localerequiredstring—The BCP 47 locale of the distance.
onValueChangerequired(value: LngLat) => void—Called when the map rests on a new position.
valuerequiredLngLat—The chosen position (controlled): the centre of the map.
brandBrandId—The product whose accent the map carries. Default krizaka.
classNamestring—Classes merged on the root (its height: h-80, aspect-video).
fallbackReactNode—Shown in place of the map while its engine loads, and for good without WebGL: a StaticMap, a picture.
labelsPartial<LocationPickerLabels>—The words, passed translated; English by default.
langstring—The language of the labels (fr, en). Default en.
originLngLat | nullnullWhere the person is, when the app already knows it (the distance chip shows at once).
radiusnumber—A radius in metres drawn around the chosen position (a delivery zone, a search radius).
regionMapRegion | null—The detailed region (PMTiles) drawn from zoom 6.5. Default: our Montréal–Québec extract (to zoom 14).
schemeMapScheme—The scheme: auto (default) follows the page (html.light) as it changes; dark or light pins it.
worldMapRegion | null—The world's low zooms (PMTiles). Default: our world extract (to zoom 6).
zoomnumber14The zoom at first. Default 14.

Cluster

Many points grouped while they are close: a disc with the count, opened by zooming in; each point is listed for screen readers.

PropTypeDefaultDescription
pointsrequiredreadonly ClusterPoint[]—The points: many of them (creators, pick-up points, events).
onPointPress((point: ClusterPoint) => void)—Pressing a single point. A group zooms in to open itself.
radiusnumber48The radius, in pixels, within which points group. Default 48.

MapRoot

A map: MapLibre over our Protomaps tiles, styled from the tokens, with its places as a list for screen readers.

PropTypeDefaultDescription
centerrequiredLngLat—Where the map looks at first: longitude, latitude.
labelrequiredstring—The map's accessible name ("Pick-up points near you"), passed translated.
brandBrandId—The product whose accent the map carries. Default krizaka.
childrenReactNode—Markers, circles, clusters, the user's position — and anything drawn over the map.
classNamestring—Classes merged on the root (its height: h-80, aspect-video).
controlledboolean—The camera follows center and zoom when they change (flies, or jumps under reduced motion).
controlsbooleantrueThe zoom buttons (default) — the keyboard also zooms with + and − on the focused map.
fallbackReactNode—Shown in place of the map while its engine loads, and for good without WebGL: a StaticMap, a picture.
gesturesMapGesturespageWho owns the wheel and the fingers. page (default): the wheel and one finger scroll the page past the map; the map zooms with Ctrl/⌘ + wheel, two fingers and the buttons, and a short hint says so. map: the map is the screen (full height) and takes every gesture.
interactivebooleantrueMoves with the hand (default); false makes a still picture of a place.
labelsPartial<MapLabels>—The words, passed translated; English by default.
langstring—The language of the labels (fr, en). Default en.
onMoveEnd((view: { center: LngLat; zoom: number; }) => void)—Called when the camera rests: its centre and zoom.
onPress((position: LngLat) => void)—Called with the position pressed on the map (not on a marker).
regionMapRegion | null—The detailed region (PMTiles) drawn from zoom 6.5. Default: our Montréal–Québec extract (to zoom 14).
schemeMapSchemeautoThe scheme: auto (default) follows the page (html.light) as it changes; dark or light pins it.
variantMapVariant—The look: plain (default), notebook (the Cahier: paper and ink, manila tags for clusters).
worldMapRegion | null—The world's low zooms (PMTiles). Default: our world extract (to zoom 6).
zoomnumber12The zoom at first (0 the world, 12 a city, 16 a street). Default 12.

Marker

A place on the map: an accent dot (or your content) that is a button when it does something.

PropTypeDefaultDescription
labelrequiredstring—Its words: the place's name, read in the list of places and as the button's name ("Café Olimpico, 350 m").
positionrequiredLngLat—Where it stands.
childrenReactNode—What it draws instead of the accent dot (an avatar, an icon).
dropnumber—Drops onto its place once, after this many milliseconds (stagger several: index * 90). Still under reduced motion.
onPress(() => void)—Pressing it (details in a panel, a sheet): the marker becomes a button.
selectedboolean—The chosen one: larger, its label shown above it.
sizenumber18Its size in pixels. Default 18.

Pulse

A heat pulse: rings that swell and fade around a place (a hot spot, a demand peak). Still rings under reduced motion.

PropTypeDefaultDescription
labelrequiredstring—Its words ("High demand in Mile End"), read in the list of places.
positionrequiredLngLat—Where it beats.
sizenumber56The rings' reach in pixels. Default 56.
tone"accent" | "soft"accentaccent (a zone that matters) or soft. Default accent.

RadiusCircle

A circle on the ground: a delivery zone, a search radius — filled with the accent, its edge drawn.

PropTypeDefaultDescription
centerrequiredLngLat—Its centre.
radiusrequirednumber—Its radius in metres.
tone"accent" | "soft"accentaccent (a zone that matters: a delivery area, a search radius) or soft (an accuracy).

Route

A route on the map: a line that draws itself, and a courier that travels it. Under reduced motion the line is whole and the courier rests at the end.

PropTypeDefaultDescription
labelrequiredstring—Its words ("Delivery from the studio to Mile End, 2.4 km"), read in the list of places.
pathrequiredreadonly LngLat[]—The path, as positions in order (a polyline: a delivery, a walk, a flight).
courierReactNode—A dot that travels the route once drawn (true, or your own content: an avatar, an icon).
drawbooleantrueThe line draws itself once, from its start, when the map is on screen; false shows it whole. Default true.
durationnumber1400How long the drawing lasts, in milliseconds. Default 1400.
easing"linear" | "ease-in-out" | "ease-out"—The timing function of the drawing and of the trips: ease-out, linear, ease-in-out. Default: out for the drawing, in-out for a trip.
pausedbooleanfalseHolds the drawing and the trips where they are (a controlled pause, on top of the off-screen one).
repeatAfternumber—Start the trips again after a pause (milliseconds), only while the map is on screen. Without it the courier makes one trip.
replayKeystring | number—Changing it replays the drawing and the trip.
tone"accent" | "soft"accentaccent or soft. Default accent.
tripDurationnumber3200How long a trip takes, in milliseconds. Default 3200.

UserPosition

The person's position: a dot that pulses (still under reduced motion), its accuracy as a soft disc.

PropTypeDefaultDescription
labelrequiredstring—Its words ("You are here"), read in the list of places.
positionrequiredLngLat—Where the person is.
accuracynumber—The accuracy in metres: a soft disc around the dot.

StaticMap

A still map: the places on the map's paper (or on a snapshot), named in words.

PropTypeDefaultDescription
centerrequiredLngLat—The centre of the picture.
labelrequiredstring—What the picture shows, in words ("Three pick-up points in the Plateau"), passed translated: its accessible name.
classNamestring—Classes merged on the root (its size).
imagestring—A snapshot of the real map of the area (same centre and zoom), drawn under the places; the attribution then shows.
placesreadonly StaticMapPlace[][]The places drawn on it (an accent dot each), listed in its name.
zoomnumber12The zoom of the picture. Default 12.

Accessibility

  • The canvas is hidden from assistive technologies: the places are read as a list (each Marker, Cluster point and the person's position by its label).
  • A marker with onPress is a button named by its label (aria-pressed when it can be chosen); the chosen one shows its name above it.
  • Under reduced motion the camera jumps instead of flying and the position's pulse stands still.
  • Colours come from the tokens: the water is the accent softened, roads and labels the text roles — readable in both schemes.

Keyboard

KeysAction
TabThe map (a region named by label), then its buttons: zoom, the markers that do something, Near me.
Arrow keysPan the focused map.
Ctrl / ⌘ + wheelZoom the map; a plain wheel scrolls the page (unless gestures="map").
+ / −Zoom the focused map in or out.

Best practices

  • Give every map a label and every marker a label: they are read as the list of places in place of the map.
  • Always pass a fallback (StaticMap with the same centre and places): it shows while the engine loads and for good without WebGL.
  • Motion on a map: Marker drop={index * 90} drops pins in turn, Route draws its line once (and a courier makes one trip, repeatAfter repeats it while the map is on screen), Pulse beats around a hot spot. The drawing is finite — nothing runs afterwards — and everything is in place at once under reduced motion.
  • Ask for the position only on a press (LocationPicker's Near me), never on load; every refusal has its words.
  • variant is the look: plain (the product register, default), notebook (the Cahier — paper and ink, a cluster as a manila tag, a lone place in the margin's red). scheme="auto" (default) follows the page; dark or light pins it. Both come from the tokens — never a hand-written map style.
  • MapPin (from @krizaka/ui/map/pin) is the marker's face when the dot is not enough: put it in a Marker's children. Its state is also said by shape (hollow visited, dashed closed, larger selected).
  • In a page the wheel scrolls the page, not the map (gestures="page", the default): the map zooms with Ctrl/⌘ + wheel, two fingers on a phone and its + / − buttons, and the engine's overlay says so in the map's words (labels.gestureHelp: MapLibre's CooperativeGesturesHandler.*HelpText keys). A map that IS the screen (an explorer, full height) opts in with gestures="map".
  • Keep the attribution visible (OpenStreetMap's licence, the ODbL, asks for it): the components draw it.
  • Import the place sheet from @krizaka/ui/map/sheet (MapSheet) and the cards from @krizaka/ui/map/cards (MapInfoCard, RouteCard, routeLinks): their own entries, so a page that only draws a map does not pay for them.
  • Install the engine only where a map is shown: maplibre-gl (web) or @maplibre/maplibre-react-native (Expo) — optional peers.

Generated from the code of @krizaka/ui 5.3.4: its meta.ts, its examples and its types.Edit this documentation on GitHub

On this page