Web Components 토스트 개요
Web Components 토스트는 메시지 내용을 표시하고 최종 사용자에게 변경된 레코드의 상태를 알리는 데 사용되는 매우 가볍고 작은 팝업 구성 요소입니다. 화면의 하단이나 다른 지정된 영역에 Web Components 토스트 알림을 쉽게 배치하고 표시할 수 있습니다. 또는 간단하고 쉬운 방법으로 해제할 수도 있습니다.
Web Components 토스트 구성 요소는 주로 시스템 메시징, 푸시 알림, 경고 메시지 및 정보에 사용됩니다. 사용자가 해제할 수 없습니다. 이 컨트롤에는 애니메이션 효과, 토스트 구성 요소가 표시되는 시간을 구성하는 표시 시간 속성, 스타일링 등과 같은 다양한 기능이 있습니다.
Web Components Toast Example
아래의 간단한 Ignite UI for Web Components Toast 예제를 살펴보세요. 버튼을 클릭하면 애니메이션 알림 메시지가 팝업됩니다.
How To Use Ignite UI for Web Components Toast Notification
먼저 다음 명령을 실행하여 Ignite UI for Web Components 설치해야 합니다.
npm install igniteui-webcomponents
import { defineComponents, IgcToastComponent } from 'igniteui-webcomponents';
defineComponents(IgcToastComponent);
Ignite UI for Web Components에 대한 완전한 소개는 '시작 주제'를 읽어보세요.
The simplest way to display the toast component is to use its show method and call it on a button click.
<igc-button onclick="toast.show()" variant="contained">Show Toast</igc-button>
<igc-toast id="toast">Toast Message</igc-toast>
Examples
Properties
이 속성을 사용displayTime 해 토스트 구성 요소가 얼마나 오래 보이는지 설정하세요. 기본값은 4000밀리초로 설정되어 있습니다.
기본적으로 토스트 구성 요소는 지정된displayTime 기간 후 자동으로 숨겨집니다. 이 동작을 변경하기 위해 속성을 사용할keepOpen 수 있습니다. 이렇게 하면 토스트가 계속 보이게 됩니다.
<igc-button onclick="toast.toggle()" variant="contained">Toggle Toast</igc-button>
<igc-button onclick="toast.keepOpen = !toast.keepOpen" variant="contained">Toggle keepOpen property</igc-button>
<igc-button onclick="toast.displayTime = 8000" variant="contained">Set DisplayTime to 8000</igc-button>
<igc-toast id="toast">Toast Message</igc-toast>
Styling
You can style the Web Components IgcToastComponent notifications directly using its tag selector:
igc-toast {
background-color: var(--ig-primary-500);
color: var(--ig-primary-500-contrast);
}