Element class
The definition of a custom visual element.
An element is defined by its properties (name, type and default value) and what the default property name is.
Methods¶
__init__() ¶
__init__(
default_property: str,
properties: t.Dict[str, ElementProperty],
react_component: t.Optional[str] = None,
render_xhtml: t.Optional[
t.Callable[[t.Dict[str, t.Any]], str]
] = None,
inner_properties: t.Optional[
t.Dict[str, ElementProperty]
] = None,
) -> None
Initializes a new custom element declaration.
If render_xhtml is specified, then this is a static element, and react_component is ignored.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
str
|
The name of the default property for this element. |
required |
|
Dict[str, ElementProperty]
|
The dictionary containing the properties of this element, where the keys are the property names and the values are instances of ElementProperty. |
required |
|
Optional[List[ElementProperty]]
|
The optional list of inner properties for this element. |
None
|
|
Optional[str]
|
The name of the component to be created on the front-end. |
None
|
|
Optional[callable[[dict[str, Any]], str]]
|
A function that receives a dictionary containing the element's properties and their values and that must return a valid XHTML string. |
None
|