shiny.ui.page_fixed#

shiny.ui.page_fixed(*args, title=None, lang=None, **kwargs)#

Create a fixed page.

Parameters
  • args (Any) – UI elements.

  • title (Optional[str]) – The browser window title (defaults to the host URL of the page). Can also be set as a side effect via panel_title().

  • lang (Optional[str]) – ISO 639-1 language code for the HTML page, such as "en" or "ko". This will be used as the lang in the <html> tag, as in <html lang="en">. The default, None, results in an empty string.

  • kwargs (str) – Attributes on the page level container.

Return type

A UI element.

Example

#| standalone: true
#| components: [editor, viewer]
#| layout: vertical
#| viewerHeight: 400
from shiny import *
import matplotlib.pyplot as plt
import numpy as np

app_ui = ui.page_fixed(
    ui.layout_sidebar(
        ui.panel_sidebar(ui.input_slider("n", "N", min=0, max=100, value=20)),
        ui.panel_main(ui.output_plot("plot")),
    ),
)

def server(input: Inputs, output: Outputs, session: Session):
    @output
    @render.plot(alt="A histogram")
    def plot() -> object:
        np.random.seed(19680801)
        x = 100 + 15 * np.random.randn(437)

        fig, ax = plt.subplots()
        ax.hist(x, input.n(), density=True)
        return fig


app = App(app_ui, server)