1.6.1 • Published 2 years ago

styled-window-portal v1.6.1

Weekly downloads
470
License
MIT
Repository
github
Last release
2 years ago

styled-window-portal

If a React portal is used to render to a new window, then styled-components will break as the styles declared are still being appended to the head of the original document. This package provides a component which changes the inject point of the style to the head of the new window and copies globally injected styles to the new window.

Example

Props

The styled window component can take the following props

Prop NameTypeDefault ValueDescription
onClosefunctionN/AA function called when the window is closed
onOpenfunctionN/AA function called when the window is opened
titlestringNew WindowThe title of the window
targetstring' 'The target attribute or the name of the window
windowPropsobjectSee below

windowProps

All values here can either be constant, or functions, the functions have the other options passed to them as the first parameter, and the main window as the second parameter. See descriptions at https://www.w3schools.com/jsref/met_win_open.asp

Prop NameTypeDefault Value
toolbarboolean | functionfalse
locationboolean | functionfalse
directoriesboolean | functionfalse
menubarboolean | functionfalse
scrollbarsboolean | functiontrue
resizableboolean | functiontrue
widthnumber | function500
heightnumber | function400
topnumber | functionfunction (center)
leftnumber | functionfunction (center)
1.6.1

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.3.4

3 years ago

1.4.0

3 years ago

1.3.2

3 years ago

1.3.1

3 years ago

1.3.0

4 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago