Checkbox Columns: Is it possible to make it so only one row can be checked?

I’m using st.dataframe at the moment to create a table for past searches on my application but it seems there is no st.column_config for radio buttons. I’m currently using a checkbox column instead to select rows instead but I’d like it so the user is only able to check one row at a time. Is anyone aware of a way to implement this?

May be This code example able to you

import streamlit as st
import pandas as pd

# Sample data
data = pd.DataFrame({
    'ID': [1, 2, 3, 4],
    'Name': ['A', 'B', 'C', 'D']
})

# Get user's selection
selected_row = st.radio("Select a row:", data['Name'])

# Display additional information based on the selected row
if selected_row:
    selected_data = data[data['Name'] == selected_row]
    st.write("Selected Row:")
    st.write(selected_data)

If this is not able to clarify your doubt, then please let me know.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.