File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ you can pass `className` and `overlayClassName` props to the Modal. If you do
5757this then none of the default styles will apply and you will have full control
5858over styling via CSS.
5959
60+ You can also pass a ` portalClassName ` to change the wrapper's class (* ReactModalPortal* ).
61+ This doesn't affect styling as no styles are applied to this element by default.
6062
6163### Overriding styles globally
6264The default styles above are available on ` Modal.defaultStyles ` . Changes to this
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ var Modal = React.createClass({
3030 content : React . PropTypes . object ,
3131 overlay : React . PropTypes . object
3232 } ) ,
33+ portalClassName : React . PropTypes . string ,
3334 appElement : React . PropTypes . instanceOf ( SafeHTMLElement ) ,
3435 onAfterOpen : React . PropTypes . func ,
3536 onRequestClose : React . PropTypes . func ,
@@ -41,6 +42,7 @@ var Modal = React.createClass({
4142 getDefaultProps : function ( ) {
4243 return {
4344 isOpen : false ,
45+ portalClassName : 'ReactModalPortal' ,
4446 ariaHideApp : true ,
4547 closeTimeoutMS : 0 ,
4648 shouldCloseOnOverlayClick : true
@@ -49,7 +51,7 @@ var Modal = React.createClass({
4951
5052 componentDidMount : function ( ) {
5153 this . node = document . createElement ( 'div' ) ;
52- this . node . className = 'ReactModalPortal' ;
54+ this . node . className = this . props . portalClassName ;
5355 document . body . appendChild ( this . node ) ;
5456 this . renderPortal ( this . props ) ;
5557 } ,
Original file line number Diff line number Diff line change @@ -107,6 +107,12 @@ describe('Modal', function () {
107107 equal ( tabPrevented , true ) ;
108108 } ) ;
109109
110+ it ( 'supports portalClassName' , function ( ) {
111+ var modal = renderModal ( { isOpen : true , portalClassName : 'myPortalClass' } ) ;
112+ equal ( modal . node . className , 'myPortalClass' ) ;
113+ unmountModal ( ) ;
114+ } ) ;
115+
110116 it ( 'supports custom className' , function ( ) {
111117 var modal = renderModal ( { isOpen : true , className : 'myClass' } ) ;
112118 notEqual ( modal . portal . refs . content . className . indexOf ( 'myClass' ) , - 1 ) ;
You can’t perform that action at this time.
0 commit comments