Giter Site home page Giter Site logo

Comments (4)

chriddyp avatar chriddyp commented on July 18, 2024

@jps1dell - thanks for reporting! can you post a full reproducable example? You might also want to check out the Tabs PR

from dash-core-components.

jps1dell avatar jps1dell commented on July 18, 2024

Sure -- the code below should, I believe, hide Button 2 when Button 1 is pressed, and vice-versa:

import dash
import dash_html_components as html
from dash.dependencies import Input, Output, State

app = dash.Dash()

app.layout = html.Div(
style={
'width': '80%',
'fontFamily': 'Sans-Serif',
'margin-left': 'auto',
'margin-right': 'auto'
}, id="div0",
children=[
html.Button("Hide Button 2", id="button01", disabled=False),
html.Button("Hide Button 1", id="button02", disabled=False),
]
)

@app.callback(
Output(component_id='button02', component_property='style'),
[
Input(component_id="button01", component_property="n_clicks")
]
)
def on_button01_click(n_clicks):
if (n_clicks) != None:
return {"visible" : "hidden"}

@app.callback(
Output(component_id='button01', component_property='style'),
[
Input(component_id="button02", component_property="n_clicks")
]
)
def on_button02_click(n_clicks):
if (n_clicks) != None:
return {"visible" : "hidden"}

app.run_server(debug=True)

from dash-core-components.

chriddyp avatar chriddyp commented on July 18, 2024

@jps1dell {"visible" : "hidden"} isn't a valid CSS property or attribute. All of the attributes inside the style argument must refer to CSS properties (camelCased). In this case, you are probably looking for {'display': 'none'}

from dash-core-components.

jps1dell avatar jps1dell commented on July 18, 2024

Ack! Duh -- thanks very much for clarifying.

from dash-core-components.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.