On this page

panel.react Package#


react Package#

Inheritance diagram of panel.template.react

React template

class panel.template.react.ReactDarkTheme(*, fig, holomap, widgets, fps, max_frames, size, dpi, filename, info, css, widget_location)[source]#

Bases: panel.template.theme.DarkTheme

Parameters inherited from:

panel.template.theme.DarkTheme: base_css, bokeh_theme

css = param.Filename(default=PosixPath(‘/home/runner/work/panel/panel/panel/template/react/dark.css’), label=’Css’, search_paths=[])

class panel.template.react.ReactDefaultTheme(*, fig, holomap, widgets, fps, max_frames, size, dpi, filename, info, css, widget_location)[source]#

Bases: panel.template.theme.DefaultTheme

Parameters inherited from:

css = param.Filename(default=PosixPath(‘/home/runner/work/panel/panel/panel/template/react/default.css’), label=’Css’, search_paths=[])

class panel.template.react.ReactTemplate(**params)[source]#

Bases: panel.template.base.BasicTemplate

ReactTemplate is built on top of React Grid Layout web components.

Parameters inherited from:

panel.template.base.BasicTemplate: location, config, busy_indicator, header, main_max_width, sidebar, modal, notifications, logo, favicon, title, site, site_url, meta_description, meta_keywords, meta_author, meta_refresh, meta_viewport, base_url, base_target, header_background, header_color, theme, _actions

main = param.ClassSelector(allow_None=True, class_=<class ‘panel.layout.grid.GridSpec’>, constant=True, label=’Main’)

A list-like container which populates the main area.

sidebar_width = param.Integer(default=350, inclusive_bounds=(True, True), label=’Sidebar width’)

The width of the sidebar in pixels. Default is 350.

compact = param.ObjectSelector(label=’Compact’, objects=[None, ‘vertical’, ‘horizontal’, ‘both’])

cols = param.Dict(class_=<class ‘dict’>, default={‘lg’: 12, ‘md’: 10, ‘sm’: 6, ‘xs’: 4, ‘xxs’: 2}, label=’Cols’)

breakpoints = param.Dict(class_=<class ‘dict’>, default={‘lg’: 1200, ‘md’: 996, ‘sm’: 768, ‘xs’: 480, ‘xxs’: 0}, label=’Breakpoints’)

row_height = param.Integer(default=150, inclusive_bounds=(True, True), label=’Row height’)

dimensions = param.Dict(class_=<class ‘dict’>, default={‘minW’: 0, ‘maxW’: ‘Infinity’, ‘minH’: 0, ‘maxH’: ‘Infinity’}, label=’Dimensions’)

A dictonary of minimum/maximum width/height in grid units.

prevent_collision = param.Boolean(bounds=(0, 1), default=False, label=’Prevent collision’)

Prevent collisions between items.

save_layout = param.Boolean(bounds=(0, 1), default=False, label=’Save layout’)

Save layout to local storage.

close_modal() None#

Closes the modal area

open_modal() None#

Opens the modal area

save(filename: str | os.PathLike | IO, title: Optional[str] = None, resources=None, embed: bool = False, max_states: int = 1000, max_opts: int = 3, embed_json: bool = False, json_prefix: str = '', save_path: str = './', load_path: Optional[str] = None) None#

Saves Panel objects to file.

Parameters
  • filename (string or file-like object) – Filename to save the plot to

  • title (string) – Optional title for the plot

  • resources (bokeh resources) – One of the valid bokeh.resources (e.g. CDN or INLINE)

  • embed (bool) – Whether the state space should be embedded in the saved file.

  • max_states (int) – The maximum number of states to embed

  • max_opts (int) – The maximum number of states for a single widget

  • embed_json (boolean (default=True)) – Whether to export the data to json files

  • json_prefix (str (default='')) – Prefix for the auto-generated json directory

  • save_path (str (default='./')) – The path to save json files to

  • load_path (str (default=None)) – The path or URL the json files will be loaded from.

select(selector=None)#

Iterates over the Template and any potential children in the applying the Selector.

Parameters

selector (type or callable or None) – The selector allows selecting a subset of Viewables by declaring a type or callable function to filter by.

Returns

viewables

Return type

list(Viewable)

servable(title: Optional[str] = None, location: bool | 'Location' = True, area: str = 'main', target: Optional[str] = None) ServableMixin#

Serves the object or adds it to the configured pn.state.template if in a panel serve context, writes to the DOM if in a pyodide context and returns the Panel object to allow it to display itself in a notebook context.

Parameters
  • title (str) – A string title to give the Document (if served as an app)

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

  • area (str (deprecated)) – The area of a template to add the component too. Only has an effect if pn.config.template has been set.

  • target (str) – Target area to write to. If a template has been configured on pn.config.template this refers to the target area in the template while in pyodide this refers to the ID of the DOM node to write to.

Return type

The Panel object itself

server_doc(doc: Optional[Document] = None, title: str = None, location: bool | Location = True) Document#

Returns a servable bokeh Document with the panel attached

Parameters
  • doc (bokeh.Document (optional)) – The Bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

  • title (str) – A string title to give the Document

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

doc – The Bokeh document the panel was attached to

Return type

bokeh.Document

show(title: Optional[str] = None, port: int = 0, address: Optional[str] = None, websocket_origin: Optional[str] = None, threaded: bool = False, verbose: bool = True, open: bool = True, location: bool | 'Location' = True, **kwargs) threading.Thread | 'Server'#

Starts a Bokeh server and displays the Viewable in a new tab.

Parameters
  • title (str | None) – A string title to give the Document (if served as an app)

  • port (int (optional, default=0)) – Allows specifying a specific port

  • address (str) – The address the server should listen on for HTTP requests.

  • websocket_origin (str or list(str) (optional)) – A list of hosts that can connect to the websocket. This is typically required when embedding a server app in an external web site. If None, “localhost” is used.

  • threaded (boolean (optional, default=False)) – Whether to launch the Server on a separate thread, allowing interactive use.

  • verbose (boolean (optional, default=True)) – Whether to print the address and port

  • open (boolean (optional, default=True)) – Whether to open the server in a new browser tab

  • location (boolean or panel.io.location.Location) – Whether to create a Location component to observe and set the URL location.

Returns

server – Returns the Bokeh server instance or the thread the server was launched on (if threaded=True)

Return type

bokeh.server.Server or threading.Thread

theme#

alias of panel.template.theme.DefaultTheme