简体   繁体   中英

How can i arrange button location on Dash Plotly?

I am making a dashboard using Dash by Plotly. It is really fast and useful for me. But I could not find how can i arrange the location of for example a button. For example i want button to be x=5, y=150. But I could not find a solution on documentation. Additionally I examined the dash core components in github and I can not find somewhere like x coordinates or location etc. Do I need to add react.js codes somehow? Thanks in advance.

I'm assuming that you don't mean to create your entire layout this way and just want to place a particular button at your desired x and y.

You can use the Affix component that comes with dash-mantine-components .

import dash_mantine_components as dmc
from dash import Dash, html

app = Dash(__name__)

app.layout = html.Div(
    [
        dmc.Affix(
            dmc.Button("I'm in an affix component!"), position={"top": 5, "left": 150}
        )
    ]
)


if __name__ == "__main__":
    app.run_server(debug=True)

Output

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM