Web Components 아바타

    Ignite UI for Web Components 아바타는 응용 프로그램에 이니셜, 이미지 또는 아이콘을 표시하는 데 도움이 됩니다.

    Web Components 아이콘 아바타 예

    EXAMPLE
    TS
    HTML
    CSS

    이 샘플이 마음에 드시나요? 당사의 완전한 Ignite UI for Web Components 툴킷에 액세스하여 몇 분 만에 나만의 앱을 빌드하기 시작하세요. 무료로 다운로드하세요.

    용법

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

    npm install igniteui-webcomponents
    cmd
    import { defineComponents, IgcAvatarComponent } from 'igniteui-webcomponents';
    
    defineComponents(IgcAvatarComponent);
    ts

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

    IgcAvatarComponent는 이미지, 이니셜 또는 아이콘을 포함한 기타 콘텐츠를 표시할 수 있습니다. IgcAvatarComponent 선언은 다음과 같이 간단합니다.

    <igc-avatar></igc-avatar>
    html

    아바타에는 상황에 따라 다양한 콘텐츠를 렌더링할 수 있는 여러 속성이 있습니다. 아바타의 경계에 콘텐츠를 표시하는 가장 기본적인 방법은 여는 태그와 닫는 태그 사이에 콘텐츠를 제공하는 것입니다.

    <igc-avatar>
      <igc-icon name="home"></igc-icon>
    </igc-avatar>
    html

    머리 글자

    initials 속성이 설정되면 아바타의 모든 하위 요소가 무시되고 이 속성에 전달된 문자열이 표시됩니다.

    <!-- Initials("AZ") will be displayed instead of the icon. -->
    
    <igc-avatar initials="AZ">
      <igc-icon name="home"></igc-icon>
    </igc-avatar>
    html

    EXAMPLE
    TS
    HTML
    CSS

    영상

    src 속성에 정적 자산에 대한 유효한 URL이 할당되면 아바타는 이미지를 표시할 수도 있습니다. 이 경우 initials 값은 무시되고 하위 요소는 렌더링되지 않습니다.

    <igc-avatar
      initials="AZ"
      src="https://ko.infragistics.com/angular-demos/assets/images/men/1.jpg"
      alt="A photo of a man.">
      <igc-icon name="home"></igc-icon>
    </igc-avatar>
    html

    EXAMPLE
    TS
    HTML
    CSS

    모양

    아바타는 circle, rounded, square의 세 가지 모양을 지원합니다. 아바타의 기본 모양은 square 이며 shape 속성을 통해 변경할 수 있습니다.

    EXAMPLE
    TS
    HTML
    CSS

    크기

    모양 외에도--ig-size CSS 변수를 활용하여 아바타의 크기를 변경할 수도 있습니다. 지원되는 크기는 small (기본값), mediumlarge 입니다. 다음 코드 조각은 다양한 구성요소 크기를 사용하는 방법을 보여줍니다.

    igc-avatar {
      --ig-size: var(--ig-size-large);
    }
    css

    EXAMPLE
    TS
    HTML
    AvatarSize.css
    index.css

    스타일링

    The IgcAvatarComponent component exposes several CSS parts, giving you full control over its style:

    이름 설명
    base The base wrapper of the avatar.
    initials The initials wrapper of the avatar.
    image The image wrapper of the avatar.
    icon The icon wrapper of the avatar.
    igc-avatar::part(base) {
      --size: 60px;
      color: var(--ig-success-500-contrast);
      background: var(--ig-success-500);;
      border-radius: 20px;
    }
    css

    EXAMPLE

    Ignite UI for Web Components | CTA 배너

    API 참조

    추가 리소스