-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Components as props in labels (#940)
- Loading branch information
Showing
13 changed files
with
93 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
BOOTSTRAP = ( | ||
"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/" | ||
"https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.3/" | ||
"font/bootstrap-icons.css" | ||
) | ||
FONT_AWESOME = "https://use.fontawesome.com/releases/v6.1.1/css/all.css" | ||
FONT_AWESOME = "https://use.fontawesome.com/releases/v6.3.0/css/all.css" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
docs/components_page/components/input/components_in_labels.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import dash_bootstrap_components as dbc | ||
from dash import html | ||
|
||
flights = html.Div([html.I(className="bi bi-airplane pe-1"), "Flights"]) | ||
car = html.Div([html.I(className="bi bi-car-front pe-1"), "Rental Car"]) | ||
hotel = html.Div([html.I(className="bi bi-house pe-1"), "Hotel"]) | ||
|
||
radioitems = html.Div( | ||
[ | ||
dbc.Label("Booking"), | ||
dbc.RadioItems( | ||
options=[ | ||
{"label": flights, "value": 1}, | ||
{"label": car, "value": 2}, | ||
{"label": hotel, "value": 3}, | ||
], | ||
value=1, | ||
id="radioitems-input", | ||
), | ||
] | ||
) | ||
|
||
checkbox = dbc.Checkbox( | ||
id="standalone-checkbox", | ||
label=html.Div( | ||
["I agree to the ", html.A("Terms and Conditions", href="#")] | ||
), | ||
value=False, | ||
) | ||
|
||
components_in_labels = html.Div([radioitems, html.Hr(), checkbox]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
"dash_bootstrap_components", | ||
"docs", | ||
"examples", | ||
"tests", | ||
"noxfile.py", | ||
"tasks.py", | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import dash_bootstrap_components as dbc | ||
from dash import Dash, html | ||
|
||
|
||
def test_mdcap001_components_as_props(dash_duo): | ||
app = Dash(__name__) | ||
|
||
app.layout = html.Div( | ||
[ | ||
dbc.Checklist( | ||
[ | ||
{"label": html.H2("H2 label"), "value": "h2"}, | ||
{ | ||
"label": html.A("Link in checklist", href="#"), | ||
"value": "a", | ||
}, | ||
], | ||
id="checklist", | ||
), | ||
dbc.RadioItems( | ||
[ | ||
{"label": html.H3("on"), "value": "on"}, | ||
{"label": html.P("off"), "value": "off"}, | ||
], | ||
id="radio-items", | ||
), | ||
dbc.Checkbox(label=html.H4("h4"), value="h4", id="checkbox"), | ||
dbc.RadioButton(label=html.H6("h6"), value="h6", id="radiobutton"), | ||
dbc.Switch(label=html.H5("h5"), value="h5", id="switch"), | ||
] | ||
) | ||
|
||
dash_duo.start_server(app) | ||
|
||
dash_duo.wait_for_text_to_equal("#checklist h2", "H2 label") | ||
dash_duo.wait_for_text_to_equal("#checklist a", "Link in checklist") | ||
|
||
dash_duo.wait_for_text_to_equal("#radio-items h3", "on") | ||
dash_duo.wait_for_text_to_equal("#radio-items p", "off") | ||
|
||
dash_duo.wait_for_text_to_equal("#checkbox+label", "h4") | ||
dash_duo.wait_for_text_to_equal("#radiobutton+label", "h6") | ||
dash_duo.wait_for_text_to_equal("#switch+label", "h5") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters