Uai

mapsmap-controls.tsx

Color theme

component · 86/108

Map Controls

Zoom, compass, locate, and custom camera buttons in stacked, bar, and compact variants.

Install

Install manuallyView source on GitHub

Anatomy

  • MapFrame
  • MapFramePlaceholder
  • MapFrameOverlay
  • MapControls
  • MapControlsGroup
  • MapControlsZoomIn
  • MapControlsZoomOut
  • MapControlsCompass
  • MapControlsLocate
  • MapControlsButton

Accessibility4 checks

  • Controls sit in a labelled group, and every icon button has an accessible name and a matching tooltip.
  • Zoom limits use the native disabled state, so keyboard and pointer users meet the same bounds.
  • Locate speaks its state in its name, exposes aria-pressed while following, and aria-busy while locating.
  • The compass needle animates its bearing reset, and the animation stops under reduced motion.
canvasvariant="stacked"maps
Maps
map controls variant

Code example

usage.tsx
"use client";import { Layers, Maximize2 } from "lucide-react";import { useEffect, useState } from "react";import {  MapControls,  MapControlsButton,  MapControlsCompass,  MapControlsGroup,  MapControlsLocate,  type MapControlsLocateStatus,  type MapControlsVariant,  MapControlsZoomIn,  MapControlsZoomOut,} from "@/components/ui/uai/map-controls";import { MapFrame, MapFrameOverlay, MapFramePlaceholder } from "@/components/ui/uai/map-frame";export function MapControlsPreview({ variant = "stacked" }: { variant?: MapControlsVariant }) {  const [zoom, setZoom] = useState(14);  const [bearing, setBearing] = useState(-32);  const [locate, setLocate] = useState<MapControlsLocateStatus>("idle");  useEffect(() => {    if (locate !== "locating") return;    const timer = window.setTimeout(() => setLocate("active"), 1200);    return () => window.clearTimeout(timer);  }, [locate]);  return (    <MapFrame aria-label="Delivery zone map" style={{ height: 320 }}>      <MapFramePlaceholder style={{ rotate: `${bearing}deg`, scale: 1 + (zoom - 14) * 0.08 }} />      <MapFrameOverlay position={variant === "bar" ? "bottom" : "top-right"}>        <MapControls variant={variant}>          <MapControlsGroup>            <MapControlsZoomIn disabled={zoom >= 18} onClick={() => setZoom((z) => z + 1)} />            <MapControlsZoomOut disabled={zoom <= 10} onClick={() => setZoom((z) => z - 1)} />          </MapControlsGroup>          <MapControlsGroup>            <MapControlsCompass bearing={bearing} onClick={() => setBearing(0)} />            <MapControlsLocate              status={locate}              onClick={() => setLocate(locate === "active" ? "idle" : "locating")}            />          </MapControlsGroup>          <MapControlsGroup>            <MapControlsButton label="Map layers">              <Layers strokeWidth={1.75} aria-hidden="true" />            </MapControlsButton>            <MapControlsButton label="Full screen">              <Maximize2 strokeWidth={1.75} aria-hidden="true" />            </MapControlsButton>          </MapControlsGroup>        </MapControls>      </MapFrameOverlay>    </MapFrame>  );}

Manual installation

map-controls.tsx

Loading component source…

esc
ThinkingAI
MessageAI
CitationAI
AttachmentAI
Tool CallAI
Response StatusAI
Run SummaryAI
Conversation ThreadAI · Block
Research SessionAI · Block
File AnalysisAI · Block
Agent RunAI · Block
Approval CardFeedback
Empty StateFeedback
Status BannerFeedback
Progress SummaryFeedback
Inline FeedbackFeedback
Confirmation DialogFeedback
Activity TimelineFeedback
Skeleton GroupFeedback
Prompt ComposerForms
Form FieldForms
Search FieldForms
Filter BarForms
File UploadForms
Date Range PickerForms
Form Error SummaryForms
Unsaved Changes BarForms
Step IndicatorForms
Task ListData Display
Data Table ToolbarData Display
Metric CardData Display
Description ListData Display
Comparison TableData Display
Kanban BoardData Display
Calendar ViewData Display
Audit LogData Display
App HeaderNavigation
App SidebarNavigation
Breadcrumb TrailNavigation
Page TabsNavigation
Command MenuNavigation
Split PaneNavigation
Sign-in CardAuthentication
Sign-up CardAuthentication
Password RecoveryAuthentication
Code VerificationAuthentication · Block
Onboarding WizardAuthentication · Block
Workspace SetupAuthentication · Block
Coupon FieldCommerce
Quantity PickerCommerce
Cart ItemCommerce
Price SummaryCommerce
Order StatusCommerce
Product DetailCommerce · Block
Product ListingCommerce · Block
Cart DrawerCommerce · Block
CheckoutCommerce · Block
Order TrackingCommerce · Block
Subscription ManagementCommerce · Block
Announcement BarMarketing
Pricing ToggleMarketing
Testimonial CardMarketing
Product GalleryMarketing
Trust PanelMarketing
Newsletter FormMarketing
Hero SectionMarketing · Block
Feature ShowcaseMarketing · Block
Pricing SectionMarketing · Block
Testimonials SectionMarketing · Block
FAQ SectionMarketing · Block
Call to ActionMarketing · Block
Waitlist SectionMarketing · Block
Contact SectionMarketing · Block
Author CardContent
CommentContent
Reaction BarContent
Share MenuContent
Changelog EntryContent
Article PageContent · Block
Documentation PageContent · Block
Changelog PageContent · Block
Comment ThreadContent · Block
Community FeedContent · Block
Public ProfileContent · Block
Map FrameMaps
Map ControlsMaps
Map MarkerMaps
Map LegendMaps
Place CardMaps
Route SummaryMaps
Dashboard ShellApplication · Block
Settings PageApplication · Block
Profile PageApplication · Block
Team ManagementApplication · Block
Notification CenterApplication · Block
Billing PortalApplication · Block
Search ResultsApplication · Block
Resource ManagerOperations · Block
Data ExplorerOperations · Block
Import WorkflowOperations · Block
Approval QueueOperations · Block
Audit Log ViewerOperations · Block
Incident DashboardOperations · Block
Report BuilderOperations · Block
Document FieldBrazil
CEP FieldBrazil
Pix PaymentBrazil
Installment PickerBrazil