Location Bubble
wa-ui/location-bubbleFreeComponent
WhatsApp-style location message with map preview, name/address, and Open in Maps CTA.
Live preview
live · rendered by the registry
Rendered by wa-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.meta-cloud-api.site/r/location-bubble.jsonSource
1"use client";23import * as React from "react";4import { Button } from "@base-ui/react/button";5import { cn } from "@/lib/utils";6import { type MessageStatus, MessageStatusIcon } from "./message-status";7import "@/components/ui/whatsapp/styles/whatsapp.css";89export interface LocationBubbleProps extends React.HTMLAttributes<HTMLDivElement> {10 variant?: "incoming" | "outgoing";11 name?: string;12 address?: string;13 latitude: number;14 longitude: number;15 /** Static map preview image URL */16 mapImageUrl?: string;17 timestamp?: string;18 status?: MessageStatus;19 showTail?: boolean;20 onOpenMap?: () => void;21 /** Override the default Google Maps URL */22 mapsUrl?: string;23 /** Override the default `<a>` element for the CTA button (e.g. Next.js Link) */24 renderAction?: (props: { href: string; children: React.ReactNode; className: string; target?: string; rel?: string }) => React.ReactElement;25}2627const LocationBubble = React.forwardRef<HTMLDivElement, LocationBubbleProps>(28 (29 {30 className,31 variant = "incoming",32 name,33 address,34 latitude,35 longitude,36 mapImageUrl,37 timestamp,38 status,39 showTail = false,40 onOpenMap,41 mapsUrl: mapsUrlProp,42 renderAction,43 ...props44 },45 ref46 ) => {47 const isOutgoing = variant === "outgoing";48 const mapsUrl = mapsUrlProp ?? `https://www.google.com/maps?q=${latitude},${longitude}`;4950 return (51 <div52 className={cn(53 "flex w-full",54 isOutgoing ? "justify-end" : "justify-start",55 showTail ? "mb-[6px]" : "mb-[2px]",56 className57 )}58 {...props}59 ref={ref}60 >61 <div62 className={cn(63 "font-wa relative w-[280px] overflow-hidden rounded-lg",64 isOutgoing ? "bg-wa-bubble-outgoing" : "bg-wa-bubble-incoming",65 showTail && (isOutgoing ? "rounded-br-none" : "rounded-bl-none")66 )}67 >68 {/* Tail */}69 {showTail && isOutgoing && (70 <svg viewBox="0 0 8 13" width="8" height="13" className="absolute bottom-0 -right-[8px]">71 <path opacity="0.13" d="M5.188 12H0V0.807l6.467 8.625C7.526 10.844 6.958 12 5.188 12z" className="fill-wa-always-black" />72 <path d="M5.188 13H0V1.807l6.467 8.625C7.526 11.844 6.958 13 5.188 13z" className="fill-wa-bubble-outgoing" />73 </svg>74 )}75 {showTail && !isOutgoing && (76// … truncated
What it pulls in
npm packages
Files it writes
More from wa-ui
All 29 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Action Buttonaction-button | wa-ui | Components | Free | 1 dep · 2 files | |
| Call Permissioncall-permission | wa-ui | Components | Free | 1 dep · 2 files | |
| Carousel Templatecarousel-template | wa-ui | Components | Free | 1 dep · 3 files | |
| Chat Bubblechat-bubble | wa-ui | Components | Free | no deps · 2 files | |
| Chat Headerchat-header | wa-ui | Components | Free | no deps · 2 files | |
| Chat List Itemchat-list-item | wa-ui | Components | Free | no deps · 2 files | |
| Chat Menuchat-menu | wa-ui | Components | Free | 1 dep · 2 files | |
| Contact Bubblecontact-bubble | wa-ui | Components | Free | 1 dep · 3 files |
