Click to Call
ProNewA floating call bubble that opens a card with the agent's portrait, status, greeting and a tel: link.
Installation
First time? Add the @viewport registry to components.json. Setup takes one minute.
Usage
Props
| Prop | Type | Default |
|---|---|---|
| phone* | stringThe number as people should read it, for example "+1 800-123-4567". | — |
| href | stringThe link the number opens. Defaults to a `tel:` link built from the digits of `phone`. | — |
| name | stringThe agent's name. Leave it out for a card with only a heading and the number. | — |
| role | stringA line under the name, such as a job title. | — |
| avatar | stringPortrait URL. Initials are shown when it is missing or fails to load. | — |
| title | stringA heading for cards without an agent, for example "Call us now". | — |
| message | React.ReactNodeThe greeting above the number. | — |
| online | booleanWhether someone is there to answer. Offline greys the status dot and shows `offlineNote`. Ignored when `hours` is given. | — |
| hours | WeekHoursOpening hours that decide `online` for you, in the business's `timezone`. While closed the widget follows `whenClosed`. | — |
| timezone | stringIANA timezone for `hours`. Defaults to the visitor's own. | — |
| exceptions | HoursException[]Holiday and one-off hours, replacing the week on their date. | — |
| whenClosed | "offline" | "hide"What happens outside `hours`: `offline` shows the card as offline with the next opening time, `hide` removes the widget entirely. Has no effect without `hours`. | "offline" |
| offlineNote | stringShown under the number while offline. | "We are offline right now. Leave a voicemail and we will call back." |
| tone | "auto" | "dark" | "accent"Card surface: `auto` follows the theme, `dark` is always dark, `accent` fills the card with the accent color. | "auto" |
| accent | stringColor of the bubble and the number. Any CSS color that reads well under white text. | "#16a34a" |
| position | "bottom-right" | "bottom-left"Which bottom corner the bubble sits in. | "bottom-right" |
| fixed | booleanPin to the viewport. Turn it off to place the widget inside the nearest positioned parent. | true |
| open | booleanControlled open state. | — |
| defaultOpen | booleanWhether the card starts open when uncontrolled. | false |
| onOpenChange | (open: boolean) => voidCalled when the card opens or closes. | — |
| openAfter | numberOpen the card by itself after this many milliseconds. Runs once. | — |
| pulse | booleanRings around the closed bubble to draw the eye. | true |
| copyable | booleanAdds a button that copies the number, for devices that cannot place calls. | true |
| onCall | () => voidCalled when the number is pressed, for your own click tracking. | — |
| label | stringAccessible name of the bubble. | "Call us" |
| className | string | — |
Accessibility
- The bubble is a button with aria-expanded; the card is a labelled dialog that comes next in the tab order.
- Escape closes the card and returns focus to the bubble.
- The number is a real tel: link, with a copy button for devices that cannot dial.
- Online or offline is stated in text for screen readers, not only by the dot color.
- The pulse and the open animation are removed under reduced motion.