I’m trying to create a Search bar where you Input a Text which then adds to the href link of the button.
Using the example below
import dash_bootstrap_components as dbc
from dash import Input, Output, html
search_bar = dbc.Row(
[
dbc.Col(dbc.Input(id="input",type="search", placeholder="Search")),
dbc.Col(
dbc.Button(
"Search", color="primary", className="ms-2", n_clicks=0
href=f"https://www.google.com/{**OUTPUT**}"
),
width="auto",
),
@app.callback(Output("output", "children"), [Input("input", "value")])
def output_text(value):
return value
I basically want to use the returned value in the f-String of the href link within the Button.
In the example above id=“output” would contain the input value.
but in my example i can’t use it. If i would use for example href=f"https://www.google.com/{id=“output”}" it won’t work because the f-string thinks i want to say id=https:/…
Is there any other way to achieve this? Or ideally can you define the output as a direct value which i can use in the Link?