panel.react Package#


react Package#

React template

class panel.template.react.ReactTemplate(*, breakpoints, cols, compact, dimensions, prevent_collision, row_height, save_layout, _actions, base_target, base_url, busy_indicator, collapsed_sidebar, favicon, header, header_background, header_color, logo, main, main_max_width, manifest, meta_author, meta_description, meta_keywords, meta_refresh, meta_viewport, modal, notifications, sidebar, sidebar_width, site, site_url, title, config, design, location, theme, name)[source]#

Bases: BasicTemplate

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

Parameters inherited from:

panel.template.base.BaseTemplate: config, design, theme

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

main = param.ClassSelector(allow_None=True, allow_refs=False, class_=<class ‘panel.layout.grid.GridSpec’>, constant=True, label=’Main’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b20c050>)

A list-like container which populates the main area.

compact = param.ObjectSelector(allow_refs=False, label=’Compact’, names={}, nested_refs=False, objects=[None, ‘vertical’, ‘horizontal’, ‘both’], rx=<param.reactive.reactive_ops object at 0x16a039a90>)

cols = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘lg’: 12, ‘md’: 10, ‘sm’: 6, ‘xs’: 4, ‘xxs’: 2}, label=’Cols’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b20c410>)

breakpoints = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘lg’: 1200, ‘md’: 996, ‘sm’: 768, ‘xs’: 480, ‘xxs’: 0}, label=’Breakpoints’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b20d010>)

row_height = param.Integer(allow_refs=False, default=150, inclusive_bounds=(True, True), label=’Row height’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16afa59d0>)

dimensions = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘minW’: 0, ‘maxW’: inf, ‘minH’: 0, ‘maxH’: inf}, label=’Dimensions’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b20d010>)

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

prevent_collision = param.Boolean(allow_refs=False, default=False, label=’Prevent collision’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16ac42910>)

Prevent collisions between items.

save_layout = param.Boolean(allow_refs=False, default=False, label=’Save layout’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b20cad0>)

Save layout to local storage.

close_modal() None[source]#

Closes the modal area

design[source]#

alias of Design

open_modal() None[source]#

Opens the modal area

resolve_resources(cdn: bool | Literal['auto'] = 'auto', extras: dict[str, dict[str, str]] | None = None) ResourcesType[source]#

Resolves the resources required for this template component.

Arguments#

cdn: bool | Literal[‘auto’]

Whether to load resources from CDN or local server. If set to ‘auto’ value will be automatically determine based on global settings.

extras: dict[str, dict[str, str]] | None

Additional resources to add to the bundle. Valid resource types include js, js_modules and css.

Returns#

Dictionary containing JS and CSS resources.

save(filename: str | PathLike | IO, title: str | None = 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: str | None = None) None[source]#

Saves Panel objects to file.

Arguments#

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)[source]#

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

Arguments#

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: list(Viewable)

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

Serves the template and returns self to allow it to display itself in a notebook context.

Arguments#

titlestr

A string title to give the Document (if served as an app)

locationboolean 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.

Returns#

The template object

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

Returns a servable Document with the template attached.

Arguments#

docbokeh.Document (optional)

The Bokeh Document to attach the panel to as a root, defaults to bokeh.io.curdoc()

titlestr

A string title to give the Document

locationboolean or panel.io.location.Location

Whether to create a Location component to observe and set the URL location.

Returns#

docbokeh.Document

The Bokeh document the panel was attached to.

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

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

Arguments#

titlestr | None

A string title to give the Document (if served as an app)

port: int (optional, default=0)

Allows specifying a specific port

addressstr

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

openboolean (optional, default=True)

Whether to open the server in a new browser tab

locationboolean or panel.io.location.Location

Whether to create a Location component to observe and set the URL location.

Returns#

server: bokeh.server.Server or panel.io.server.StoppableThread

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

theme[source]#

alias of DefaultTheme