Web Components 확장 패널 개요

    Ignite UI for Web Components 확장 패널은 축소 또는 확장의 두 가지 상태로 렌더링할 수 있는 경량 아코디언 구성 요소입니다. 확장 패널은 마우스 클릭 또는 키보드 상호 작용을 사용하여 전환할 수 있습니다.

    Web Components Expansion Panel Example

    EXAMPLE
    TS
    HTML
    ExpansionPanelUsage.css
    index.css

    Like this sample? Get access to our complete Ignite UI for Web Components toolkit and start building your own apps in minutes. Download it for free.

    Usage

    먼저 다음 명령을 실행하여 Ignite UI for Web Components 설치해야 합니다.

    npm install igniteui-webcomponents
    cmd

    IgcExpansionPanelComponent를 사용하기 전에 다음과 같이 등록해야 합니다.

    import {defineComponents, IgcExpansionPanelComponent} from 'igniteui-webcomponents';
    
    defineComponents(IgcExpansionPanelComponent);
    ts

    Ignite UI for Web Components에 대한 전체 소개를 보려면 시작하기 항목을 읽어보세요.

    IgcExpansionPanelComponent 사용을 시작하는 가장 간단한 방법은 다음과 같습니다.

    <igc-expansion-panel>
        <div slot="title">Golden Retriever</div>
        <div slot="subTitle">Medium-large gun dog</div>
        <div>
            <p>The Golden Retriever is a medium-large gun dog that retrieves shot waterfowl, such as ducks
            and upland game birds, during hunting and shooting parties.[3] The name "retriever" refers to the breed's ability
            to retrieve shot game undamaged due to their soft mouth. Golden retrievers have an instinctive love of water, and
            are easy to train to basic or advanced obedience standards.</p>
        </div>
    </igc-expansion-panel>
    html
    Ignite UI for Web Components | CTA Banner

    Binding to events

    확장 패널 구성요소는 다음 이벤트를 발생시킵니다.

    • igcClosed - 확장 패널이 접힐 때 발생합니다.
    • igcOpened - 확장 패널이 확장되면 발생합니다.
    • igcClosing - 확장 패널이 접히기 시작할 때 발생합니다.
    • igcOpening - 확장 패널이 확장되기 시작할 때 발생합니다.

    다음 샘플은 패널의 현재 상태에 따라 subtitle 표시하거나 숨기도록 구성 요소에 로직을 추가하는 방법을 보여줍니다.

    igcOpenedigcClosed 이벤트 이미터에 바인딩하여 이를 수행할 수 있습니다.

    EXAMPLE
    TS
    HTML
    ExpansionPanelPropertiesAndEvents.css
    index.css

    Component Customization

    IgcExpansionPanelComponent 컨트롤을 사용하면 모든 종류의 콘텐츠를 본문 내부에 추가할 수 있습니다. 입력, 차트 및 기타 확장 패널을 렌더링할 수 있습니다!

    IgcExpansionPanelComponent 사용하면 노출된 제목, 하위 제목표시기 슬롯을 통해 헤더를 쉽게 사용자 정의할 수 있습니다.

    확장 표시기의 위치 구성은 확장 패널의 속성을 통해 indicatorPosition 수행할 수 있습니다. 가능한 옵션은 start, end 또는 none 입니다.

    다음 코드 샘플은 구성 요소의 버튼이 오른쪽으로 이동하도록 구성하는 방법을 보여줍니다.

    EXAMPLE
    TS
    HTML
    ExpansionPanelCustomization.css
    index.css

    Keyboard Navigation

    Ignite UI for Web Components 확장 패널 키보드 탐색은 W3C 접근성 표준을 준수하며 사용하기 편리합니다.

    주요 조합

    • Alt + ↓- 초점이 맞춰진 패널 확장
    • Alt + ↑- 초점이 맞춰진 패널 축소
    • 스페이스바 / Enter- 초점이 맞춰진 패널의 확장 상태를 전환합니다.

    Styling

    구성 요소는 IgcExpansionPanelComponent 여러 CSS 부분을 노출하여 스타일을 완전히 제어할 수 있습니다.

    이름 설명
    header 확장 표시기, 제목 및 부제목의 컨테이너입니다.
    title 제목 컨테이너입니다.
    subtitle 자막 컨테이너입니다.
    indicator 지표 컨테이너입니다.
    content 확장 패널의 콘텐츠 래퍼입니다.
    igc-expansion-panel {
      background-color: var(--ig-secondary-900);
      color: var(--ig-secondary-900-contrast);
    }
    
    igc-button::part(base) {
      color: var(--ig-secondary-900-contrast);
    }
    
    igc-button::part(base)::before {
      background-color: var(--ig-warn-500);
    }
    
    igc-expansion-panel::part(indicator) {
      color: var(--ig-warn-500);
    }
    
    igc-expansion-panel::part(header) {
      background-color: var(--ig-secondary-900);
    }
    
    igc-expansion-panel::part(title),
    igc-expansion-panel::part(subtitle) {
      color: var(--ig-warn-500);
    }
    css

    EXAMPLE
    TS
    HTML
    ExpansionPanelStyling.css
    index.css

    API References

    Additional Resources