본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Tabs

원문 보기 위키 갱신

탭 목록을 표시하고 사용자가 하나를 선택할 수 있게 해 주는 컴포넌트예요.

출처: 문서

본문

Tabs는 탭 목록을 표시하고 사용자가 하나를 선택할 수 있게 해 주는 컴포넌트예요.

사용법 (Usage)

import { Tabs } from '@primereact/ui/tabs';
<Tabs.Root>
    <Tabs.List>
        <Tabs.Prev></Tabs.Prev>
        <Tabs.Content>
            <Tabs.Tab></Tabs.Tab>
            <Tabs.Indicator />
        </Tabs.Content>
        <Tabs.Next></Tabs.Next>
    </Tabs.List>
    <Tabs.Panels>
        <Tabs.Panel></Tabs.Panel>
    </Tabs.Panels>
</Tabs.Root>

예제 (Examples)

기본 (Basic)

콘텐츠를 선택 가능한 가로로 배치된 섹션으로 정리해요.

동적 (Dynamic)

배열에서 탭을 만들어 라벨과 패널 콘텐츠를 동기화된 상태로 유지해요.

제어 (Controlled)

value와 onValueChange로 활성 탭을 제어해요.

스크롤 가능 (Scrollable)

scrollable을 켜면 길어진 탭 목록을 이전/다음 버튼으로 탐색할 수 있어요.

포커스 시 선택 (Select on Focus)

selectOnFocus를 설정하면 포커스 시 탭이 활성화돼요.

비활성 (Disabled)

Tabs.Tab에 disabled를 설정하면 선택을 막아요.

커스텀 인디케이터 (Custom Indicator)

Tabs.Indicator로 활성 탭 하이라이트 스타일을 커스터마이즈해요.

템플릿 (Template)

Tabs.Tab와 Tabs.Panel 안에 커스텀 마크업을 사용해 더 풍부한 탭 콘텐츠를 만들 수 있어요.

하위 컴포넌트 (Sub-Components)

TabsRoot, TabsList, TabsTab, TabsIndicator, TabsPanels, TabsPanel 컴포넌트 문서는 Primitive API에서 확인할 수 있어요.

훅 (Hooks)

useTabs 훅 문서는 Headless API에서 확인할 수 있어요.

접근성 (Accessibility)

WAI-ARIA 준수 상세와 키보드 지원은 Tabs Primitive에서 확인할 수 있어요.

테마 (Theming)

CSS 클래스 (CSS Classes)

styled 모드에서 사용하는 클래스 이름 목록이에요.

디자인 토큰 (Design Tokens)

디자인 토큰 목록이에요.

Token CSS Variable Description
tabs.transition.duration --p-tabs-transition-duration Transition duration of root
tabs.tablist.border.width --p-tabs-tablist-border-width Border width of tablist
tabs.tablist.background --p-tabs-tablist-background Background of tablist
tabs.tablist.border.color --p-tabs-tablist-border-color Border color of tablist
tabs.tab.background --p-tabs-tab-background Background of tab
tabs.tab.hover.background --p-tabs-tab-hover-background Hover background of tab
tabs.tab.active.background --p-tabs-tab-active-background Active background of tab
tabs.tab.border.width --p-tabs-tab-border-width Border width of tab
tabs.tab.border.color --p-tabs-tab-border-color Border color of tab
tabs.tab.hover.border.color --p-tabs-tab-hover-border-color Hover border color of tab
tabs.tab.active.border.color --p-tabs-tab-active-border-color Active border color of tab
tabs.tab.color --p-tabs-tab-color Color of tab
tabs.tab.hover.color --p-tabs-tab-hover-color Hover color of tab
tabs.tab.active.color --p-tabs-tab-active-color Active color of tab
tabs.tab.padding --p-tabs-tab-padding Padding of tab
tabs.tab.font.weight --p-tabs-tab-font-weight Font weight of tab
tabs.tab.font.size --p-tabs-tab-font-size Font size of tab
tabs.tab.margin --p-tabs-tab-margin Margin of tab
tabs.tab.gap --p-tabs-tab-gap Gap of tab
tabs.tab.focus.ring.width --p-tabs-tab-focus-ring-width Focus ring width of tab
tabs.tab.focus.ring.style --p-tabs-tab-focus-ring-style Focus ring style of tab
tabs.tab.focus.ring.color --p-tabs-tab-focus-ring-color Focus ring color of tab
tabs.tab.focus.ring.offset --p-tabs-tab-focus-ring-offset Focus ring offset of tab
tabs.tab.focus.ring.shadow --p-tabs-tab-focus-ring-shadow Focus ring shadow of tab
tabs.tabpanel.background --p-tabs-tabpanel-background Background of tabpanel
tabs.tabpanel.color --p-tabs-tabpanel-color Color of tabpanel
tabs.tabpanel.padding --p-tabs-tabpanel-padding Padding of tabpanel
tabs.tabpanel.focus.ring.width --p-tabs-tabpanel-focus-ring-width Focus ring width of tabpanel
tabs.tabpanel.focus.ring.style --p-tabs-tabpanel-focus-ring-style Focus ring style of tabpanel
tabs.tabpanel.focus.ring.color --p-tabs-tabpanel-focus-ring-color Focus ring color of tabpanel
tabs.tabpanel.focus.ring.offset --p-tabs-tabpanel-focus-ring-offset Focus ring offset of tabpanel
tabs.tabpanel.focus.ring.shadow --p-tabs-tabpanel-focus-ring-shadow Focus ring shadow of tabpanel
tabs.nav.button.background --p-tabs-nav-button-background Background of nav button
tabs.nav.button.color --p-tabs-nav-button-color Color of nav button
tabs.nav.button.hover.color --p-tabs-nav-button-hover-color Hover color of nav button
tabs.nav.button.width --p-tabs-nav-button-width Width of nav button
tabs.nav.button.focus.ring.width --p-tabs-nav-button-focus-ring-width Focus ring width of nav button
tabs.nav.button.focus.ring.style --p-tabs-nav-button-focus-ring-style Focus ring style of nav button
tabs.nav.button.focus.ring.color --p-tabs-nav-button-focus-ring-color Focus ring color of nav button
tabs.nav.button.focus.ring.offset --p-tabs-nav-button-focus-ring-offset Focus ring offset of nav button
tabs.nav.button.focus.ring.shadow --p-tabs-nav-button-focus-ring-shadow Focus ring shadow of nav button
tabs.nav.button.shadow --p-tabs-nav-button-shadow Shadow of nav button
tabs.active.bar.height --p-tabs-active-bar-height Height of active bar
tabs.active.bar.bottom --p-tabs-active-bar-bottom Bottom of active bar
tabs.active.bar.background --p-tabs-active-bar-background Background of active bar

더 알아보기 (Learn more)