Search#
Search #
Search(
*,
data: Union[DataType, DataFrame],
selected_text_column: TemplatedStringItem,
widget_id: Optional[str] = None,
items: Optional[
Union[TemplatedStringItem, List[ResultItemType]]
] = None,
placeholder: Optional[TemplatedStringItem] = 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 |
Union[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 |
Optional[str]
|
widget ID. |
None
|
items |
Optional[Union[TemplatedStringItem, List[ResultItemType]]]
|
List of ResultItemTypes to be displayed in the search results. |
None
|
placeholder |
Optional[TemplatedStringItem]
|
Default text to show before searching. |
None
|
Examples:#
Create a minimal Search Widget
Items#
ResultTextItem #
ResultTextItem(
data_column: TemplatedStringItem,
searchable: bool = True,
styling: Optional[
Union[Palette, ResultTextStyling]
] = 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 |
Optional[Union[Palette, ResultTextStyling]]
|
Specs for Search Result styling. |
None
|
ResultTextStyling #
ResultTextStyling(
*,
color_spec: Optional[ColorSpec] = None,
data_column: Optional[TemplatedStringItem] = 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
|
Construct for Search Widget Result Column Style.
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
|
Examples:#
Changing the color of a text search result item
ResultNumberItem #
ResultNumberItem(
data_column: TemplatedStringItem,
formatting: Optional[NumberFormatting] = None,
styling: Optional[
Union[Palette, ResultNumberStyling]
] = 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 |
Optional[NumberFormatting]
|
formatting spec. |
None
|
styling |
Optional[Union[Palette, ResultNumberStyling]]
|
Specs for Search Result styling. |
None
|
Examples:#
Create a minimal search widget with a result number item
ResultNumberStyling #
ResultNumberStyling(
*,
color_spec: Optional[ColorSpec] = None,
data_column: Optional[TemplatedStringItem] = None
)
Style number search result columns.
Specify styling options for number search result columns, including color specifications and data column mapping.
Construct for Search Widget Result Column Style.
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
|