Home > database >  dash plotly dropdown puts selected value on the right side
dash plotly dropdown puts selected value on the right side

Time:01-09

this just a small thing but i hate how the selected label is aligned to the right while the options in the dropdown are on the left side.

i would like to center it, or even better, put it on the left side.

dropdown options

dropdown arrow

CodePudding user response:

You can style the selected value of the dropdown from within the Dropdown function.

Then you just have to align the text however you want it.

Within the style={} property you can just pass normal css rules to any Dash component.

dcc.Dropdown(
        options=[
            {'label': 'Montreal', 'value': 'MTL'},
        ],
    value='MTL',
    style={
        "textAlign": "left",
    }
)
  •  Tags:  
  • Related