card = dbc.Card(
[
dbc.CardImg(src="/static/images/placeholder286x180.png", top=True),
dbc.CardBody(
[
html.H4("Card title", className="card-title"),
html.P(
"Some quick example text to build on the card title and "
"make up the bulk of the card's content.",
className="card-text",
),
dbc.Button("Go somewhere", color="primary"),
]
),
],
style={"width": "18rem"},
)
?
Sure that’s possible. You can also only update specific parts of the card. As long as the part you would like to update, has an id, you can pass a new child, which is your value.
dbc.Card(
[
dbc.CardImg(src="/static/images/placeholder286x180.png", top=True),
dbc.CardBody(
[
html.H4("Card title", className="card-title", id='card_title'),
html.P(
"Some quick example text to build on the card title and "
"make up the bulk of the card's content.",
className="card-text", id='card_text'
),
dbc.Button("Go somewhere", color="primary"),
]
),
],
style={"width": "18rem"},
)
Then the callback can be
@callback(
Output("card_title", "children"),
Output("card_text", "children"),
Input("here_is_your_input_trigger", "n_clicks"),
)
def update_card(trigger):
new_title= "this is your new title"
new_text="tjis is your new text"
return new_title, new_text