Plotly Dash 中心 dcc.Input 文本字段

Plotly Dash center dcc.Input text field

我很难弄清楚需要哪些样式参数才能将 dash_core_components.Input 文本字段居中放置在我的页面中间。

import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output

text_input_style = {'justify-content': 'center', 'align-items': 'center'}
bucket_select = html.Div([
    html.Label('S3 bucket:'),
    dcc.Input(id='bucket_name', placeholder='Enter input here...', 
              value=None, type='text', 
              style={'width': '10%', 'textAlign': 'center'}),
    html.Div(id='bucket_out')
], style=text_input_style)

app = dash.Dash(__name__)
app.layout = html.Div(bucket_select)
app.run_server(port=5555)

到目前为止我已经尝试过:

我尝试在文档中搜索 dcc.Input,但找不到任何 style 信息。

This is where你可以找到dcc.Input的各种道具。您可以将包含的 div 设置为具有 display='flex'justifyContent='center'。示例:

html.Div(
    children=[dcc.Input()],  # fill out your Input however you need
    style=dict(display='flex', justifyContent='center')
)