PandasRowSelectionInput
Pandas DataFrame row selection input widget for selecting rows from tabular data.
Examples
Basic Usage
This example runs a form with a single page containing the widget
Example Code
import pandas as pd
from abstra.forms import PandasRowSelectionInput, run
data = [
{"Country": "USA", "Population": "32,700,000"},
{"Country": "China", "Population": "1,300,000,000"},
{"Country": "Japan", "Population": "126,000,000"},
]
df = pd.DataFrame(data)
# Create a page with the widget
example_page = [
PandasRowSelectionInput(df=df, key="my-selection", label="Select country")
]
# Run the form
result = run([example_page])
# Print the result
print(result)
Parameters
Name | Description | Type | Default |
---|---|---|---|
df (required) | The pandas DataFrame to display. | pd.DataFrame | None |
key | Identifier for the widget. | str | None |
required | Whether row selection is required before proceeding. | bool | True |
hint | Help text displayed below the input. | str | None |
full_width | Whether the table should take up the full width of its container. | bool | True |
display_index | Whether to display row indices. | bool | False |
disabled | Whether the input is non-interactive. | bool | False |
label | Text label displayed above the table. | str | '' |
filterable | Whether the table is filterable. | bool | False |
multiple | Whether multiple rows can be selected. | bool | False |
initial_value | Initial selected row(s). | Union[List, Any] | None |
min | Minimum number of rows that must be selected when multiple=True. | int | None |
max | Maximum number of rows that can be selected when multiple=True. | int | None |
page_size | Number of rows to display per page. | int | 10 |
errors | Pre-defined validation error messages to display. | Union[List[str], str] | None |
pagination_always_visible | Whether pagination controls are always visible. | bool | True |