Share a listing
The listing page's share screen, from ShareModal, which shares your own listing URL through the device's share sheet or a modal with Copy link, Facebook, WhatsApp and email.
The share button on a listing page shares the page itself: the listing's URL on your own domain.
On phones and computers that offer a share sheet, the button opens it. Everywhere else it opens the
share screen, with the link in a field, a "Copy link" button, and buttons for Facebook, WhatsApp and
email. ListingDetail mounts the share screen for you whenever the page has a share link.
What the visitor sees
<!--
The share dialog, closed.
From the React component ShareModal. Generated by npm run idx:recipes-static from @ruuster/idx-recipes. Do not edit it by hand.
Fill each value from:
.rw-share[data-rw-share-url] and input[data-rw-share-input] value: your own URL of the listing page (the canonical URL); a path is read against the page's address
.rw-share[data-rw-share-native]: "true" to use the device's share sheet where the browser has one, "false" to always show the dialog
a[data-rw-share=facebook][href]: https://www.facebook.com/sharer/sharer.php?u= and the URL, URL-encoded
a[data-rw-share=whatsapp][href]: https://wa.me/?text= and "Take a look at this home: {URL}", URL-encoded
a[data-rw-share=email][href]: mailto:?subject="A home at {address}" ("A home in {city}" when the address is hidden)&body= the same sentence as WhatsApp, each URL-encoded
id, for, aria-labelledby, aria-describedby: any values that are unique on the page
Every data-rw-* attribute is a hook for ruuster-idx.js; see ../HOOKS.md.
-->
<div class="rw-modal-host" data-rw-screen="share">
<dialog class="rw-recipes rw-modal rw-modal--md" data-rw-modal="share" aria-labelledby="share-modal-1">
<div class="rw-modal__panel">
<div class="rw-modal__header">
<h2 class="rw-modal__title" id="share-modal-1">Share this home</h2>
<button type="button" class="rw-modal__close" aria-label="Close" data-rw-modal-close="">
<svg class="rw-icon" viewBox="0 0 24 24" width="24" height="24" data-rw-icon="close-white" focusable="false" aria-hidden="true"><g fill="none"><g clip-path="url(#rw-close-white-clip0_close_white)"><path d="M18.3002 5.7107C17.9102 5.3207 17.2802 5.3207 16.8902 5.7107L12.0002 10.5907L7.11022 5.7007C6.72022 5.3107 6.09021 5.3107 5.70021 5.7007C5.31021 6.0907 5.31021 6.7207 5.70021 7.1107L10.5902 12.0007L5.70021 16.8907C5.31021 17.2807 5.31021 17.9107 5.70021 18.3007C6.09021 18.6907 6.72022 18.6907 7.11022 18.3007L12.0002 13.4107L16.8902 18.3007C17.2802 18.6907 17.9102 18.6907 18.3002 18.3007C18.6902 17.9107 18.6902 17.2807 18.3002 16.8907L13.4102 12.0007L18.3002 7.1107C18.6802 6.7307 18.6802 6.0907 18.3002 5.7107Z" fill="currentColor"/></g><defs><clipPath id="rw-close-white-clip0_close_white"><rect width="24" height="24" fill="currentColor"/></clipPath></defs></g></svg>
</button>
</div>
<div class="rw-modal__body">
<div class="rw-share" data-rw-share-url="https://www.peachrealty.example/homes/1417-sterlingbrooke-dr-sw-powder-springs-ga-30127-0b6c3b52-7f0c-4a3e-9a51-6f0e2d1a0001" data-rw-share-native="true">
<h3 class="rw-share__heading">Send this home to someone</h3>
<div class="rw-share__link">
<label class="rw-field__label" for="share-modal-2-url">Link to this home</label>
<div class="rw-share__row">
<input class="rw-share__input" id="share-modal-2-url" type="url" readonly="" data-rw-share-input="" value="https://www.peachrealty.example/homes/1417-sterlingbrooke-dr-sw-powder-springs-ga-30127-0b6c3b52-7f0c-4a3e-9a51-6f0e2d1a0001"/>
<button type="button" class="rw-share__copy" aria-describedby="share-modal-2-copy-status" data-rw-copy=""><svg class="rw-icon" viewBox="0 0 16 16" width="18" height="18" data-rw-icon="link" focusable="false" aria-hidden="true"><g fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.30981 13.691C3.28612 14.6673 4.85747 14.6673 8.00016 14.6673C11.1429 14.6673 12.7142 14.6673 13.6905 13.691C14.6668 12.7147 14.6668 11.1433 14.6668 8.00065C14.6668 4.85795 14.6668 3.28661 13.6905 2.3103C12.7142 1.33398 11.1429 1.33398 8.00016 1.33398C4.85747 1.33398 3.28612 1.33398 2.30981 2.3103C1.3335 3.28661 1.3335 4.85795 1.3335 8.00065C1.3335 11.1433 1.3335 12.7147 2.30981 13.691ZM6.3335 5.83398C5.13688 5.83398 4.16683 6.80403 4.16683 8.00065C4.16683 9.19727 5.13688 10.1673 6.3335 10.1673C7.53011 10.1673 8.50016 9.19727 8.50016 8.00065C8.50016 7.72451 8.72402 7.50065 9.00016 7.50065C9.2763 7.50065 9.50016 7.72451 9.50016 8.00065C9.50016 9.74955 8.0824 11.1673 6.3335 11.1673C4.58459 11.1673 3.16683 9.74955 3.16683 8.00065C3.16683 6.25175 4.58459 4.83398 6.3335 4.83398C6.60964 4.83398 6.8335 5.05784 6.8335 5.33398C6.8335 5.61013 6.60964 5.83398 6.3335 5.83398ZM11.8335 8.00065C11.8335 9.19727 10.8634 10.1673 9.66683 10.1673C9.39069 10.1673 9.16683 10.3912 9.16683 10.6673C9.16683 10.9435 9.39069 11.1673 9.66683 11.1673C11.4157 11.1673 12.8335 9.74955 12.8335 8.00065C12.8335 6.25175 11.4157 4.83398 9.66683 4.83398C7.91793 4.83398 6.50016 6.25175 6.50016 8.00065C6.50016 8.27679 6.72402 8.50065 7.00016 8.50065C7.2763 8.50065 7.50016 8.27679 7.50016 8.00065C7.50016 6.80403 8.47021 5.83398 9.66683 5.83398C10.8634 5.83398 11.8335 6.80403 11.8335 8.00065Z" fill="currentColor"/></g></svg><span data-rw-copy-label="">Copy link</span></button>
</div>
<p class="rw-share__status" id="share-modal-2-copy-status" role="status" aria-live="polite" data-rw-copy-status=""></p>
</div>
<p class="rw-share__or">or</p>
<div class="rw-share__socials">
<a class="rw-share__social rw-share__social--facebook" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwww.peachrealty.example%2Fhomes%2F1417-sterlingbrooke-dr-sw-powder-springs-ga-30127-0b6c3b52-7f0c-4a3e-9a51-6f0e2d1a0001" target="_blank" rel="noopener noreferrer" aria-label="Share on Facebook" data-rw-share="facebook">
<svg class="rw-icon" viewBox="0 0 24 24" width="24" height="24" data-rw-icon="facebook" focusable="false" aria-hidden="true"><g fill="none"><path d="M17.2137 13.3278L17.8356 9.23262H13.9452V6.57631C13.9452 5.45568 14.4877 4.36272 16.2301 4.36272H18V0.876308C18 0.876308 16.3945 0.599609 14.8603 0.599609C11.6548 0.599609 9.56164 2.56141 9.56164 6.11145V9.23262H6V13.3278H9.56164V23.2281C10.2767 23.3415 11.0082 23.3996 11.7534 23.3996C12.4986 23.3996 13.2301 23.3415 13.9452 23.2281V13.3278H17.2137Z" fill="currentColor"/></g></svg>
</a>
<a class="rw-share__social rw-share__social--whatsapp" href="https://wa.me/?text=Take%20a%20look%20at%20this%20home%3A%20https%3A%2F%2Fwww.peachrealty.example%2Fhomes%2F1417-sterlingbrooke-dr-sw-powder-springs-ga-30127-0b6c3b52-7f0c-4a3e-9a51-6f0e2d1a0001" target="_blank" rel="noopener noreferrer" aria-label="Share on WhatsApp" data-rw-share="whatsapp">
<svg class="rw-icon" viewBox="0 0 24 24" width="24" height="24" data-rw-icon="whats-app" focusable="false" aria-hidden="true"><g fill="none"><g clip-path="url(#rw-whats-app-clip0_116032_4329)"><path d="M0 24L1.69627 17.8403C0.647564 16.0323 0.0974211 13.9848 0.103152 11.8916C0.103152 5.3327 5.46704 0 12.0516 0C15.2493 0 18.2521 1.23764 20.5043 3.48479C22.7622 5.73194 24.0057 8.72053 24 11.8973C24 18.4563 18.6361 23.789 12.0458 23.789H12.0401C10.0401 23.789 8.07449 23.2871 6.32664 22.3403L0 24ZM6.63037 20.1901L6.9914 20.4068C8.51575 21.308 10.2636 21.7814 12.0458 21.7871H12.0516C17.5243 21.7871 21.9828 17.3555 21.9828 11.903C21.9828 9.26236 20.9513 6.78137 19.0773 4.91065C17.2034 3.03992 14.7049 2.01331 12.0516 2.01331C6.57879 2.0076 2.12034 6.43916 2.12034 11.8916C2.12034 13.7567 2.64183 15.576 3.63897 17.1502L3.87392 17.5266L2.87106 21.1711L6.63037 20.1901Z" fill="white"/><path d="M0.418457 23.5833L2.05742 17.6347C1.0431 15.8951 0.510147 13.916 0.510147 11.897C0.515878 5.56621 5.69066 0.416016 12.0517 0.416016C15.1405 0.416016 18.0345 1.61373 20.2121 3.78104C22.3898 5.94834 23.5875 8.83427 23.5875 11.9027C23.5875 18.2335 18.407 23.3837 12.0517 23.3837H12.046C10.1147 23.3837 8.21788 22.8989 6.53307 21.9864L0.418457 23.5833Z" fill="url(#rw-whats-app-paint0_linear_116032_4329)"/><path d="M0 24L1.69627 17.8403C0.647564 16.0323 0.0974211 13.9848 0.103152 11.8916C0.103152 5.3327 5.46704 0 12.0516 0C15.2493 0 18.2521 1.23764 20.5043 3.48479C22.7622 5.73194 24.0057 8.72053 24 11.8973C24 18.4563 18.6361 23.789 12.0458 23.789H12.0401C10.0401 23.789 8.07449 23.2871 6.32664 22.3403L0 24ZM6.63037 20.1901L6.9914 20.4068C8.51575 21.308 10.2636 21.7814 12.0458 21.7871H12.0516C17.5243 21.7871 21.9828 17.3555 21.9828 11.903C21.9828 9.26236 20.9513 6.78137 19.0773 4.91065C17.2034 3.03992 14.7049 2.01331 12.0516 2.01331C6.57879 2.0076 2.12034 6.43916 2.12034 11.8916C2.12034 13.7567 2.64183 15.576 3.63897 17.1502L3.87392 17.5266L2.87106 21.1711L6.63037 20.1901Z" fill="url(#rw-whats-app-paint1_linear_116032_4329)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M9.066 6.91745C8.84251 6.42125 8.60755 6.40984 8.39552 6.40414C8.2236 6.39844 8.02302 6.39844 7.82245 6.39844C7.62188 6.39844 7.30096 6.47258 7.02589 6.76916C6.75082 7.06574 5.98291 7.78437 5.98291 9.25015C5.98291 10.7102 7.05454 12.1247 7.20354 12.3243C7.35254 12.5239 9.27231 15.6209 12.3038 16.8129C14.8253 17.8053 15.3411 17.6057 15.8855 17.5543C16.4299 17.503 17.6505 16.8357 17.9027 16.1399C18.1491 15.4441 18.1491 14.8509 18.0746 14.7254C18.0001 14.6 17.7995 14.5258 17.5015 14.3775C17.2035 14.2292 15.7365 13.5106 15.4614 13.4079C15.1863 13.311 14.9858 13.2597 14.7909 13.5562C14.5904 13.8528 14.0173 14.5201 13.8454 14.7197C13.6734 14.9194 13.4958 14.9422 13.1978 14.7939C12.8998 14.6456 11.9371 14.3319 10.7967 13.3167C9.90841 12.5296 9.30669 11.5543 9.13477 11.2578C8.96285 10.9612 9.11758 10.8015 9.26658 10.6532C9.39838 10.522 9.56457 10.3053 9.71357 10.1342C9.86256 9.96308 9.91414 9.8376 10.0116 9.63798C10.109 9.43836 10.0631 9.26726 9.98864 9.11897C9.91414 8.97638 9.32961 7.5049 9.066 6.91745Z" fill="white"/></g><defs><linearGradient id="rw-whats-app-paint0_linear_116032_4329" x1="12.0024" y1="23.5822" x2="12.0024" y2="0.415205" gradientUnits="userSpaceOnUse"><stop stop-color="#20B038"/><stop offset="1" stop-color="#60D66A"/></linearGradient><linearGradient id="rw-whats-app-paint1_linear_116032_4329" x1="12.0023" y1="23.9977" x2="12.0023" y2="0" gradientUnits="userSpaceOnUse"><stop stop-color="#F9F9F9"/><stop offset="1" stop-color="white"/></linearGradient><clipPath id="rw-whats-app-clip0_116032_4329"><rect width="24" height="24" fill="white"/></clipPath></defs></g></svg>
</a>
<a class="rw-share__social rw-share__social--email" href="mailto:?subject=A%20home%20at%201417%20Sterlingbrooke%20Dr%20SW%2C%20Powder%20Springs%2C%20GA%2030127&body=Take%20a%20look%20at%20this%20home%3A%20https%3A%2F%2Fwww.peachrealty.example%2Fhomes%2F1417-sterlingbrooke-dr-sw-powder-springs-ga-30127-0b6c3b52-7f0c-4a3e-9a51-6f0e2d1a0001" target="_blank" rel="noopener noreferrer" aria-label="Share by email" data-rw-share="email">
<svg class="rw-icon" viewBox="0 0 24 24" width="24" height="24" data-rw-icon="letter" focusable="false" aria-hidden="true"><g fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.17157 5.17157C2 6.34315 2 8.22876 2 12C2 15.7712 2 17.6569 3.17157 18.8284C4.34315 20 6.22876 20 10 20H14C17.7712 20 19.6569 20 20.8284 18.8284C22 17.6569 22 15.7712 22 12C22 8.22876 22 6.34315 20.8284 5.17157C19.6569 4 17.7712 4 14 4H10C6.22876 4 4.34315 4 3.17157 5.17157ZM18.5762 7.51986C18.8413 7.83807 18.7983 8.31099 18.4801 8.57617L16.2837 10.4066C15.3973 11.1452 14.6789 11.7439 14.0448 12.1517C13.3843 12.5765 12.7411 12.8449 12 12.8449C11.2589 12.8449 10.6157 12.5765 9.95518 12.1517C9.32112 11.7439 8.60271 11.1452 7.71636 10.4066L5.51986 8.57617C5.20165 8.31099 5.15866 7.83807 5.42383 7.51986C5.68901 7.20165 6.16193 7.15866 6.48014 7.42383L8.63903 9.22291C9.57199 10.0004 10.2197 10.5384 10.7666 10.8901C11.2959 11.2306 11.6549 11.3449 12 11.3449C12.3451 11.3449 12.7041 11.2306 13.2334 10.8901C13.7803 10.5384 14.428 10.0004 15.361 9.22291L17.5199 7.42383C17.8381 7.15866 18.311 7.20165 18.5762 7.51986Z" fill="currentColor"/></g></svg>
</a>
</div>
<button type="button" class="rw-share__more" hidden="" data-rw-share-more="">More ways to share</button>
</div>
</div>
</div>
</dialog>
</div>import { ShareModal } from "@ruuster/idx-recipes";
<ShareModal {...props} />How it opens
Three buttons carry data-rw-open="share": the round share button on the first photo of the photo
grid, the dark "Share" button in the gallery's header from 768 pixels, and the share button that
floats over the gallery on a phone.
- When the browser offers
navigator.share, a click opens the device's share sheet with the title "A home at 123 Peachtree St NE, Atlanta, GA 30308", a short sentence and the link. - When the visitor closes the share sheet, nothing else happens.
- When the browser has no share sheet, or the share sheet fails for any other reason, the share screen opens.
Inside the share screen, a "More ways to share" button opens the device's share sheet on browsers
that have one. Pass nativeShare={false} to always open the share screen.
The share screen
- The link sits in a read-only field labelled "Link to this home". A relative URL becomes an absolute one on your own domain at the moment the visitor clicks.
- Copy link copies it. The button reads "Link copied" for two seconds. When the browser blocks the clipboard, the field's text is selected and the button reads "Select the link above and copy it."
- Facebook, WhatsApp and email open in a new tab: Facebook's share page with the link, WhatsApp with "Take a look at this home:" and the link, and a new email with the home as the subject.
The link is always your own listing URL. On the listing page it is the shareUrl you pass to
ListingDetail, else the canonical URL the API answers in head.canonical (your domain and your
detail-page template), else the listing's href. Pass shareUrl={null} to leave sharing out.
Use it on your own layout
Mount ShareModal once inside the element that carries data-rw-detail, and put
data-rw-open="share" on any button of yours in that element. The
gallery page shows a full layout.
| Prop | Type | Required | What it does |
|---|---|---|---|
listing |
ListingDetail or ListingCard |
Yes | The listing being shared, for the title and the text |
url |
string |
Yes | Your listing URL, absolute or relative to your site |
nativeShare |
boolean |
No | Default true: the device's share sheet first. false always opens the share screen |
Rules this screen follows
MUST
- Share your own listing URL, the page the visitor is on.
NEVER
- Share a link to another site's copy of the listing.
- Add tracking parameters that carry the visitor's details to the link.
Without React
The static listing page prints the share screen closed, and ruuster-idx.js opens it from the same
buttons. The share URL is in data-rw-share-url on the dialog. See
Build without React and static/HOOKS.md.