Skip to content

Commit 04ac302

Browse files
glsdowntcbegley
andcommitted
Fix DropdownMenu bugs (#662)
* Updated to use react-bootstrap props * Update dropdown alignment examples * Add dropdown autoclose examples * Add dark dropdown examples * Update dropdown direction examples * Update dropdown docs for new/amended examples * Format * Fixed dropdown in button group * Remove new auto_close prop in dropdown Co-authored-by: tcbegley <[email protected]>
1 parent b2996d7 commit 04ac302

File tree

12 files changed

+112
-34
lines changed

12 files changed

+112
-34
lines changed

docs/components_page/components/dropdown.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ Each `DropdownMenuItem` can be used like `dash_core_components.Link`, as a regul
1717

1818
{{example:components/dropdown/menu_items.py:dropdown}}
1919

20+
## Dark Dropdown
21+
22+
Set `menu_variant="dark"` to change the dropdown menu to a dark colour scheme.
23+
24+
{{example:components/dropdown/dark.py:dropdown}}
25+
2026
## Styling the toggle
2127

2228
You can use the `color` prop of `DropdownMenu` to set the color to one of the Bootstrap contextual colors. If you want to further customise the style you can use the `toggle_style` and `toggle_class_name` arguments.
@@ -31,13 +37,13 @@ Control the size of the `DropdownMenu` toggle using the `size` argument. You can
3137

3238
## DropdownMenu direction
3339

34-
Use the `direction` argument to control where the menu is rendered relative to the toggle. The possible options are `'up'`, `'down'` (default), `'left'`, or `'right'`.
40+
Use the `direction` argument to control where the menu is rendered relative to the toggle. The possible options are `'up'`, `'down'` (default), `'start'`, or `'end'`.
3541

3642
{{example:components/dropdown/direction.py:dropdown}}
3743

3844
## DropdownMenu alignment
3945

40-
By default the menu is aligned with left of the toggle. Set `right=True` for a right aligned menu.
46+
By default the menu is aligned with left of the toggle. Set `align_end=True` for a right aligned menu.
4147

4248
{{example:components/dropdown/alignment.py:dropdown}}
4349

docs/components_page/components/dropdown/alignment.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ dropdown <- dbcRow(
1414
dbcDropdownMenu(
1515
label = "Left-aligned menu (default)",
1616
children = items,
17-
right = FALSE
17+
align_end = FALSE
1818
)
1919
),
2020
dbcCol(
2121
dbcDropdownMenu(
22-
label = "Right-aligned menu", children = items, right = TRUE
22+
label = "Right-aligned menu", children = items, align_end = TRUE
2323
)
2424
)
2525
)

docs/components_page/components/dropdown/alignment.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ dropdown = dbc_row([
1313
dbc_dropdownmenu(
1414
label = "Left-aligned menu (default)",
1515
children = items,
16-
right = false,
16+
align_end = false,
1717
),
1818
),
19-
dbc_col(dbc_dropdownmenu(label = "Right-aligned menu", children = items, right = true)),
19+
dbc_col(
20+
dbc_dropdownmenu(label = "Right-aligned menu", children = items, align_end = true),
21+
),
2022
]);

docs/components_page/components/dropdown/alignment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
dbc.DropdownMenu(
1515
label="Left-aligned menu (default)",
1616
children=items,
17-
right=False,
17+
align_end=False,
1818
)
1919
),
2020
dbc.Col(
2121
dbc.DropdownMenu(
22-
label="Right-aligned menu", children=items, right=True
22+
label="Right-aligned menu", children=items, align_end=True
2323
)
2424
),
2525
]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
library(dashBootstrapComponents)
2+
3+
dropdown <- dbcDropdownMenu(
4+
label = "Menu",
5+
menu_variant = "dark",
6+
children = list(
7+
dbcDropdownMenuItem("Item 1"),
8+
dbcDropdownMenuItem("Item 2"),
9+
dbcDropdownMenuItem("Item 3")
10+
)
11+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using DashBootstrapComponents
2+
3+
dropdown = dbc_dropdownmenu(
4+
label = "Menu",
5+
menu_variant = "dark",
6+
children = [
7+
dbc_dropdownmenuitem("Item 1"),
8+
dbc_dropdownmenuitem("Item 2"),
9+
dbc_dropdownmenuitem("Item 3"),
10+
],
11+
)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import dash_bootstrap_components as dbc
2+
3+
dropdown = dbc.DropdownMenu(
4+
label="Menu",
5+
menu_variant="dark",
6+
children=[
7+
dbc.DropdownMenuItem("Item 1"),
8+
dbc.DropdownMenuItem("Item 2"),
9+
dbc.DropdownMenuItem("Item 3"),
10+
],
11+
)

docs/components_page/components/dropdown/direction.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ dropdown <- dbcRow(
1717
),
1818
dbcCol(
1919
dbcDropdownMenu(
20-
label = "Dropleft", children = items_direction, direction = "left"
20+
label = "Dropstart", children = items_direction, direction = "start"
2121
),
2222
width = "auto"
2323
),
2424
dbcCol(
2525
dbcDropdownMenu(
26-
label = "Dropright", children = items_direction, direction = "right"
26+
label = "Dropend", children = items_direction, direction = "end"
2727
),
2828
width = "auto"
2929
),

docs/components_page/components/dropdown/direction.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ dropdown = dbc_row(
1717
width = "auto",
1818
),
1919
dbc_col(
20-
dbc_dropdownmenu(label = "Dropleft", children = items, direction = "left"),
20+
dbc_dropdownmenu(label = "Dropstart", children = items, direction = "start"),
2121
width = "auto",
2222
),
2323
dbc_col(
24-
dbc_dropdownmenu(label = "Dropright", children = items, direction = "right"),
24+
dbc_dropdownmenu(label = "Dropend", children = items, direction = "end"),
2525
width = "auto",
2626
),
2727
dbc_col(

docs/components_page/components/dropdown/direction.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@
1616
),
1717
dbc.Col(
1818
dbc.DropdownMenu(
19-
label="Dropleft", children=items, direction="left"
19+
label="Dropstart", children=items, direction="start"
2020
),
2121
width="auto",
2222
),
2323
dbc.Col(
24-
dbc.DropdownMenu(
25-
label="Dropright", children=items, direction="right"
26-
),
24+
dbc.DropdownMenu(label="Dropend", children=items, direction="end"),
2725
width="auto",
2826
),
2927
dbc.Col(

0 commit comments

Comments
 (0)