Theme studio

Design a theme, preview it live, then export it. Saved in this browser.

Quick picks #10b981
Generated scale
50100200300400500600700800900
Some text is below AA

MapView

  • working
  • RTL

A real, interactive map for the map markers: MapLibre on OpenFreeMap vector tiles (no API key), painted with the Nexera map tokens, so it follows light, dark and custom themes, with labels in the app's own font. Coordinates are [lng, lat]. The map is created when its box comes near the viewport (maplibre-gl is loaded then, not with the page) and removed on unmount. Before that, and when the map can't start, the box keeps its size in the land colour. Consumer duties: give the same information next to the map as text (a list of people or places), because a map is hard or impossible to use for many people; show a user's position only with their consent; keep the credit visible.

import { MapView } from "@nexera-ui/react";
Loading example…
7
examples
21
props
3
live controls
1
platform
0
WCAG criteria
4
blocks use it

Try every prop. Copy the code.

Change the props and the code updates. Check light and dark, LTR and RTL, and phone width.

Loading…
controls
locate
children
Generated code
import { MapView } from "@nexera-ui/react";

<MapView />

Examples 6

The same examples as Storybook, rendered live. Open Code to copy one.

Clustered

300 people: nearby markers merge into clusters with status segments; press one to zoom in until it splits.

Loading example…

List drives selection

The list beside the map drives selection: the map flies to the person you pick, and their marker shows it.

Loading example…

Location

"Centre on me" with a known position (no browser request), for demos or when the app already knows where you are.

Loading example…

Dark

Dark theme: the same tokens, their dark values.

Loading example…

Right to left

Right to left: the controls and the credit move to the left; the map itself never mirrors.

Loading example…

Custom style

Your own style or tiles: Nexera colours and the default credit are then yours to provide.

Loading example…

Props 21

Press "Try it" on a card to load that prop into the playground.

21 props shown

aria-labelNexera
string
Default –
aria-labelledbyNexera
string
Default –
defaultCenterNexera
LngLat

Where the map opens, as [lng, lat] (uncontrolled).

Default [0, 20]
centerNexera
LngLat

Controlled centre, as [lng, lat].

Default –
defaultZoomNexera
number

Opening zoom, 0 (world) to 20 (uncontrolled).

Default 2
zoomNexera
number

Controlled zoom.

Default –
onViewChangeNexera
(view: { center: LngLat; zoom: number; }) => void

Called after the map stops moving.

Default –
selectedIdNexera
string | null

Flies to the MapMarker or MapMarkers item with this id, zooming past its cluster.

Default –
controlsNexera
boolean

Zoom in, zoom out and (with locate) Centre on me.

Default true
locateNexera
boolean

Adds "Centre on me", which asks for the browser's location when pressed.

Default false
userLocationNexera
LngLat | null

Your own position for the user (no browser request): demos, or when the app already knows it.

Default –
onLocationErrorNexera
(reason: "denied" | "unavailable") => void

Called when the location can't be found, besides the built-in message.

Default –
mapStyleNexera
string | StyleSpecification

Your own MapLibre style (URL or object). Nexera colours and the default credit are then yours to provide.

Default –
minZoomNexera
number
Default 1
maxZoomNexera
number
Default 18
workerUrlNexera
string

Where MapLibre's web worker script is loaded from. Bundlers do not copy it from the maplibre-gl package, so by default it comes from jsDelivr at the installed version; to avoid that request, serve maplibre-gl/dist/maplibre-gl-worker.mjs yourself and pass its URL.

Default –
heightNexera
string | number

Height of the map box, held before the map loads.

Default 400
labelsNexera
Partial<MapViewLabels>

Visible and announced strings. Translate them.

Default –
classNameNexera
string

Extra classes, merged last.

Default –
styleNexera
CSSProperties
Default –
childrenNexera
ReactNode

MapMarker and MapMarkers.

Default –

* Required. React Aria props shown are the ones most apps use; the component accepts the rest of its React Aria props too.

Accessible by default.

Built on React Aria, and covered by the WCAG 2.2 evidence generated on every build.

This component relies on the shared primitives' accessibility tests; no criteria are tagged to it directly yet.

Fits any width.

Nexera components respond to the space they are given. Drag the corner of the frame, or pick a width.

0 px · drag the corner

Styling hooks

Pass className to add Tailwind classes (merged last). State is exposed as data attributes, so you can style it with variants like data-pressed:.

Usage
<MapView className="shadow-sm" />

Used in blocks

Related components