All blocks

setup

Mapbase Provider

Configure the Mapbase SDK once at the app root — shared client, source, and country for all blocks.

Live preview

Install

$bunx shadcn@latest add https://mapbase.dev/r/mapbase-provider.json

Copies source into your app and installs npm + registry dependencies.

npm dependencies

mapbase@tanstack/react-query

Registry dependencies

None.

Source

components/mapbase/mapbase-provider.tsx
"use client"

export { MapbaseProvider, useMapbase, useOptionalMapbase } from "mapbase/react"
export type { MapbaseProviderProps } from "mapbase/react"