Dropdown
Wrapper for the Bootstrap dropdown component.
Example Usage
import React from "react";
import {Dropdown} from "bs5-react-elements";
function ExampleUsage() {
return <div className="dropdown">
<Dropdown
type="button"
className="dropdown-toggle"
data-bs-toggle="dropdown"
aria-expanded="false"
id="example-usage"
>
Lorem ipsum
</Dropdown>
<ul className="dropdown-menu" aria-labelledby="example-usage">
<li><a className="dropdown-item" href="#">Lorem ipsum #1</a></li>
<li><a className="dropdown-item" href="#">Lorem ipsum #2</a></li>
</ul>
</div>;
}
Important! If you choose to pass a user defined component to the as
prop,
it must support ref forwarding.
Demos
There are no demos available for this element. Submit an issue or pull request on GitHub to add one.
Props
Name | Description | Type | Default Value | Since |
---|---|---|---|---|
as | The element type of the dropdown | elementType | 'button' | 0.2.0 |
onShown | Handler for the shown.bs.dropdown event | func | 0.2.0 | |
onShow | Handler for the show.bs.dropdown event | func | 0.2.0 | |
onHidden | Handler for the hidden.bs.dropdown event | func | 0.2.0 | |
onHide | Handler for the hide.bs.dropdown event | func | 0.2.0 | |
component | React ref that will be assigned the component instance | React ref | 0.2.0 | |
config | Component configuration | object | 0.2.0 | |
children | Dropdown contents | node | 0.2.0 |