from awesome_panel_extensions.awesome_panel.notebook import Header
Header(folder="examples/reference/frameworks/fast", notebook="FastCheckbox.ipynb")
The FastCheckbox
widget is based on the fast-checkbox web component and extends the built in Panel Checkbox.
name
(str): The label of the Checkbox.
value
(boolean): Whether or not the Checkbox is checked. Defaults to False.
disabled
(boolean): Whether or not the Checkbox is disabled. Defaults to False.
readonly
(boolean): Whether or not the Checkbox is readonly. Defaults to False.
The FastCheckbox
has the same layout and styling parameters as most other widgets. For example width
and sizing_mode
.
Please note that you can only use the Fast components inside a custom Panel template that
javascript
library.<body>
html tag inside the fast-design-system-provider tag.We provide the FastTemplate
for easy usage.
You can also develop your own custom Panel template if you need something special. For example combining it with more fast.design web components and the Fluent Design System to create VS Code and Microsoft Office like experiences.
Please note that Fast components will not work in older, legacy browser like Internet Explorer.
Let's start by importing the dependencies
import param
import panel as pn
from awesome_panel_extensions.frameworks.fast import FastTemplate, FastCheckbox
pn.config.sizing_mode = "stretch_width"
pn.extension()
Let's explore the parameters of the FastCheckbox
.
checkbox = FastCheckbox(name="Click me", sizing_mode="fixed", width=200, value=True)
app=pn.Row(
checkbox
)
template=FastTemplate(main=[app])
template
checkbox_parameters = ["name", "value", "disabled", "readonly", "width", "height", "sizing_mode"]
settings_pane = pn.WidgetBox(pn.Param(checkbox, parameters=checkbox_parameters, show_name=False))
settings_pane
Let's verify that that FastCheckbox
can be used as a widget by pn.Param
.
WIDGETS = {
"panel_is_awesome": FastCheckbox
}
class ParameterizedApp(param.Parameterized):
panel_is_awesome = param.Boolean(default=True, label="Panel is awesome")
view = param.Parameter()
def __init__(self, **params):
super().__init__(**params)
self.view = pn.Param(self, parameters=["panel_is_awesome"], widgets=WIDGETS, name="Parameterized Checkbox App")
parameterized_app = ParameterizedApp()
paremeterized_template = FastTemplate(main=[parameterized_app.view])
paremeterized_template