You are currently viewing the auto-generated docs from the master branch. The docs for the current release are available at https://react-bootstrap.github.io/
Add flush to remove the default background-color, some borders, and some rounded corners to render accordions edge-to-edge with their parent container.
You can make accordion items stay open when another item is opened by using the alwaysOpen prop. If you're looking to
control the component, you must use an array of strings for activeKey or defaultActiveKey.
You can still create card-based accordions like those in Bootstrap 4. You can hook
into the Accordion toggle functionality via useAccordionButton to make custom
toggle components.
You may wish to have different styles for the toggle if it's associated section is expanded,
this can be achieved with a custom toggle that is context aware and also takes advantage of the useAccordionButton hook.
Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css.
import Accordion from 'react-bootstrap/Accordion'Copy import code for the Accordion component
Name
Type
Default
Description
as
elementType
<div>
Set a custom element for this component
eventKey required
string
A unique key used to control this item's collapse/expand.
bsPrefix
string
'accordion-item'
Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css.
import Accordion from 'react-bootstrap/Accordion'Copy import code for the Accordion component
Name
Type
Default
Description
as
elementType
<h2>
Set a custom element for this component
onClick
function
Click handler for the AccordionButton element
bsPrefix
string
'accordion-header'
Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css.
import Accordion from 'react-bootstrap/Accordion'Copy import code for the Accordion component
Name
Type
Default
Description
as
elementType
<div>
Set a custom element for this component
onEnter
function
Callback fired before the component expands
onEntered
function
Callback fired after the component has expanded
onEntering
function
Callback fired after the component starts to expand
onExit
function
Callback fired before the component collapses
onExited
function
Callback fired after the component has collapsed
onExiting
function
Callback fired after the component starts to collapse
bsPrefix
string
'accordion-body'
Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css.
import Accordion from 'react-bootstrap/Accordion'Copy import code for the Accordion component
Name
Type
Default
Description
as
elementType
<button>
Set a custom element for this component
onClick
function
A callback function for when this component is clicked
bsPrefix
string
'accordion-button'
Change the underlying component CSS base class name and modifier class names prefix. This is an escape hatch for working with heavily customized bootstrap css.