text¶
Displays a value as a static text.
Note that in order to create a text
control, you don't need to specify the control name
in the text template. See the documentation for Controls for more details.
Properties¶
Name | Type | Default | Description |
---|---|---|---|
(★) |
dynamic(Any) | "" | The value displayed as text by this control. |
format |
str | The format to apply to the value. See below. |
|
on_change |
Callback | The name of a function that is triggered when the value is updated.
|
|
id |
str | The identifier that will be assigned to the rendered HTML component. |
|
properties |
dict[str, any] | Bound to a dictionary that contains additional properties for this element. |
|
class_name |
str | List of CSS class names that will be associated with the generated HTML Element.
This class names will be added to the default |
|
hover_text |
dynamic(str) | Information that is displayed when the user hovers over this element. |
(★)value
is the default property for this visual element.
Details¶
The format property uses a format string like the ones used by the string format() function of Python.
If the value is a date
or a datetime
, then format can be set to a date/time formatting string.
Usage¶
Display value¶
You can represent a variable value as a simple, static text:
Page content
<|{value}|>
<taipy:text>{value}</taipy:text>
Formatted output¶
If your value is a floating point value, you can use the format property to indicate what the output format should be used.
To display a floating point value with two decimal places:
Page content
<|{value}|text|format=%.2f|>
<taipy:text format="%.2f">{value}</taipy:text>