Skip to main content

Panel

Panels are overlays that contain supplementary content and are used for complex creation, edit, or management experiences. For example, viewing details about an item in a list or editing settings.

Examples​

Panel control live demo in Bash

Basic panel​

import pglet
from pglet import Button, Panel, Text

with pglet.page("basic-panel") as page:

def button_clicked(e):
p.open = True
page.update()

b = Button(text="Open panel", on_click=button_clicked)
page.add(b)

p = Panel(title="Basic panel", controls=[Text(value="Content goes here")])

page.add(p)

input()

Panel size options​

import pglet
from pglet import Button, Dropdown, Panel, Text, dropdown

with pglet.page("panel-size") as page:

def button_clicked(e):
p.type = dd.value
p.open = True
page.update()

dd = Dropdown(
width=100,
value="small",
options=[
dropdown.Option("small"),
dropdown.Option("smallLeft"),
dropdown.Option("medium"),
dropdown.Option("large"),
dropdown.Option("largeFixed"),
dropdown.Option("extraLarge"),
dropdown.Option("fluid"),
],
)
b = Button(text="Open panel", on_click=button_clicked)
page.add(dd, b)

p = Panel(title="Basic panel", controls=[Text(value="Content goes here")])

page.add(p)

input()

Custom panel​

import pglet
from pglet import Button, Dropdown, Panel, Text, Textbox, dropdown

with pglet.page("panel-custom") as page:

def button_clicked(e):
p.type = dd.value
p.width = tb.value
tb.value = ""
p.open = True
page.update()

dd = Dropdown(
width=100,
value="custom",
options=[
dropdown.Option("custom"),
dropdown.Option("customLeft"),
],
)
b = Button(text="Open panel", on_click=button_clicked)
tb = Textbox(label="Width", placeholder="For example, 888px, 888 or 50%", width=500)
page.add(dd, tb, b)

p = Panel(title="Basic panel", controls=[Text(value="Content goes here")])

page.add(p)

input()

Panel with light dismiss​

import pglet
from pglet import Button, Panel, Text

with pglet.page("panel-custom") as page:

def button_clicked(e):
p.open = True
page.update()

b = Button(text="Open panel", on_click=button_clicked)
page.add(b)

p = Panel(
title="Panel with light dismiss",
light_dismiss=True,
controls=[Text(value="Click anywhere outside the panel to close it")],
)

page.add(p)

input()

Properties​

NameTypeDefaultDescription
openboolfalseWhether the panel is shown.
titlestringThe title text to display at the top of the panel.
typestringType of the panel: small, smallLeft, medium, large, largeFixed, extraLarge, fluid, custom, customLeft.
autoDismissbooltrueWhether panel should be automatically hidden when dismissed.
lightDismissboolfalseWhether the panel can be light dismissed.
widthstringCustom width of custom or customLeft type panel.
blockingbooltrueWhether the panel uses a modal overlay or not. If blocking is false, lightDismiss will not work
datastringAdditional data attached to the control. The value is passed in dismiss event data.

Events​

NameDescription
dismissFires when the panel is dismissed. Panel is dismissed when a user clicks "close" button or clicks outside of non-blocking panel.

Child controls​

  • Any control - will be rendered in the body of the panel.
  • Footer

Serves as a container for panel footer controls.

Child controls​

Any control.