코드 그룹
코드 그룹 (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: {}
}
})