Search#
Search #
Search(
*,
data: DataType | DataFrame,
selected_text_column: TemplatedStringItem,
widget_id: str | None = None,
items: TemplatedStringItem
| list[ResultItemType]
| None = None,
placeholder: TemplatedStringItem | None = None,
)
Construct search widget.
Construct a search widget for searching through data, allowing customization of selected text column, widget ID, search items, and placeholder text.
Constructor for Search widget.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
DataType | DataFrame
|
data source for the widget. |
required |
selected_text_column
|
TemplatedStringItem
|
Column with information to show when the option is selected. |
required |
widget_id
|
str | None
|
widget ID. |
None
|
items
|
TemplatedStringItem | list[ResultItemType] | None
|
List of ResultItemTypes to be displayed in the search results. |
None
|
placeholder
|
TemplatedStringItem | None
|
Default text to show before searching. |
None
|
Example:#
Create a minimal Search Widget
import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.widgets import search
data = pd.DataFrame(
data=[
{"ticker": "AAPL-NAS", "name": "Apple", "score": 10},
{"ticker": "MSFT-NAS", "name": "Microsoft", "score": 5},
]
)
search_widget = search.Search(
data=data,
selected_text_column="name",
)
Dashboard(
workspace_slug="my-workspace",
app_slug="my-app",
slug="first-dashboard",
content=search_widget,
)

Items#
ResultTextItem #
ResultTextItem(
data_column: TemplatedStringItem,
searchable: bool = True,
styling: Palette | ResultTextStyling | None = None,
)
Define text item for search results.
Define a text item for search results, specifying the data column to display, whether it's searchable, and styling options.
Constructor for ResultTextItem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_column
|
TemplatedStringItem
|
Column name in pandas DataFrame used for search result. |
required |
searchable
|
bool
|
Flag that makes the result searchable. |
True
|
styling
|
Palette | ResultTextStyling | None
|
Specs for Search Result styling. |
None
|
ResultTextStyling #
ResultTextStyling(
*,
color_spec: ColorSpec | None = None,
data_column: TemplatedStringItem | None = None,
)
Style text search result columns.
Specify styling options for text search result columns, including color specifications and data column mapping.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
color_spec
|
Optional[ColorSpec]
|
Spec for coloring columns. |
None
|
data_column
|
Optional[TemplatedStringItem]
|
Name of column in pandas dataframe(s) used for color spec if a gradient is used. Optional for single colors. |
None
|
Example:#
Create a search widget with a styled result text item
import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.styling import color
from engineai.sdk.dashboard.widgets import search
data = pd.DataFrame(
data=[
{"ticker": "AAPL-NAS", "name": "Apple", "score": 10},
{"ticker": "MSFT-NAS", "name": "Microsoft", "score": 5},
]
)
search_widget = search.Search(
data=data,
selected_text_column="name",
items=[
search.ResultTextItem(
data_column="ticker",
styling=search.ResultTextStyling(
color_spec=color.Palette.BUBBLEGUM_PINK,
),
),
],
)
Dashboard(
workspace_slug="my-workspace",
app_slug="my-app",
slug="first-dashboard",
content=search_widget,
)

ResultNumberItem #
ResultNumberItem(
data_column: TemplatedStringItem,
formatting: NumberFormatting | None = None,
styling: Palette | ResultNumberStyling | None = None,
)
Define number item for search results.
Define a number item for search results, specifying the data column to display, formatting options, and styling options.
Constructor for ResultNumberItem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_column
|
TemplatedStringItem
|
Column name in pandas DataFrame used for search result. |
required |
formatting
|
NumberFormatting | None
|
formatting spec. |
None
|
styling
|
Palette | ResultNumberStyling | None
|
Specs for Search Result styling. |
None
|
ResultNumberStyling #
ResultNumberStyling(
*,
color_spec: ColorSpec | None = None,
data_column: TemplatedStringItem | None = None,
)
Style number search result columns.
Specify styling options for number search result columns, including color specifications and data column mapping.
Examples:#
Create a search widget with a styled result number item
import pandas as pd
from engineai.sdk.dashboard.dashboard import Dashboard
from engineai.sdk.dashboard.styling import color
from engineai.sdk.dashboard.widgets import search
data = pd.DataFrame(
data=[
{"ticker": "AAPL-NAS", "name": "Apple", "score": 10},
{"ticker": "MSFT-NAS", "name": "Microsoft", "score": 5},
]
)
search_widget = search.Search(
data=data,
selected_text_column="name",
items=[
search.ResultTextItem(
data_column="ticker",
styling=search.ResultTextStyling(
color_spec=color.Palette.BUBBLEGUM_PINK,
),
),
search.ResultNumberItem(
data_column="score",
styling=search.ResultNumberStyling(
color_spec=color.Palette.BABY_BLUE,
),
),
],
)
Dashboard(
workspace_slug="my-workspace",
app_slug="my-app",
slug="first-dashboard",
content=search_widget,
)
