{"id":3821,"library":"streamlit-aggrid","title":"Streamlit AgGrid","description":"Streamlit-AgGrid is an active Python library that provides a feature-rich implementation of the Ag-Grid JavaScript library as a Streamlit component. It enables developers to create sophisticated, interactive data tables within their Streamlit applications, offering functionalities such as advanced filtering, sorting, inline cell editing, row grouping, and custom cell rendering. The library, currently at version 1.2.1.post2, maintains an active release cadence with frequent updates and bug fixes, typically every few months.","status":"active","version":"1.2.1.post2","language":"en","source_language":"en","source_url":"https://github.com/PablocFonseca/streamlit-aggrid","tags":["streamlit","ag-grid","data-grid","interactive-table","component"],"install":[{"cmd":"pip install streamlit-aggrid pandas streamlit","lang":"bash","label":"Install core library and common dependencies"}],"dependencies":[{"reason":"Used for DataFrame manipulation, which is the primary data input for AgGrid.","package":"pandas","optional":false},{"reason":"The core framework for which streamlit-aggrid is a component.","package":"streamlit","optional":false},{"reason":"Listed as a dependency in PyPI metadata, often used for configuration management.","package":"python-decouple","optional":true}],"imports":[{"symbol":"AgGrid","correct":"from st_aggrid import AgGrid"},{"symbol":"GridOptionsBuilder","correct":"from st_aggrid import GridOptionsBuilder"},{"symbol":"JsCode","correct":"from st_aggrid import JsCode"},{"note":"The package name is `streamlit-aggrid` but the import path is `st_aggrid`.","wrong":"from streamlit_aggrid import AgGrid","symbol":"AgGrid","correct":"from st_aggrid import AgGrid"}],"quickstart":{"code":"import streamlit as st\nimport pandas as pd\nfrom st_aggrid import AgGrid, GridOptionsBuilder, GridUpdateMode, DataReturnMode\n\nst.set_page_config(layout='wide')\n\n# Create a sample DataFrame\ndata = {\n    'col1': [1, 2, 3, 4, 5],\n    'col2': ['A', 'B', 'C', 'D', 'E'],\n    'col3': [10.1, 20.2, 30.3, 40.4, 50.5],\n    'col4': [True, False, True, False, True]\n}\ndf = pd.DataFrame(data)\n\nst.subheader('Basic Interactive AgGrid Table')\n\n# Configure grid options\ngb = GridOptionsBuilder.from_dataframe(df)\ngb.configure_column('col1', header_name='Column One', editable=True)\ngb.configure_column('col2', header_name='Column Two', editable=True)\ngb.configure_selection(selection_mode='multiple', use_checkbox=True)\n\ngrid_options = gb.build()\n\n# Display the AgGrid component\ngrid_response = AgGrid(\n    df,\n    gridOptions=grid_options,\n    data_return_mode=DataReturnMode.AS_INPUT,\n    update_mode=GridUpdateMode.MODEL_CHANGED,\n    fit_columns_on_grid_load=True,\n    height=350,\n    width='100%',\n    allow_unsafe_jscode=True, # Required for some advanced customizations like JsCode\n    enable_enterprise_modules=False # Set to True if using Ag-Grid Enterprise features and have a license\n)\n\nst.subheader('Selected Rows')\nif grid_response['selected_rows']:\n    st.write(pd.DataFrame(grid_response['selected_rows']))\n\nst.subheader('Edited Data (if any)')\nif grid_response['data'] is not None:\n    st.write(grid_response['data'])\n","lang":"python","description":"This quickstart example demonstrates how to display a Pandas DataFrame using `streamlit-aggrid` with basic interactivity, including editable columns and row selection. It uses `GridOptionsBuilder` for customization and retrieves the `selected_rows` and potentially `edited data` from the grid's response."},"warnings":[{"fix":"Remove the `try_to_convert_back_to_original_types` parameter from your `AgGrid` calls. The library now handles type conversion automatically.","message":"The `try_to_convert_back_to_original_types` parameter has been deprecated since version 1.2.0. The grid now consistently attempts to maintain proper datatypes when editing data.","severity":"deprecated","affected_versions":">=1.2.0"},{"fix":"If you were using direct HTML, you must now use `JsCode` for custom cell rendering to properly display content. Refer to the `streamlit-aggrid` examples for `JsCode` usage.","message":"Direct HTML returns in `cellRenderer` functions stopped working with `Ag-Grid` version 29.1.0 (introduced in `streamlit-aggrid` 0.3.4).","severity":"breaking","affected_versions":">=0.3.4"},{"fix":"Convert Polars DataFrames to Pandas DataFrames (e.g., `polars_df.to_pandas()`) before passing them to `AgGrid`.","message":"`streamlit-aggrid` does not officially support Polars DataFrames, which can lead to 'no attribute kind' errors.","severity":"gotcha","affected_versions":"All versions"},{"fix":"For large datasets, consider using pagination, server-side data processing via `server_sync_strategy` (introduced in 1.2.0), or implement lazy loading. Store DataFrame in `st.session_state` and use `@st.cache_data` for better performance on app reruns.","message":"Performance can degrade significantly with very large datasets (e.g., >1k rows) during extensive edits or sorting, as operations are primarily handled client-side.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that the DataFrame displayed by `AgGrid` is stored in `st.session_state` and explicitly updated after interaction, especially when using `st.form` with a `form_submit_button`.","message":"If `AgGrid` is placed inside an `st.expander` or `st.form`, changes might not persist correctly across reruns without proper handling of Streamlit's session state and form submission.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `streamlit-aggrid` is updated to version 1.1.1 or higher if you are using Streamlit 1.43.0 or later.","message":"An incompatibility issue occurred with Streamlit version 1.43.0, causing `streamlit-aggrid` to be unusable. This was resolved in `streamlit-aggrid` version 1.1.1.","severity":"breaking","affected_versions":"Streamlit 1.43.0 (fixed in streamlit-aggrid >=1.1.1)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}