Movatterモバイル変換


[0]ホーム

URL:


CoreUI Angular Logo
Framework:
Getting startedIntroductionSupport CoreUICustomizeSassOptionsCSS VariablesLayoutBreakpointsContainersGridColumnsGuttersFormsOverviewAutocompletePRODate PickerPRODate Range PickerPROForm ControlSelectMulti SelectPROChecks & RadiosPassword InputPRORangeRange SliderPRORatingPROStepperPROInput GroupFloating LabelsLayoutTime PickerPROValidationComponentsAccordionAlertAvatarBadgeBreadcrumbButtonButton GroupCalendarPROCalloutCardCarouselClose buttonCollapseDropdownFooterHeaderImageList GroupLoading ButtonPROModalNavNavbarOffcanvasPaginationPlaceholderPopoverProgressSmart PaginationPROSmart TablePROSidebarSpinnerTableTabsNewToastTooltipWidgetsIconsChartsTemplatesNewAdmin & DashboardDownloadInstallationCustomizeContentMigrationv4 → v5v3 → v4Angular version


DownloadHire UsGet CoreUI PRO
On this page

Angular Toast Component

Push notifications to your visitors with an Angular toast, a lightweight and easily customizable alert message.

Overview

Angular toasts are lightweight notifications designed to mimic the push notifications that have been popularized bymobile and desktop operating systems. They’re built with flexbox, so they’re easy to align and position.

Things to know when using the toast plugin:

  • Toasts are opt-in for performance reasons, so you must initialize them yourself.
  • Toasts will automatically hide if you do not specifyautohide: false.

Examples

Basic toast

To encourage extensible and predictable toasts, we recommend a header and body. Toast headers usedisplay: flex,allowing easy alignment of content thanks to our margin and flexbox utilities.

Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element tocontain your "toasted" content and strongly encourage a dismiss button.

CoreUI for AngularThis is a static toast message
Loading...
Loading...
Loading...
CoreUI for Angular

This is static toast message in a toaster

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Translucent

Toasts are slightly translucent to blend in with what's below them.

CoreUI for Angular7 min agoThis is a toast message
Loading...
Loading...
Loading...

Stacking

You can stack toasts by wrapping them in ac-toaster container, which will vertically add some spacing.

CoreUI for Angular7 min agoThis is a toast message CoreUI for Angular5 min agoThis is a toast message
Loading...
Loading...
Loading...

Custom content

Customize your toasts by removing sub-components, tweaking them with utilities, or by adding your own markup. Herewe've created a simpler toast by removing the defaultc-toast-header, adding acButtonClose, andusing some flexbox utilities to adjust the layout.

Hello, world! This is a toast message.
Loading...
Loading...

Alternatively, you can also add additional controls and components to toasts.

Hello, world! This is a toast message.
Loading...
Loading...

Color schemes

Building on the above example, you can create different toast color schemes with our color and background utilities.Here we've setcolor="primary" and added.text-white class to thec-toast, and then set white property to ourclosebutton. For a crisp edge, we remove the default border with.border-0.

Hello, world! This is a toast message.
Loading...
Loading...

Placement

Place toasts where need them to show. The top right or top middle is often used for notifications.

CoreUI for AngularJust nowSee? Just like this.CoreUI for Angular2 secs agoHeads up, toasts will stack automatically
Loading...
Loading...
Loading...

API reference

Toast Module

import { ToastModule } from '@coreui/angular';@NgModule({   imports: [ToastModule,]})export class AppModule() { }

c-toast

component

exportAs: cToast

Inputs
namedescriptiontypedefault
autohideAuto hide the toast.booleantrue
colorSets the color context of the component to one of CoreUI’s themed colors.Colorsundefined
delayDelay hiding the toast (ms).number5000
fadeApply fade transition to the toast.booleantrue
visibleToggle the visibility of component.booleanfalse
Outputs
namedescriptiontype
visibleChangeEvent emitted onvisible change.boolean
timerEvent emitted onclock tick (secs).number

c-toast-body

component

exportAs: cToastBody

c-toast-header

component

exportAs: cToastHeader

Inputs
namedescriptiontypedefault
closeButtonAdd close button to the toast header.booleantrue

c-toaster

component

exportAs: cToaster

Inputs
namedescriptiontypedefault
placementToaster placement.stringtop-end
positionToaster position.string |absolute |fixed |staticabsolute

cToastClose

directive

exportAs: cToastClose

Inputs
namedescriptiontypedefault
cToastCloseToast to close.ToastComponentrequired

CoreUI for Angular is Open Source UI Components Library for Angular.

Currently v5.5.17 Code licensed MIT, docs CC BY 3.0 .
CoreUI PRO requires acommercial license.


[8]ページ先頭

©2009-2025 Movatter.jp