• 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

Modal

Modal window component.


Usage

Example


Script


  const [modal, setModal] = useState(false);

  const toggle = ()=>{
    setModal(!modal);
  }

  return (
    <>
      <CButton
        onClick={toggle}
        className="mr-1"
      >Launch demo modal</CButton>
      <CModal
        show={modal}
        onClose={toggle}
      >
        <CModalHeader closeButton>Modal title</CModalHeader>
        <CModalBody>
          Lorem ipsum dolor...
        </CModalBody>
        <CModalFooter>
          <CButton color="primary">Do Something</CButton>{' '}
          <CButton
            color="secondary"
            onClick={toggle}
          >Cancel</CButton>
        </CModalFooter>
      </CModal>
    </>
  )
  


# Features

  • Many customization options
  • Easily manage modal visibility

Modal is hidding after click on one of following triggers:

  • Close button in the default header
  • 'OK' and 'Cancel' buttons in the footer
  • Backdrop (when closeOnBackdrop prop is true)

# Modal API

NameRequiredTypeDefault Value
childrenany
children components
classNamestring
user classes for the main HTML tag
innerRef(object | Function | string)
ref to the main tag
showboolean
show dialog box
centeredboolean
show dialog box
size(sm | lg | xl)
show dialog box
backdropbooleantrue
show dialog box
colorstring
show dialog box
borderColorstring
show dialog box
onOpenedFunction
show dialog box
onClosedFunction
show dialog box
fadebooleantrue
show dialog box
closeOnBackdropbooleantrue
show dialog box
onCloseFunction
show dialog box
addContentClassstring
show dialog box



ModalHeader


# ModalHeader API

NameRequiredTypeDefault Value
taganyheader
main HTML tag name
childrenany
children components
classNamestring
user classes for the main HTML tag
innerRef(object | Function | string)
ref to the main tag
closeButtonboolean
show dialog box



ModalBody


# ModalBody API

NameRequiredTypeDefault Value
taganydiv
main HTML tag name
classNamestring
user classes for the main HTML tag
innerRef(object | Function | string)
ref to the main tag



ModalFooter


# ModalFooter API

NameRequiredTypeDefault Value
taganyfooter
main HTML tag name
classNamestring
user classes for the main HTML tag
innerRef(object | Function | string)
ref to the main tag

  • Components
    • Usage
      • Features
      • API
    • Related
      • CModal
      • CModalHeader
      • CModalBody
      • CModalFooter
CoreUI © 2020 creativeLabs.core-logo