File tree 3 files changed +11
-1
lines changed
3 files changed +11
-1
lines changed 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
57
57
this then none of the default styles will apply and you will have full control
58
58
over styling via CSS.
59
59
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.
60
62
61
63
### Overriding styles globally
62
64
The 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({
30
30
content : React . PropTypes . object ,
31
31
overlay : React . PropTypes . object
32
32
} ) ,
33
+ portalClassName : React . PropTypes . string ,
33
34
appElement : React . PropTypes . instanceOf ( SafeHTMLElement ) ,
34
35
onAfterOpen : React . PropTypes . func ,
35
36
onRequestClose : React . PropTypes . func ,
@@ -41,6 +42,7 @@ var Modal = React.createClass({
41
42
getDefaultProps : function ( ) {
42
43
return {
43
44
isOpen : false ,
45
+ portalClassName : 'ReactModalPortal' ,
44
46
ariaHideApp : true ,
45
47
closeTimeoutMS : 0 ,
46
48
shouldCloseOnOverlayClick : true
@@ -49,7 +51,7 @@ var Modal = React.createClass({
49
51
50
52
componentDidMount : function ( ) {
51
53
this . node = document . createElement ( 'div' ) ;
52
- this . node . className = 'ReactModalPortal' ;
54
+ this . node . className = this . props . portalClassName ;
53
55
document . body . appendChild ( this . node ) ;
54
56
this . renderPortal ( this . props ) ;
55
57
} ,
Original file line number Diff line number Diff line change @@ -107,6 +107,12 @@ describe('Modal', function () {
107
107
equal ( tabPrevented , true ) ;
108
108
} ) ;
109
109
110
+ it ( 'supports portalClassName' , function ( ) {
111
+ var modal = renderModal ( { isOpen : true , portalClassName : 'myPortalClass' } ) ;
112
+ equal ( modal . node . className , 'myPortalClass' ) ;
113
+ unmountModal ( ) ;
114
+ } ) ;
115
+
110
116
it ( 'supports custom className' , function ( ) {
111
117
var modal = renderModal ( { isOpen : true , className : 'myClass' } ) ;
112
118
notEqual ( modal . portal . refs . content . className . indexOf ( 'myClass' ) , - 1 ) ;
You can’t perform that action at this time.
0 commit comments