def get_layout(): username = '' password = '' message = current_user.get_message() layout = dbc.Container(dbc.Row(dbc.Col( [ html.H1('Log In', className='text-center'), html.P(message['form'], className='error-message text-center') if message['form'] is not None else None, html.Form([ dbc.FormGroup([ dbc.Label('Username', html_for='username'), dbc.Input(type='text', id='username', name='username', placeholder='Enter username', value=username, invalid=True if message['form'] or message['username'] else False), dbc.FormFeedback( message['username'], valid=False, ), ]), dbc.FormGroup([ dbc.Label('Password', html_for='password'), dbc.Input(type='password', id='password', name='password', placeholder='Enter password', value=password, invalid=True if message['form'] or message['password'] else False), dbc.FormFeedback( message['password'], valid=False, ), ]), html.Button( 'Login', type='submit', id='login_button', className='col-12 col-lg-4 float-lg-right btn btn-primary') ], action='/login', method='post') ], className='col-12 col-md-6 col-lg-4 m-auto'), align='center', className='height-100vh'), fluid=True) return layout
def save_dataset_input(): m = dbc.FormGroup(children=[ dbc.Input(id="save_dataset_name", placeholder="Enter a save name for this dataset", type="text", valid=None), dbc.FormFeedback("Data saved", id="save_dataset_success_feedback", valid=True), dbc.FormFeedback("Error: data not saved", id="save_dataset_failure_feedback", valid=False), ], id="save_dataset_name_formgroup") return m
def add_feedback(): if feedback: return [dbc.FormFeedback(feedback)] else: return []
# nav=True, # in_navbar=True, # label="Menu", # ) text_input = html.Div( [ dbc.FormGroup( [ dbc.Label("Input Ticker"), dbc.Input(id="ticker_input", value="AAPL"), dbc.FormText("Please enter a ticker like MSFT or AAPL."), html.P(id = "ticker_output"), dbc.Button("Get Stock Info", id = "get_info", color="primary", className="mr-1"), dbc.FormFeedback( "That ticker is valid!", valid=True ), dbc.FormFeedback( "That ticker is invalid!", valid=False, ), ] ) ] ) sidebar_header = dbc.Row( [ dbc.Col(html.H4("Ticker Info", className="display-4")), dbc.Col( html.Button(
import dash_bootstrap_components as dbc import dash_html_components as html from dash.dependencies import Input, Output email_input = html.Div([ dbc.FormGroup([ dbc.Label("Email"), dbc.Input(id="email-input", type="email", value=""), dbc.FormText("We only accept gmail..."), dbc.FormFeedback("That looks like a gmail address :-)", valid=True), dbc.FormFeedback( "Sorry, we only accept gmail for some reason...", valid=False, ), ]) ]) # --- Callbacks --- # @app.callback(Output("email-input", "valid"), [Input("email-input", "value")]) def check_valid(text): if text and text.endswith("@gmail.com"): return True return False @app.callback(Output("email-input", "invalid"), [Input("email-input", "value")]) def check_invalid(text): if text and not text.endswith("@gmail.com"): return True
), ]) ref_freq = dbc.FormGroup([ dbc.Label("Reference frequency (Hz)"), dbc.Input( id="ref_freq", type="number", value=1000, min=0.001, max=102000, step=0.001, persistence=True, persistence_type="session", ), dbc.FormFeedback("", valid=True), dbc.FormFeedback("Reference frequency must be between 0.001 - 102000 Hz", valid=False), dbc.Tooltip( "Internal reference output frequency", target="ref_freq", placement="bottom", ), ]) harmonic = dbc.FormGroup([ dbc.Label("Detection harmonic"), dbc.Input( id="harmonic", type="number", value=1,
import dash_bootstrap_components as dbc from dash import Input, Output, html email_input = html.Div( [ dbc.Label("Email"), dbc.Input(id="email-input", type="email", value=""), dbc.FormText("We only accept gmail..."), dbc.FormFeedback("That looks like a gmail address :-)", type="valid"), dbc.FormFeedback( "Sorry, we only accept gmail for some reason...", type="invalid", ), ] ) # --- Callbacks --- # @app.callback( [Output("email-input", "valid"), Output("email-input", "invalid")], [Input("email-input", "value")], ) def check_validity(text): if text: is_gmail = text.endswith("@gmail.com") return is_gmail, not is_gmail return False, False
[ du.Upload(id='upload', filetypes=['csv'], text='点击或拖动文件到此进行上传!', text_completed='已完成上传文件:', cancel_button=True, pause_button=True), html.Hr(), dbc.Form([ dbc.FormGroup([ dbc.Label("设置入库表名", html_for="table-name"), dbc.Input(id='table-name', autoComplete='off'), dbc.FormText( "表名只允许包含大小写字母、下划线或数字,且不能以数字开头,同时请注意表名是否与库中现有表重复!", color="secondary"), dbc.FormFeedback("表名合法!", valid=True), dbc.FormFeedback( "表名不合法!", valid=False, ), ]), dbc.FormGroup([dbc.Button('提交入库', id='commit', outline=True)]) ], style={'background-color': 'rgba(224, 242, 241, 0.4)'}), dbc.Spinner([ html.P(id='commit-status-message', style={'color': 'red'}), dbc.Label('预览至多前10000行', html_for='uploaded-table'), dash_table.DataTable( id='uploaded-table', style_table={'height': '400px'}, virtualization=True,
def get_account_elements(self): return [ dcc.Location(id="settings-url", refresh=True), html.H5( f"Permissions: {current_user.permissions.name.replace('_', ' + ')}" ), html.Hr(), html.Br(), html.H5("Change username"), html.Hr(), dbc.Button( "Change username", n_clicks=0, id="settings-change-username", color="secondary", ), dcc.ConfirmDialog( id="settings-confirm-change-username", message="Are you sure you want to change your username? " "This could have unintended consequences.", ), dbc.Modal( [ dbc.ModalHeader("Change username"), dbc.ModalBody( dbc.Form( [ dbc.FormGroup( [ dbc.Label("Enter new username"), dbc.Input( value=current_user.username, type="text", id="settings-new-username", ), dbc.FormFeedback( id="settings-new-username-invalid-feedback", valid=False, ), ], row=False, ) ] ) ), dbc.ModalFooter( dbc.Button( "Save", id="settings-save-new-username", className="ml-auto", disabled=True, ) ), ], id="settings-change-username-modal", ), html.Br(), html.Br(), html.Br(), html.H5("Delete account"), html.Hr(), html.P("Permanently delete your account."), dbc.Button( "Delete account", n_clicks=0, id="settings-delete-account", color="danger", ), dcc.ConfirmDialog( id="settings-confirm-delete-account", message="Are you sure you want to delete your account? " "This cannot be undone.", ), ]
import dash_html_components as html import dash_bootstrap_components as dbc from app import app, location_search from dash.dependencies import Input, Output import requests import json import re phonenumber = dbc.FormGroup([ dbc.Label("Phone Number", html_for="signup-phonenumber"), dbc.Input(type="tel", id="phonenumber-input", placeholder="Enter valid US Phone Number", pattern="^(?:\(\d{3}\)|\d{3})[- ]?\d{3}[- ]?\d{4}$", maxLength=14), dbc.FormFeedback("That looks like a valid U.S. phone number :-)", valid=True), dbc.FormFeedback( "Sorry, we only accept valid U.S. phone number", valid=False, ), ]) zipcode = dbc.FormGroup([ dbc.Label("Zipcode", html_for="signup-zipcode"), dbc.Input(type="text", id="zipcode-input", placeholder="Enter valid 5 digit zipcode", pattern="[0-9]{5}$", maxLength=5), dbc.FormFeedback("That looks like a valid U.S. 5 digit ZIP code :-)", valid=True),
dbc.Col( dbc.Card( dbc.CardBody([ html.H5("Input Information", className="card-title"), html.Br(), dbc.Row( [ dbc.Col( dbc.FormGroup([ dbc.Label("Age:", html_for="age"), dbc.Input( type="integer", id="age", placeholder="Enter Age", ), dbc.FormFeedback(valid=True), dbc.FormFeedback( "Age must be a number", valid=False, ), ]), md={ "size": 2, "order": 1 }, ), dbc.Col( dbc.FormGroup([ dbc.Label("Gender:", html_for="gender"), dcc.Dropdown( id="gender",
def attempt(app: dash.Dash, data: GameData) -> html: """Layout for the attempt page. At tis page, the user is able to make his prediction. Arguments: app {dash.Dash} -- dash app instance data {GameData} -- game data Returns: html -- html layout """ idx = data.current_round img_raw = str(data.items[idx].picture_raw) print('Ground Truth:', data.items[idx].ground_truth) layout = dbc.Container([ html.Div(dbc.Row(dbc.Col( dbc.Alert("Please guess the brand and the model!", color="danger")), className='mb-4'), id='error-alert', hidden=True), dbc.Row(children=[ dbc.Col(dbc.Card(dbc.CardImg(src=img_raw))), dbc.Col( dbc.Card([ dbc.FormGroup([ dbc.Label("Car Brand", html_for="car-brand"), dcc.Dropdown( id="car-brand", options=[{ "label": col, "value": col } for col in list(LABELS.keys())], ), dbc.FormFeedback( "Please guess the car brand and car model.", valid=False) ]), dbc.FormGroup([ dbc.Label("Car Model", html_for="car-model"), dcc.Dropdown(id="car-model", disabled=True), dbc.FormFeedback( "Please guess the car brand and car model.", valid=False) ]), dbc.ButtonGroup( dbc.Button("Make a Guess", id='btn', color='primary', style={ "background-color": COLOR_STATWORX, "border-color": COLOR_STATWORX })) ], body=True)) ], className='mb-4') ]) return layout
import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc from app import app save_folder_input = dbc.FormGroup([ dbc.Label("Save folder"), dbc.Input( id="save-input", type="path", value="", persistence=True, persistence_type="session", ), dbc.FormFeedback("", valid=True), dbc.FormFeedback( "Folder doesn't exist. Please choose an existing folder", valid=False, ), dbc.Tooltip( "Parent folder containing data files", target="save-input", placement="bottom", ), ]) device_id_input = dbc.FormGroup([ dbc.Label("Device ID"), dbc.Input( id="device-id",
dbc.Col([ dbc.Input( placeholder='Officer First Name', id='officer_fn', value=None, type='text', className='input-element', ), dbc.Input( placeholder='Officer Last Name', id='officer_ln', value=None, type='text', className='input-element', ), dbc.FormFeedback("Officer not found in database. ", valid=False), dbc.FormFeedback("Officer found.", valid=True) ], width={'size': 12}), ], ), dbc.Col(html.Button( 'Search', id='officer-search', n_clicks=0, className='input-element btn btn-primary'), width=2) ], inline=True), width=6), dbc.Col(dbc.FormGroup([ dbc.RadioItems(
import dash_bootstrap_components as dbc import dash_html_components as html from .util import make_subheading input_ = html.Div([ make_subheading("Input", "input"), dbc.FormGroup([ dbc.Label("Valid text input"), dbc.Input(type="text", valid=True), dbc.FormFeedback("That's a valid input!", valid=True), ]), dbc.FormGroup([ dbc.Label("Invalid text input"), dbc.Input(type="text", invalid=True), dbc.FormFeedback("That's an invalid input..."), ]), ]) checklist_items = html.Div( [ make_subheading("Checklist", "input"), dbc.Row([ dbc.Col( dbc.Checklist( id="gallery_checklist1", options=[{ "label": "Option {}".format(i), "value": i, } for i in range(3)], value=[1, 2],
"type": "config_input", "name": "db_path" }), dbc.Input( placeholder= "Specify the name and path to sqlite database e.g /data/ukb_sql.sqlite", type="text", id={ "type": "config_input", "name": "db_path" }, persistence=True, style={"margin": "5px"}), dbc.FormText("Specify the name and path to SQLite database file", color="secondary"), dbc.FormFeedback("File exists", valid=True), dbc.FormFeedback( "File does not exist, please check path", valid=False, ) ]) # gp_path_input = dbc.FormGroup([ # dbc.Label("GP Dataset File", html_for={"type": "config_input", "name":"gp_path"}), # dbc.Input(placeholder="Specify the name and path to GP data file e.g /data/gp_clinical.txt", type="text", id={"type": "config_input", "name":"gp_path"}, persistence=True), # #dbc.Input(type="file", id={"type": "file", "name": "gp_path"},), # dbc.FormText("Specify the name and path to GP data file", color="secondary"), # dbc.FormFeedback( # "File exists", valid=True # ), # dbc.FormFeedback(
import dash_bootstrap_components as dbc import dash_html_components as html form = dbc.Form([ dbc.FormGroup( [ dbc.Label("Email", className="mr-2"), dbc.Input( id="email-input", type="email", placeholder="Enter email"), dbc.FormFeedback(valid=False, ), ], className="mr-3", ), html.Br(), dbc.FormGroup( [ dbc.Label("Password", className="mr-2"), dbc.Input(id="pass-input", type="password", placeholder="Enter password"), dbc.FormFeedback(valid=False, ), ], className="mr-3", ), html.Br(), html.Br(), dbc.Button("Log In", id="Log-button", color="primary"), ], inline=True, style={'margin-left': '480px'})
def get_security_elements(self): return [ html.H5("Change password"), html.Hr(), dbc.Form( [ dbc.FormGroup( [ dbc.Input( placeholder="Enter current password", type="password", id="settings-current-pw", ) ], row=False, ), dbc.FormGroup( [ dbc.Input( placeholder="Enter new password", type="password", id="settings-new-pw", ), dbc.FormText( f"New password must be at least {MIN_PASSWORD_LENGTH} characters long." ), dbc.FormFeedback( "Wow! That looks like a great password :)", id="settings-new-pw-valid-feedback", valid=True, ), dbc.FormFeedback( id="settings-new-pw-invalid-feedback", valid=False ), ], row=False, ), dbc.FormGroup( [ dbc.Input( placeholder="Confirm new password", type="password", id="settings-confirm-new-pw", ), dbc.FormFeedback( "Doesn't match :(", id="settings-confirm-new-pw-invalid-feedback", valid=False, ), ], row=False, ), dbc.Button( "Save", n_clicks=0, id="settings-save-new-pw", disabled=True, color="primary", ), ] ), ]
import dash_bootstrap_components as dbc from dash import html from .util import make_subheading input_ = html.Div([ make_subheading("Input", "input"), html.Div([ dbc.Label("Valid text input"), dbc.Input(type="text", valid=True), dbc.FormFeedback("That's a valid input!", type="valid"), ]), html.Div([ dbc.Label("Invalid text input"), dbc.Input(type="text", invalid=True), dbc.FormFeedback("That's an invalid input...", type="invalid"), ]), html.Div([ dbc.Label("What's the best language?"), dbc.Select( id="select", options=[ { "label": "Python", "value": "python" }, { "label": "R", "value": "r" }, {
html.Div(id='output-data-upload'), ]), ], ), dbc.ModalFooter(children=[ html. A("How to format your configurations!", href= "https://pybatfish.readthedocs.io/en/latest/formats.html" ), dbc.FormGroup( [ dbc.Input(id="create-snapshot-name", value="", placeholder="New Snapshot Name"), dbc.FormFeedback( "Please enter a name for the snapshot", valid=False, ), ], className="mr-3", ), dbc.Button("Submit", id="create_snapshot_submit_button", color="dark", outline=True, style=dict(height="25px", )), ], ), ]) ], ), # Ask a Question Modal html.Div(children=[ dbc.Modal(id="ask-a-question-modal",
import dash import dash_html_components as html import dash_bootstrap_components as dbc from dash.dependencies import Input, Output app = dash.Dash(__name__) app.layout = html.Div( dbc.Container(dbc.Form([ dbc.FormGroup([ dbc.Label("账号密码", html_for="password"), dbc.Input(id="password", placeholder="请输入密码", autoComplete='off'), dbc.FormText("密码至少同时包含大写字母、小写字母和数字!", color="secondary"), dbc.FormFeedback("密码格式满足要求!", valid=True), dbc.FormFeedback( "密码格式不满足要求!", valid=False, ), ]) ]), style={ 'margin-top': '200px', 'max-width': '400px' })) @app.callback([Output('password', 'valid'), Output('password', 'invalid')], Input('password', 'value')) def check_password_format(value): import re
def home_page_layout(data=None): if data is None: data = {'isadmin': False, 'logged_in': False, 'login_user': None} if data['logged_in']: # If you are the application admin show the log window otherwise leave it hidden if data['login_user'] == site_admin: log_display = 'grid' else: log_display = 'none' else: log_display = 'none' content = html.Div( html.Content([ dbc.Row([ # Log contents display dbc.Col(dbc.Card([ dbc.CardHeader( html.H5('Log Output', className='card-title')), dcc.Textarea(id='log-output', value=read_logfile(), readOnly=True, wrap='wrap') ]), style={'display': log_display}), # Site admin controls dbc.Col( dbc.Card([ dbc.CardHeader( html.H5('Site Admin Controls', className='card-title')), dbc.CardBody( # id='site_admin_controls') id='site-admin-card', children=[ dcc.Tabs( id='site-admin-tabs', value='current_admins_list', children=[ dcc.Tab(label='Current Admins', value='current_admins_list', style={ 'border-radius': '15px 0px 0px 0px' }), dcc.Tab(label='Edit Admins', value='site_admin_controls', style={ 'border-radius': '0px 15px 0px 0px' }) ], ), html.Div(children=[ dcc.Loading(id='site-admin-tabs-content', type='default') ]) ]) ]), style={ 'display': log_display, 'maxWidth': '500px', 'maxHeight': '32.5vh' }, ), ]), dbc.Row([ # In Development Features Column dbc.Col(dbc.Card([ dbc.CardHeader( html.H5('Features in Development', className='card-title')), dbc.CardBody(read_upcoming_features()) ]), xl=4, md=6, width=12), # Implemented Features Column dbc.Col(dbc.Card([ dbc.CardHeader( html.H5('Implemented Features', className='card-title')), dbc.CardBody(read_active_features()) ]), xl=4, md=6, width=12), # User Submission Form Column dbc.Col( [ html.Div( [ dbc.Form([ html.H2('User Submission Form', style={'text-align': 'center'}), # Email input field dbc.FormGroup([ dbc.Label('Email:', width=2), dbc.Col(dbc.Input( id='from_addr', type='email', placeholder= 'Enter your L3Harris email address', value=''), width=10), dbc.FormFeedback(valid=True), dbc.FormFeedback(valid=False) ], row=True), dbc.FormGroup( [ dbc.Label('Choose one', width=4), dbc.Col(dbc.Select( options=[{ 'label': 'Report a Bug', 'value': '1' }, { 'label': 'Feature Request', 'value': '2' }, { 'label': 'Request Admin', 'value': '3' }], id='msgType', value=1), width=8) ], row=True), dbc.FormGroup([ dbc.Textarea( id='body', bs_size='lg', placeholder= 'Enter comments/suggestions', style={'height': '200px'}, value='') ]), dbc.FormGroup([ html.Div( '0', id='reset-div', style={'visibility': 'hidden'}), dbc.Button('Submit', id='submit', n_clicks=0, size='lg', color='success', style={'width': '100px'}), dbc.Button('Reset', id='reset', n_clicks=0, size='lg', color='danger', style={ 'width': '100px', 'float': 'right' }) ]), ]), html.Div(id='output-state', children=['']) ], id='submission-form') ], xl={ 'size': 4, 'offset': 0 }, md={ 'size': 8, 'offset': 2 }, width=12) ]) ])) return content
dbc.Card([ dbc.FormGroup([ dbc.Label("Category"), dcc.Dropdown( id="expense_category", options=[{ "label": exp, "value": exp } for exp in expense], value="Please select...", ), ]), dbc.FormGroup([ dbc.Label("Check Amount"), dbc.Input(id="expense", type="number", value=0), dbc.FormFeedback(valid=True), dbc.FormFeedback( "Invalid input", valid=False, ), ]), ]), id="check", ), ### Save Section ### dbc.Button( "Save", id="save-button", outline=True, color='info',