React 아이콘 버튼 개요

    Ignite UI for React 하면 개발자가 등록된 아이콘을 애플리케이션의 버튼으로 사용할 수 있습니다. 아이콘 구성 요소의 모든 기능을 제공하지만 버튼 구성 요소의 기능도 추가합니다.

    React Icon Button Example

    Usage

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

    npm install igniteui-react
    

    그런 다음 다음과 같이 필요한 CSS인 IgrIconButton 가져오고 해당 모듈을 등록해야 합니다.

    import { IgrIconButtonModule, IgrIconButton } from 'igniteui-react';
    import 'igniteui-webcomponents/themes/light/bootstrap.css';
    IgrIconButtonModule.register();
    
    <IgrIconButton name="thumb-up" collection="material"></IgrIconButton>
    

    Examples

    Variant

    일반 버튼 구성 요소와 유사하게 아이콘 버튼은 flat (기본값), containedoutlined 등 여러 변형을 지원합니다. 아이콘 버튼 유형을 변경하려면 아이콘 버튼의 variant 속성을 설정하세요.

    <IgrIconButton name="search" collection="contained"></IgrIconButton>
    

    Size

    버튼의 크기는--ig-size CSS 변수를 사용하여 지원되는 세 가지 크기(--ig-size-small,--ig-size-medium,--ig-size-large 중 하나로 변경할 수 있습니다( 기본).

    <IgrIconButton name="thumb-up" size="medium"></IgrIconButton>
    
    igc-icon-button {
        --ig-size: var(--ig-size-medium);
    }
    

    Type

    아이콘 버튼 구성 요소는 href 속성이 설정되면 내부 구조를 <button>에서 <a> 유형 요소로 변경합니다. 이 경우 아이콘 버튼은 일반 링크로 간주될 수 있습니다. href 속성을 설정하면 아이콘 버튼의 rel, targetdownload 속성도 설정할 수 있습니다.

    <IgrIconButton name="thumb-up" collection="material" href="https://duckduckgo.com" target="_blank">
    </IgrIconButton>
    

    Mirrored

    일부 아이콘은 오른쪽에서 왼쪽(RTL) 모드에서 사용될 때 약간 다르게 표시되어야 합니다. 이러한 이유로 우리는 설정 시 아이콘 버튼을 수평으로 뒤집는 mirrored 속성을 제공합니다.

    <IgrIconButton name="thumb-up" mirrored="true"></IgrIconButton>
    

    Styling

    아이콘 버튼 구성 요소는 래핑 요소(<button> 또는 <a>)와 래핑된 <igc-icon> 요소의 스타일을 지정할 수 있는 baseicon 이라는 두 가지 CSS 부분을 노출합니다.

    igc-icon-button::part(base) {
      padding: 12px;
      color: olive;
    }
    
    igc-icon-button::part(icon) {
      --size: 32px;
    }
    

    API References

    Additional Resources