Hi, I’m trying to make a configuration panel usign dash_bootstrap input’s but I can’t align this correctly. I’m using style={} dic but can’t find the correctly setup.
I want the labels and the input to the left but don’t response to the dbc.Row(…,justify=“start”)
Actual layout
Desired layout
Code
from dash import Dash, html
import dash_bootstrap_components as dbc
import dash_ag_grid as dag
import pandas as pd
import dash_bootstrap_components as dbc
from dash import html
app = Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP, dbc.icons.FONT_AWESOME])
input_groups = html.Div([
#measurement config
dbc.Row([
dbc.Label(
"Samples per file",
width="auto",
className="m-3"
),
dbc.Col(
dbc.Input(
type="float",
placeholder="# samples",
id="samps2",
className="me-3",
style={"width": 100}
)
),
dbc.Label(
"Sample Frecuency [kHz]",
width="auto",
className="m-3"
),
dbc.Col(
dbc.Input(
type="float",
placeholder="samp-frecuency",
id="samps",
className="me-3",
style={"width": 200}),
),
],align='center',justify="end"),
dbc.Row([
dbc.Label(
"Range [V]",
width="auto",
className="m-3"
),
dbc.Col(
dbc.Input(
type="float",
placeholder="10",
value="10",
id="range-in",
className="m-3",
style={"width": 200}
),
),
dbc.Label(
"Device Connection",
width="auto",
),
dbc.Col(
dbc.Input(
type="text",
placeholder="Dev1/",
value="Dev1/",
id="dev_name",
valid=True,
style={"width": 200}
),
),
dbc.Col(
dbc.Button(
children=html.I(className="fa fa-refresh"),
color="primary",
outline=True),
#width="auto",
id="dev-check"),
],align='center',justify="start")
])
app.layout =input_groups
app.run_server(debug=True)
This run in W10 with:
- python 3.11.5 64-bit,
- dash 2.14.2,
- dash_bootstrap_components 1.5.0,
- pandas 2.1.1
Expected answer
A modification of my code that adjusts the inputs and labels like the Desired layout.
Thanks for your time.