nyan314sn
nyan314sn

Reputation: 1936

label and dash component side by side

I am using Dash. One of the thing I want to do is have a label and slider side by side. The following code render this. What can I do the the code so that the slider label and the slider shows up side by side. Thanks.

enter image description here

                                    html.Div(
                                    [
                                        html.Label("First Slider"),
                                        dcc.RangeSlider(
                                            id="my-range-slider",
                                            # label="Slider 1",
                                            min=0,
                                            step=0.01,
                                            max=1,
                                            value=[0.2, 0.8],
                                            marks={0: "0", 1: "1"},
                                            allowCross=False,
                                        ),
                                    ],
                                    className="rows",
                                ),
                                html.Div(
                                    [
                                        html.Label("Second Slider"),
                                        dcc.RangeSlider(
                                            id="my-range-slider1",
                                            # label="Slider 1",
                                            min=0,
                                            step=0.01,
                                            max=1,
                                            value=[0.2, 0.8],
                                            marks={0: "0", 1: "1"},
                                            allowCross=False,
                                        ),
                                    ],
                                    className="rows",
                                ),

Upvotes: 2

Views: 4598

Answers (1)

coralvanda
coralvanda

Reputation: 6596

Flexbox will get that done easily. Make each of the containing divs have style=dict(display='flex'), and just make sure there's enough horizontal room.

Upvotes: 1

Related Questions