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

코드 그룹

원문 보기 위키 갱신

코드 그룹 (ProseCodeGroup)

ProseCodeGroup은 여러 코드 예시를 탭 인터페이스로 묶어서 쉽게 비교할 수 있게 해주는 타이포그래피 컴포넌트예요.

출처: Nuxt UI

본문

사용법 (Usage)

코드 블록들을 code-group 컴포넌트로 감싸면 탭으로 묶어서 보여줄 수 있어요.

::code-group

```bash [pnpm]
pnpm add @nuxt/ui
```

```bash [yarn]
yarn add @nuxt/ui
```

```bash [npm]
npm install @nuxt/ui
```

```bash [bun]
bun add @nuxt/ui
```

::

[!NOTE] See: /docs/typography/code#code-blocks

ProsePre 컴포넌트처럼 CodeGroup도 파일명, 아이콘, 복사 버튼을 처리해요.

API

Props

/**
 * Props for the ProseProseCodeGroup component
 */
interface ProseProseCodeGroupProps {
  /**
   * The default tab to select.
   * @default '0'
   */
  defaultValue?: string | undefined;
  /**
   * Sync the selected tab with a local storage key.
   */
  sync?: string | undefined;
  ui?: { root?: SlotClass; list?: SlotClass; indicator?: SlotClass; trigger?: SlotClass; triggerIcon?: SlotClass; triggerLabel?: SlotClass; } | undefined;
  modelValue?: string | undefined;
}

Slots

/**
 * Slots for the ProseCodeGroup component
 */
interface ProseCodeGroupSlots {
  default(): any;
}

테마 (Theme)

export default defineAppConfig({
  ui: {
    prose: {}
  }
})

더 알아보기 (Learn more)