ShareModal API

API reference docs for theShareModalwidget. For examples and details on the usage of this widget, visit the widget demo page.

Props

PropsTypeDescriptionDefault
translationsobjectTranslations object for the ShareModal. title key is required. description and optionLabels are optional. If optionLabels are undefined then shareOption should be provided._
translations.titlestringtitle key is required prop_
translations.descriptionobjectdescription key is optional prop_
translations.contentstring

⚠️ Deprecated, use translations.description instead.

_
translations
.description
.primary
stringPrimary text inside the share modal._
translations
.description
.secondary
stringSecondary text inside the share modal._
translations.optionLabelscopyLabel | emailLabel | facebookLabel | messengerLabel | whatsappLabelAll keys in optionLabels are optional, a default option will be rendered only if a corresponding key is provided._
onClosefunctionCallback triggered on closing the share modal and will activate upon pressing "Esc" or clicking on the overlay._
onEscPress?(event: KeyboardEvent) => voidCallback fired when "Esc" key is pressed along with onClose._
onOverlayClick?functionCallback fired when the overlay is clicked along with onClose_
closeOnEsc?booleanIf set to false, the share modal will not close when the Esc key is pressed, and the Esc keydown event along with the onClose callback won't be attached. Similarly, onEscPress will have no effect.true
openbooleanWhen set to true, the dialog will be mounted to DOM._
size?numberThe size of the Modal 'Dialog' box in pixels.640
togglePoint?numberThe screen width at which the modal should switch to a mobile-friendly layout. Deprecated with backwards compatibility ⚠️ (The logic will be handled internally in future)768
mobileFriendly?booleanIndicates if the share modal should be render Sheet in responsive view.true
closeOnOverlayClick?booleanIf set to false, the share modal will not close when the overlay is clicked, and the onClose callback won’t be attached. Similarly, onOverlayClick will have no effect.true
avatarProps?objectTo render image before the heading, contains label and src_
avatarProps.labelstringAria label content for the image added before the heading._
avatarProps.srcstringUrl content for the image added before the heading._

headingImageProps?

object

⚠️ Deprecated, use avatarProps instead.

To render image before the heading, contains label and src

_

headingImageProps.label

string

⚠️ Deprecated, use avatarProps.label instead.

Aria label content for the image added before the heading.

_

headingImageProps.src

string

⚠️ Deprecated, use avatarProps.src instead.

Url content for the image added before the heading.

_

linkstringLink to be shared_
shareOptions?Array of ObjectsTo have custom share options, If no share options are passed, the default share options will be displayed_
closeButtonProps?objectTo render and customise share modal close button contains label and onClick_
closeButtonProps.labelstringAria label content for the close Icon button._
closeButtonProps.onClickfunctionCallback function to be invoked when the close button is clicked._