from awesome_panel_extensions.awesome_panel.notebook import Header
Header(folder="examples/reference/frameworks/fast", notebook="FastTextAreaInput.ipynb")
The FastTextArea
widget is based on the fast-text-area web component and extends the built in Panel TextAreaInput.
value
(str): A string value.name
(str): The label of the TextArea.disabled
(boolean): Whether or not the TextArea is disabled. Default is False.placeholder
(string): A text to show the value is the empty string.max_length
(integer): The maximum number of characters. Default is 5000.apperance
(string): Determines the appearance of the TextArea. One of outline
or filled
. Defaults to outline
.readonly
(boolean): Whether or not the TextArea is read only. Defaults to False
.The FastTextArea
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, FastTextAreaInput
pn.extension()
pn.config.sizing_mode = "stretch_width"
Let's explore the parameters of the FastTextArea
.
text_area_input = FastTextAreaInput(name="The label", appearance="outline", placeholder="write something")
text_area_parameters = ["name", "value", "disabled", "placeholder", "appearance", "readonly", "max_length", "height", "width", "sizing_mode"]
app=pn.Row(
text_area_input
)
template=FastTemplate(main=[app])
template
settings_pane = pn.WidgetBox(pn.Param(text_area_input, parameters=text_area_parameters, show_name=False))
settings_pane
Let's verify that that FastTextArea
can be used as a widget by pn.Param
.
WIDGETS = {
"some_text": {
"type": FastTextAreaInput, "placeholder": "write something", "sizing_mode": "fixed", "width": 400
}
}
class ParameterizedApp(param.Parameterized):
some_text = param.String(default="This is some text", label="This is a label")
view = param.Parameter()
def __init__(self, **params):
super().__init__(**params)
self.view = pn.Param(self, parameters=["some_text"], widgets=WIDGETS)
parameterized_app = ParameterizedApp()
paremeterized_template = FastTemplate(main=[parameterized_app.view])
paremeterized_template
fast-text-area
attributes height
and also autofocus
, rows
, min_length
and spellcheck
do not seem to work. If you would like them to work please upvote Fast Github Issue 3874.They would have been
autofocus
(boolean): The autofocus attribute. Defaults to False
.rows
(integer): The number of rows. Default is 2.min_length
(integer): The minimum required length of the text string. Default is 0.spellcheck
(boolean): Whether or not the spell check is enabled. Default is False
.