Web Components 토스트 개요

    Web Components 토스트는 메시지 내용을 표시하고 최종 사용자에게 변경된 기록의 상태를 알리는 데 사용되는 매우 가볍고 작은 팝업 구성 요소입니다. 화면 하단이나 기타 지정된 영역에 Web Components 토스트 알림을 쉽게 배치하고 표시할 수 있습니다. 또는 간단하고 쉬운 방법으로 무시할 수도 있습니다.

    Web Components Toast 구성 요소는 주로 시스템 메시징, 푸시 알림, 경고 메시지 및 정보에 사용됩니다. 사용자가 취소할 수 없습니다. 이 컨트롤에는 애니메이션 효과, 토스트 구성 요소가 표시되는 기간을 구성하는 표시 시간 속성, 스타일 지정 등과 같은 다양한 기능이 있습니다.

    Web Components Toast Example

    아래의 간단한 Ignite UI for Web Components 예시를 살펴보세요. 버튼을 클릭하면 애니메이션 알림 메시지가 나타납니다.

    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 에 대한 전체 소개는 시작 항목을 참조하세요.

    토스트 구성 요소를 표시하는 가장 간단한 방법은 show 메서드를 사용하고 버튼 클릭 시 호출하는 것입니다.

    <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

    태그 선택기를 사용하여 Web Components IgcToastComponent 알림의 스타일을 직접 지정할 수 있습니다.

    igc-toast {
        background: #011627;
        color: #ECAA53;
        outline-color: #ECAA53;
    }
    

    API References

    Additional Resources