Modal Styling for ImpSdk.social.showSharePopup

written by Timmy Luong
By default the modal is already styled. This section can be ignored if you are using the modal's default style.

Click here to go back to the main ImpSdk.showSharePopup page.

Warning: Styling the modal must be done by trial and error. There is no built-in support for error-checking the style properties and values. Passing in incorrect style properties and values may result in undesired appearance and behavior of the modal.

There are 2 ways to customize the modal's styles:

  • Recommended: pass in the style as an object parameter to ImpSdk.social.showSharePopup
  • NOT recommended: an external stylesheet -- note: you MUST flag all of your css values with the !important flag. Go to detailed explanation.

ImpSdk.social.showSharePopup(options, styles, targets)

styles is an object with two inner objects: overlay and content

overlay: The area outside the modal's content box. Has properties:

Property Name Default Description
position 'fixed' The position of the overlay. See Mozilla's documentation.
top 0 The distance between the top margin edge of the overlay and the top edge of its containing block. See Mozilla's documentation.
left 0 The distance between the left margin edge of the overlay and the left edge of its containing block. See Mozilla's documentation.
right 0 The distance between the right margin edge of the overlay and the right edge of its containing block. See Mozilla's documentation.
bottom 0 The distance between the bottom margin edge of the overlay and the bottom edge of its containing block. See Mozilla's documentation.
backgroundColor 'rgba(0, 0, 0, 0.3)' The background color of the overlay. By default, the overlay is gray achieved using the color black with a transparency of 0.3 on a scale of 0 (fully transparent) through 1.0 (fully opaque). See Mozilla's documentation on backgroundColor and color values.
zIndex 9999 When elements overlap, zIndex determines which one covers the other. An element with a larger zIndex generally covers an element with a lower one. See Mozilla's documentation.

content: The modal's content box. Has properties:

Property Name Default Description
position 'absolute' The position of the content box. See Mozilla's documentation.
margin 'none' The margin values around the content box. See Mozilla's documentation.
top '34%' The distance between the top margin edge of the content box and the top edge of its containing block. Takes precedence over bottom when height is specified as a property. See Mozilla's documentation.
left '41%' The distance between the left margin edge of the content box and the left edge of its containing block. Takes precedence over right when width is specified as a property. See Mozilla's documentation.
right '0px' The distance between the right margin edge of the content box and the right edge of its containing block. Loses precedence to left when width is specified as a property. See Mozilla's documentation.
bottom '0px' The distance between the bottom margin edge of the content box and the bottom edge of its containing block. Loses precedence to top when height is specified as a property. See Mozilla's documentation.
border '2px solid black' The border around the content box. See Mozilla's documentation.
overflow 'auto' The behavior to follow when content overflows the content box. See Mozilla's documentation.
padding '0px' The inside space between the content and the border of the content box. Negative values not allowed. See Mozilla's documentation.
width '271px' The width of the content box. Set to 292px wide by default to hold a logo and a description of the platform. See Mozilla's documentation.
height '254px' The height of the content box. Set to 240px high by default to hold a title and 3 selections. See Mozilla's documentation.
backgroundColor 'white' The background color of the content box. While transparency is not used by default, transparency can certainly be added as part of the color. See Mozilla's documentation on backgroundColor and color values.

The modal's style can be set using an external stylesheet, however, you will be required to use the !important flag for every single style property which will break the natural CSS cascading of all of your stylesheets. This method is not recommended. See Mozilla's documentation on the concept of Specificity and the !important flag.

  • All React modal overlays have the attribute class="ReactModal__Overlay".
  • ImpSdk.social.showSharePopup does not have an attribute class for the overlay.
  • All React modal content boxes have the attribute class="ReactModal__Content".
  • All ImpSdk.social.showSharePopup content boxes have the attribute class="shareIt__modal"

Note the !important flags everywhere in this example:

/* my-stylesheet.css */

.shareIt__modal {
  background-color: orange !important;
}

.ReactModal__Overlay {
  background-color: rgba(0,0,0,1) !important;
}

.ReactModal__Content {
  width: 500px !important;
  height: 500px !important;
}