Content#
Content #
Content(
*,
data: DataType | dict[str, Any],
widget_id: str | None = None,
title: WidgetTitleType | None = None,
)
Spec for Content widget.
Construct spec for Content widget.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
widget_id
|
str | None
|
unique widget id in a dashboard. |
None
|
title
|
WidgetTitleType | None
|
title of widget can be either a string (fixed value) or determined by a value from another widget using a WidgetField. |
None
|
data
|
DataType | dict[str, Any]
|
data source for the widget. |
required |
add_items #
add_items(*items: ContentItem) -> Content
Add a new ContentItem to the list of items to show on Content Widget.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
items
|
ContentItem
|
Content Items to add to the Content Widget. |
()
|
Returns:
Name | Type | Description |
---|---|---|
Content |
Content
|
reference to this Content Widget to facilitate inline manipulation. |
Examples#
Create a simple content widget with multiple markdown items
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets.content import Content, MarkdownItem
content_widget = Content(
title="Welcome to Our Dashboard",
data={
"intro": "# Dashboard Overview\n\nThis is a **simple** Content widget example.",
"features": "## Key Features\n\n- Easy to use\n- Flexible markdown support\n- Dynamic content capabilities",
"conclusion": "---\n\n*Thank you for using our platform!*"
}
).add_items(
MarkdownItem(data_key="intro"),
MarkdownItem(data_key="features"),
MarkdownItem(data_key="conclusion")
)
Dashboard(
workspace_slug="my-workspace",
app_slug="my-app",
slug="first-dashboard",
content=content_widget
)
Types#
MarkdownItem #
Spec for MarkdownItem class.
Construct spec for MarkdownItem class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_key
|
str
|
Key inside the data with the content for the markdown Item |
required |