• Getting Started
  • Components
  • Github
  • Go pro
energyGetting started
  • Introduction
dComponents
  • Button Components
  • Grid Components
  • Input Components
  • Layout Components
  • Toast Components
  • Widget Components
  • Alert
  • Badge
  • Breadcrumb
  • Callout
  • Card
  • Carousel
  • Charts
  • Collapse
  • CreateElement
  • DataTable
  • Dropdown
  • ElementCover
  • Embed
  • Fade
  • Form
  • Icon
  • Img
  • Jumbotron
  • Link
  • ListGroup
  • Media
  • Modal
  • Nav
  • Navbar
  • Pagination
  • Popover
  • Progress
  • Spinner
  • Switch
  • Tabs
  • Toggler
  • Tooltip

Collapse

React collapse component toggles the visibility of content across your project with a few classes and some scripts. Useful for a large amount of content.


Usage

Example

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.

Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident.


Script


  const [collapse, setCollapse] = useState(false);
  const [collapse2, setCollapse2] = useState(false);

  const onEntering = () => {};
  const onEntered = () => {};
  const onExiting = () => {};
  const onExited = () => {};

  const toggle = (e)=>{
    setCollapse(!collapse);
    e.preventDefault();
  }

  // inner
  const toggle2 = (e)=>{
    setCollapse2(!collapse2);
    e.preventDefault();
  }

  return (
    <CCard>
      <CCollapse
        show={collapse}
        onEntering={onEntering}
        onEntered={onEntered}
        onExiting={onExiting}
        onExited={onExited}
      >
        <CCardBody>
          <p>
            Anim pariatur cliche reprehenderit,
            enim eiusmod high life accusamus terry richardson ad squid. Nihil
            anim keffiyeh helvetica, craft beer labore wes anderson cred
            nesciunt sapiente ea proident.
          </p>

          <CCard>
            <CCollapse
              show={collapse2}
            >
              <CCardBody>
                <p>
                  Anim pariatur cliche reprehenderit,
                  enim eiusmod high life accusamus terry richardson ad squid. Nihil
                  anim keffiyeh helvetica, craft beer labore wes anderson cred
                  nesciunt sapiente ea proident.
                </p>
              </CCardBody>
            </CCollapse>
            <CCardFooter>
              <CButton
                onClick={toggle2}
                className={'mb-1'}
              >
                Toggle Inner Collapse
              </CButton>
            </CCardFooter>
          </CCard>

        </CCardBody>
      </CCollapse>
      <CCardFooter>
        <CButton
          color="primary"
          onClick={toggle}
          className={'mb-1'}
        >
          Toggle Collapse
        </CButton>
      </CCardFooter>
    </CCard>
  )
  


# Features

  • Collapse animation
  • Optional duration and transition effect
  • Adapted to use in navbars

# Collapse API

NameRequiredTypeDefault Value
children(ArrayOf(string) | any)
main tag content
classNamestring
user classes for the main HTML tag
innerRef(object | Function | string)
ref to the main tag
showbooleanfalse
show state
navbarboolean
set for collapse inside a navbar component

  • Components
    • Usage
      • Features
      • API
CoreUI © 2020 creativeLabs.core-logo