forked from reactstrap/reactstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Dropdown): Added container prop to DropdownMenu using React.port…
…al (reactstrap#2016) * Added container prop to DropdownMenu using React.portal * Fixed tabbing and keyboard events for menu items * Fixed timing issue in tests with getMenuItems
- Loading branch information
Showing
6 changed files
with
154 additions
and
18 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
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,28 @@ | ||
import React, { useState } from 'react'; | ||
import { Dropdown, DropdownToggle, DropdownMenu, DropdownItem } from 'reactstrap'; | ||
|
||
const Example = (props) => { | ||
const [dropdownOpen, setDropdownOpen] = useState(false); | ||
|
||
const toggle = () => setDropdownOpen(prevState => !prevState); | ||
const [lastClicked, setLastClicked] = useState(null); | ||
|
||
return ( | ||
<div style={{ width: 300, height: 100, border: '1px solid #000', padding: '8px', overflow: 'hidden' }}> | ||
Container with overflow: hidden.<br /> | ||
Last clicked: {lastClicked || 'null'} | ||
<Dropdown isOpen={dropdownOpen} toggle={toggle}> | ||
<DropdownToggle caret> | ||
Dropdown | ||
</DropdownToggle> | ||
<DropdownMenu container="body"> | ||
<DropdownItem onClick={() => setLastClicked(1)}>Action 1</DropdownItem> | ||
<DropdownItem onClick={() => setLastClicked(2)}>Action 2</DropdownItem> | ||
<DropdownItem onClick={() => setLastClicked(3)}>Action 3</DropdownItem> | ||
</DropdownMenu> | ||
</Dropdown> | ||
</div> | ||
); | ||
} | ||
|
||
export default Example; |
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