Is there a way to clear a dropdown from a callback?

I have quite a few dropdowns, some with set values from the beginning while others just have placeholder values (i.e. ‘Select X’). I have another button that resets all of the dropdowns but the value within the dropdown remains the same. For example, if I have a dropdown that is selecting fruits and the user selects apples to filter the data, and then they reset the filters (which clears all filters and would change the selected_fruit = None) the ‘apple’ would still remain in the dropdown box instead of the original placeholder.

TL;DR I want to have my callback clear my dropdown or reset it to the placeholder.

I think return value=[] in call back would work. Something as below:

from dash import Dash, dcc, html, Input, Output
from import data
import pandas as pd

df =  data.medals_long()

app = Dash(__name__, external_stylesheets=[dbc.themes.LUX])
app.layout = dbc.Container([
                         clearable=True,placeholder='Please select'),

    Output('pandas-dropdown-2', 'value'),
    Input('btn', 'n_clicks')
def update_value(n_clicks):
    if n_clicks > 1:
        return []

if __name__ == '__main__':
1 Like

Maybe an MRE would help in this case.