• 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

Toast Components

Notification components.




Toaster


# Toaster API

NameRequiredTypeDefault Value
classNamestring
user classes for the main HTML tag
innerRef(Function | string | object)
ref to the main tag
position(static | top-right | top-left | top-center | top-full | bottom-right | bottom-left | bottom-center | bottom-full)top-right
determines position of the element, set position to 'static' to avoid fixed positioning. Options with 'full' suffix will give toast 100% width. Available values: 'static', 'top-end', 'top-center', 'top-left', 'top-full', 'bottom-right', 'bottom-center', 'bottom-left', 'bottom-full'



Toast


Usage

Example

Toast title
This is a toast in static positioned toaster number 1.
Toast title
This is a toast in static positioned toaster number 2.
Toast title
This is a toast in top-right positioned toaster number 1.

Script


  let toasts = [
    { position: 'static'},
    { position: 'static'},
    { position: 'top-right', autohide: 3000 }
  ];
  let toasters = (()=>{
    return toasts.reduce((toasters, toast) => {
      toasters[toast.position] = toasters[toast.position] || []
      toasters[toast.position].push(toast)
      return toasters
    }, {})
  })();

  return (
    <>
      {Object.keys(toasters).map((toasterKey) => (
        <CToaster
          position={toasterKey}
          key={'toaster' + toasterKey}
        >
          {
          toasters[toasterKey].map((toast, key)=>{
            return(
              <CToast
                key={'toast' + key}
                show={true}
                autohide={toast.autohide}
                fade={toast.fade}
              >
                <CToastHeader closeButton={toast.closeButton}>
                  Toast title
                </CToastHeader>
                <CToastBody>
                  {`This is a toast in ${toasterKey} positioned toaster number ${key + 1}.`}
                </CToastBody>
              </CToast>
            )
          })
          }
        </CToaster>
      ))}
    </>
  )
  


# Toast API

NameRequiredTypeDefault Value
classNamestring
user classes for the main HTML tag
childrenany
children components
innerRef(Function | string | object)
ref to the main tag
showboolean
show state
autohide(number | boolean)
autohide feature on (true or time)
fadebooleantrue
use fade effect
onStateChangeFunction
on state change callback



ToastHeader


# ToastHeader API

NameRequiredTypeDefault Value
classNamestring
user classes for the main HTML tag
childrenany
children components
innerRef(Function | string | object)
ref to the main tag
closeButtonbooleantrue
ref to the main tag



ToastBody


# ToastBody API

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

  • Components
    • Usage
      • Features
      • API
    • Related
      • -Toast
      • CToaster
      • CToast
      • CToastHeader
      • CToastBody
CoreUI © 2020 creativeLabs.core-logo