Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dcc.Dropdown has inconsistent layout flow with other common input components #2653

Open
ned2 opened this issue Oct 5, 2023 · 0 comments · May be fixed by #2933
Open

dcc.Dropdown has inconsistent layout flow with other common input components #2653

ned2 opened this issue Oct 5, 2023 · 0 comments · May be fixed by #2933
Labels
bug something broken P3 backlog

Comments

@ned2
Copy link
Contributor

ned2 commented Oct 5, 2023

Describe your context

dash                         2.13.0
dash-core-components         2.0.0
dash-html-components         2.0.0
dash-table                   5.0.0

Describe the bug

Many of the go-to Dash Core Components have the CSS style display set to inline-block, with a notable exception of dcc.Dropdown. This means that without any custom styles, the dropdown component has inconsistent layout flow compared to other input controls it's likely to be found with. I know I can style the component to fix the issue, but this seems like overkill for simple demos where you just need some controls next to each other, and would be confusing for people getting started with Dash.

Here's an example:

from dash import Dash, dcc, html

app = Dash(__name__)

app.layout = html.Div(
    children=[
        html.Label("Dropdown"),
        dcc.Dropdown(),
        dcc.DatePickerRange("DatePickerRange"),
        html.Label("DatePickerSingle"),
        dcc.DatePickerSingle(),
        html.Label("Input"),
        dcc.Input(),
    ],
)

app.run(port=8050)

Which gives the this layout:
Screenshot from 2023-10-05 16-40-59

This inconsistent flow layout that comes out of the box is too jarring, even for throwaway demo code, so I inevitably end up adding manual styling just for that one component to normalise things a bit:

app2 = Dash(__name__)

app2.layout = html.Div(
    children=[
        html.Label("Dropdown"),
        dcc.Dropdown(
            style={
                "display": "inline-block",
                "width": 300,
                "vertical-align": "middle",
            }
        ),
        dcc.DatePickerRange("DatePickerRange"),
        html.Label("DatePickerSingle"),
        dcc.DatePickerSingle(),
        html.Label("Input"),
        dcc.Input(),
    ],
)

app2.run(port=8051)

Screenshot from 2023-10-06 02-29-21

I'm wondering if there would be any appetite for trying to normalise the layout flow for dcc.Dropdown? I know there's the impact on the many existing Dash apps out there to consider, but I do think it would make for a better experience, also for people getting started with Dash too.

@ned2 ned2 changed the title [BUG] dcc.Dropdown has inconsistent styles with other common input components [BUG] dcc.Dropdown has inconsistent layout flow with other common input components Oct 5, 2023
AfonsoFaleiro added a commit to AfonsoFaleiro/dash that referenced this issue Jul 24, 2024
dcc.Dropdown has inconsistent layout flow
compared to other common input components.
The layout bug is normalised with CSS style
display set to inline-block.
@AfonsoFaleiro AfonsoFaleiro linked a pull request Jul 24, 2024 that will close this issue
2 tasks
@gvwilson gvwilson self-assigned this Jul 25, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 backlog bug something broken labels Aug 13, 2024
@gvwilson gvwilson changed the title [BUG] dcc.Dropdown has inconsistent layout flow with other common input components dcc.Dropdown has inconsistent layout flow with other common input components Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken P3 backlog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants