Share

Import

import Share from '@politico/interactive-style/src/components/Share';
// or
import { Share } from '@politico/interactive-style';

Props

NameTypeDefaultDescription
subjectstringThe subject line to use in emails
bodystringThe body to use in emails and Tweets
onFbfunctionClick handler for clicking the Facebook share button
onTwitterfunctionClick handler for clicking the Twitter share button
onMailfunctionClick handler for clicking the mail button

CSS

NameGlobal ClassDescription
rootPibShare-rootStyles applied to root div
buttonPibShare-buttonStyles applied to each button

Demos

Email/Tweet Text

You can set the default text for an email or tweet when a user clicks the button. "Body" will be used for email bodies and Tweet texts. "Subject" will be used for email subject lines. Try changing the text in the code and clicking the button to see it take effect.

Custom Click Handlers

You can pass custom click handlers for each event. Note that handlers fire before the usual before takes place (i.e. the alert will fire before the Twitter share link opens). Try clicking a button to see the handler fire.