
Just add data-toggle="collapse" and a data-target to the element to automatically assign control of one or more collapsible elements.

These classes can be found in _transitions.scss. collapsing is added when the transition starts, and removed when it finishes The collapse plugin utilizes a few classes to handle the heavy lifting: Note that Bootstrap’s current implementation does not cover the various keyboard interactions described in the ARIA Authoring Practices Guide accordion pattern - you will need to include these yourself with custom JavaScript. Modern screen readers and similar assistive technologies make use of this attribute to provide users with additional shortcuts to navigate directly to the collapsible element itself. the data-target attribute is pointing to an id selector – you should add the aria-controls attribute to the control element, containing the id of the collapsible element. If your control element is targeting a single collapsible element – i.e. If the control element’s HTML element is not a button (e.g., an or ), the attribute role="button" should be added to the element. The plugin will automatically toggle this attribute on the control based on whether or not the collapsible element has been opened or closed (via JavaScript, or because the user triggered another control element also tied to the same collapsible element). If you’ve set the collapsible element to be open by default using the show class, set aria-expanded="true" on the control instead. If the collapsible element is closed by default, the attribute on the control element should have a value of aria-expanded="false". This attribute explicitly conveys the current state of the collapsible element tied to the control to screen readers and similar assistive technologies. This panel is hidden by default.īe sure to add aria-expanded to the control element. Some placeholder content for the second accordion panel. This panel is shown by default, thanks to the. Some placeholder content for the first accordion panel. accordion as a wrapper.Īnd lastly, the placeholder content for the third and final accordion panel. To properly achieve the accordion style, be sure to use. Using the card component, you can extend the default collapse behavior to create an accordion. This panel is hidden by default but revealed when the user activates the relevant trigger. Some placeholder content for the first collapse component of this multi-collapse example. Toggle first element Toggle second element Toggle both elements Some placeholder content for the second collapse component of this multi-collapse example.

#Material ui accordion free
Feel free to write your own custom Sass, use inline styles, or use our width utilities. width modifier class to transition the width instead of height and set a width on the immediate child element.

The collapse plugin also supports horizontal collapsing. Some placeholder content for the collapse component.
