React Button Group 개요

    React Button Group 구성 요소는 가로/세로 정렬, 단일/다중 선택 및 토글이 있는 스타일이 지정된 버튼 그룹으로 구성하는 IgrToggleButton 데 사용됩니다.

    React Button Example

    Usage

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

    npm install igniteui-react
    

    그런 다음 필요한 CSS를 IgrButtonGroup 가져 와서 다음과 같이 모듈을 등록해야합니다.

    import { IgrButtonGroupModule, IgrButtonGroup } from 'igniteui-react';
    import 'igniteui-webcomponents/themes/light/bootstrap.css';
    
    IgrButtonModule.register();
    

    Ignite UI for React 에 대한 전체 소개는 시작하기 항목을 참조하세요.

    이제 Ignite UI for React Button Group을 가져왔으므로 및 해당 버튼의 IgrButtonGroup 기본 구성부터 시작할 수 있습니다.

    선택기를 IgrButtonGroup 사용하여 s를 IgrToggleButton 래핑하고 버튼 그룹에 표시합니다. 버튼이 기본적으로 선택되도록 하려면 다음 속성을 사용합니다. selected

    <IgrButtonGroup>
        <IgrToggleButton value="left" key="button-left">
            <IgrIcon name="format_align_left" collection="material" key="icon-left" />
            <IgrRipple key="ripple-left" />
        </IgrToggleButton>
        <IgrToggleButton value="center" key="button-center">
            <IgrIcon name="format_align_center" collection="material" key="icon-center" />
            <IgrRipple key="ripple-center" />
        </IgrToggleButton>
        <IgrToggleButton value="right" key="button-right">
            <IgrIcon name="format_align_right" collection="material" key="icon-right" />
            <IgrRipple key="ripple-right" />
        </IgrToggleButton>
        <IgrToggleButton value="justify" selected={true} key="button-justify">
            <IgrIcon name="format_align_justify" collection="material" key="icon-justify" />
            <IgrRipple key="ripple-justify" />
        </IgrToggleButton>
    </IgrButtonGroup>
    

    Examples

    Alignment

    alignment 속성을 사용하여 단추 그룹에 있는 단추의 방향을 설정할 수 있습니다.

    선택

    Ignite UI for React IgrButtonGroup 선택을 구성하려면 해당 selection 속성을 사용할 수 있습니다. 이 속성은 다음과 같은 세 가지 모드를 허용합니다.

    • 단일- 버튼 그룹의 기본 선택 모드입니다. 사용자는 하나의 버튼을 선택/선택 취소할 수 있습니다.
    • single-required- 라디오 그룹 동작을 모방합니다. 하나의 버튼만 선택할 수 있으며 초기 선택이 이루어지면 사용자 상호 작용을 통해 선택을 취소할 수 없습니다.
    • 여러 - 그룹에서 여러 버튼을 선택하거나 선택 취소할 수 있습니다.

    아래 샘플은 노출 IgrButtonGroup 된 선택 모드를 보여줍니다.

    A IgrToggleButton는 해당 selected 속성 또는 다음을 통해 선택된 것으로 표시될 수 있습니다. IgrButtonGroup selectedItems 속성:

    <IgrButtonGroup selectedItems={['bold']}>
        <IgrToggleButton value="bold" key="button-bold">
            <IgrIcon name="bold" collection="material" key="icon-bold" />
            <IgrRipple key="ripple-bold" />
        </IgrToggleButton>
        <IgrToggleButton value="italic" key="button-italic">
            <IgrIcon name="italic" collection="material" key="icon-italic" />
            <IgrRipple key="ripple-italic" />
        </IgrToggleButton>
        <IgrToggleButton value="underlined" key="button-underlined">
            <IgrIcon name="underlined" collection="material" key="icon-underlined" />
            <IgrRipple key="ripple-underlined" />
        </IgrToggleButton>
    </IgrButtonGroup>
    

    [!Note] Setting IgrToggleButton value attribute is mandatory for using the selectedItems property of the IgrButtonGroup.

    크기

    --ig-size CSS 사용자 정의 속성을 사용하여 버튼 그룹의 크기를 제어할 수 있습니다.

    Styling

    IgrButtonGroup 구성 요소는 버튼 그룹 컨테이너의 스타일을 지정할 수 있는 CSS 부분을 노출 group 합니다. 또한 s는 IgrToggleButton 버튼 요소의 스타일을 지정하는 데 사용할 수 있는 CSS 부분을 제공합니다 toggle.

    API Reference

    Additional Resources