ChangelogVersions 변경 이력 버전
여러 버전의 변경 이력을 타임라인 형태로 표시하는 컴포넌트예요. 기본 슬롯 또는 versions prop으로 ChangelogVersion 컴포넌트 목록을 유연하게 배치할 수 있어요.
출처: Nuxt UI
본문
변경 이력 버전 목록을 타임라인으로 표시해요.
사용법 (Usage)
ChangelogVersions 컴포넌트는 기본 슬롯이나 versions prop을 이용해 ChangelogVersion 컴포넌트 목록을 유연하게 배치할 수 있는 레이아웃을 제공해요.
<template>
<UChangelogVersions>
<UChangelogVersion
v-for="(version, index) in versions"
:key="index"
v-bind="version"
/>
</UChangelogVersions>
</template>
Versions
versions prop에 ChangelogVersion 컴포넌트의 속성들을 가진 객체 배열을 전달해요.
<script setup lang="ts">
import type { ChangelogVersionProps } from '@nuxt/ui'
const versions = ref<ChangelogVersionProps[]>([
{
title: "Nuxt 3.17",
description: "Nuxt 3.17 is out - bringing a major reworking of the async data layer, a new built-in component, better warnings, and performance improvements!",
image: "https://nuxt.com/assets/blog/v3.17.png",
date: "2025-04-27",
to: "https://nuxt.com/blog/v3-17",
target: "_blank",
ui: {
container: "max-w-lg"
}
},
{
title: "Nuxt 3.16",
description: "Nuxt 3.16 is out - packed with features and performance improvements!",
image: "https://nuxt.com/assets/blog/v3.16.png",
date: "2025-03-07",
to: "https://nuxt.com/blog/v3-16",
target: "_blank",
ui: {
container: "max-w-lg"
}
},
{
title: "Nuxt 3.15",
description: "Nuxt 3.15 is out - with Vite 6, better HMR and faster performance!",
image: "https://nuxt.com/assets/blog/v3.15.png",
date: "2024-12-24",
to: "https://nuxt.com/blog/v3-15",
target: "_blank",
ui: {
container: "max-w-lg"
}
}
])
</script>
<template>
<UChangelogVersions :versions="versions" />
</template>
Indicator
indicator prop을 이용해 왼쪽의 표시 막대(indicator bar)를 숨길 수 있어요. 기본값은 true예요.
<script setup lang="ts">
import type { ChangelogVersionProps } from '@nuxt/ui'
const versions = ref<ChangelogVersionProps[]>([
{
title: "Nuxt 3.17",
description: "Nuxt 3.17 is out - bringing a major reworking of the async data layer, a new built-in component, better warnings, and performance improvements!",
image: "https://nuxt.com/assets/blog/v3.17.png",
date: "2025-04-27",
to: "https://nuxt.com/blog/v3-17",
target: "_blank",
ui: {
container: "max-w-lg"
}
},
{
title: "Nuxt 3.16",
description: "Nuxt 3.16 is out - packed with features and performance improvements!",
image: "https://nuxt.com/assets/blog/v3.16.png",
date: "2025-03-07",
to: "https://nuxt.com/blog/v3-16",
target: "_blank",
ui: {
container: "max-w-lg"
}
},
{
title: "Nuxt 3.15",
description: "Nuxt 3.15 is out - with Vite 6, better HMR and faster performance!",
image: "https://nuxt.com/assets/blog/v3.15.png",
date: "2024-12-24",
to: "https://nuxt.com/blog/v3-15",
target: "_blank",
ui: {
container: "max-w-lg"
}
}
])
</script>
<template>
<UChangelogVersions :indicator="false" :versions="versions" />
</template>
Indicator Motion
indicator-motion prop을 이용해 표시 막대의 모션 효과를 커스터마이즈하거나 숨길 수 있어요. 기본값은 { damping: 30, restDelta: 0.001 } 스프링 전환 옵션을 사용하는 true예요.
<script setup lang="ts">
import type { ChangelogVersionProps } from '@nuxt/ui'
const versions = ref<ChangelogVersionProps[]>([
{
title: "Nuxt 3.17",
description: "Nuxt 3.17 is out - bringing a major reworking of the async data layer, a new built-in component, better warnings, and performance improvements!",
image: "https://nuxt.com/assets/blog/v3.17.png",
date: "2025-04-27",
to: "https://nuxt.com/blog/v3-17",
target: "_blank",
ui: {
container: "max-w-lg"
}
},
{
title: "Nuxt 3.16",
description: "Nuxt 3.16 is out - packed with features and performance improvements!",
image: "https://nuxt.com/assets/blog/v3.16.png",
date: "2025-03-07",
to: "https://nuxt.com/blog/v3-16",
target: "_blank",
ui: {
container: "max-w-lg"
}
},
{
title: "Nuxt 3.15",
description: "Nuxt 3.15 is out - with Vite 6, better HMR and faster performance!",
image: "https://nuxt.com/assets/blog/v3.15.png",
date: "2024-12-24",
to: "https://nuxt.com/blog/v3-15",
target: "_blank",
ui: {
container: "max-w-lg"
}
}
])
</script>
<template>
<UChangelogVersions indicator-motion :versions="versions" />
</template>
예시 (Examples)
[!NOTE]
이 예시들은 Nuxt Content를 사용하지만, 컴포넌트는 어떤 콘텐츠 관리 시스템과도 통합할 수 있어요.
페이지 안에서 (Within a page)
페이지 안에 ChangelogVersions 컴포넌트를 사용해 변경 이력 페이지를 만들 수 있어요.
<script setup lang="ts">
const { data: versions } = await useAsyncData('versions', () => queryCollection('versions').all())
</script>
<template>
<UPage>
<UPageHero title="Changelog" />
<UPageBody>
<UChangelogVersions>
<UChangelogVersion
v-for="(version, index) in versions"
:key="index"
v-bind="version"
:to="version.path"
/>
</UChangelogVersions>
</UPageBody>
</UPage>
</template>
[!NOTE]
이 예시에서
versions는@nuxt/content모듈의queryCollection을 이용해 가져와요.
[!TIP]
여기서는
@nuxt/content가path속성을 사용하기 때문에toprop을 덮어쓰고 있어요.
고정표시 막대 사용하기 (With sticky indicator)
ui prop과 다양한 슬롯을 이용해 표시 막대를 고정(sticky)시킬 수 있어요.
<script setup lang="ts">
const versions = [{
title: 'Nuxt 3.17',
description: 'Nuxt 3.17 is out - bringing a major reworking of the async data layer, a new built-in component, better warnings, and performance improvements!',
date: '2025-04-27T00:00:00.000Z',
image: 'https://nuxt.com/assets/blog/v3.17.png',
badge: 'v3.17.0',
to: 'https://nuxt.com/blog/nuxt-3-17',
target: '_blank',
authors: [{
name: 'Daniel Roe',
avatar: {
src: 'https://github.com/danielroe.png',
alt: 'Daniel Roe',
loading: 'lazy' as const
},
to: 'https://github.com/danielroe',
target: '_blank'
}]
}, {
title: 'Nuxt 3.16',
description: 'Nuxt 3.16 is out - packed with features and performance improvements!',
date: '2024-03-07T00:00:00.000Z',
image: 'https://nuxt.com/assets/blog/v3.16.png',
badge: 'v3.16.0',
to: 'https://nuxt.com/blog/v3-16',
target: '_blank',
authors: [{
name: 'Daniel Roe',
avatar: {
src: 'https://github.com/danielroe.png',
alt: 'Daniel Roe',
loading: 'lazy' as const
},
to: 'https://github.com/danielroe',
target: '_blank'
}]
}, {
title: 'Nuxt 3.15',
description: 'Nuxt 3.15 is out - with Vite 6, better HMR and faster performance!',
date: '2024-12-24T00:00:00.000Z',
image: 'https://nuxt.com/assets/blog/v3.15.png',
badge: 'v3.15.0',
to: 'https://nuxt.com/blog/v3-15',
target: '_blank',
authors: [{
name: 'Daniel Roe',
avatar: {
src: 'https://github.com/danielroe.png',
alt: 'Daniel Roe',
loading: 'lazy' as const
},
to: 'https://github.com/danielroe',
target: '_blank'
}]
}]
</script>
<template>
<UChangelogVersions :indicator="false">
<UChangelogVersion
v-for="version in versions"
:key="version.title"
v-bind="version"
:badge="undefined"
class="flex items-start"
:ui="{
container: 'max-w-lg me-0',
indicator: 'sticky top-(--ui-header-height) pt-4 -mt-4 flex flex-col items-end'
}"
>
<template #indicator>
<UBadge :label="version.badge" variant="soft" />
<span class="text-sm text-muted">{{ new Date(version.date).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric' }) }}</span>
</template>
</UChangelogVersion>
</UChangelogVersions>
</template>
스크롤 컨테이너 사용하기 4.4+ (With scroll container)
indicator prop에 객체를 전달해 스크롤 컨테이너를 설정할 수 있어요. 기본적으로 표시 막대는 창/페이지 스크롤을 추적해요 (https://motion.dev/docs/vue-use-scroll#page-scroll).
<script setup lang="ts">
const scrollContainer = ref<HTMLElement>()
</script>
<template>
<div ref="scrollContainer" class="max-h-96 overflow-y-auto">
<UChangelogVersions v-if="scrollContainer" :indicator="{ container: scrollContainer }" />
</div>
</template>
[!WARNING]
커스텀
container를 사용할 때는UChangelogVersions보다 컨테이너 요소가 먼저 마운트되어 있는지 확인하세요.
API
Props
/**
* Props for the ChangelogVersions component
*/
interface ChangelogVersionsProps {
/**
* The element or component this component should render as.
* @default 'div'
*/
as?: any;
versions?: T[] | undefined;
/**
* Display an indicator bar on the left.
* By default, the indicator will track the scroll of the page. (https://motion.dev/docs/vue-use-scroll#page-scroll)
* @default true
*/
indicator?: boolean | UseScrollOptions | undefined;
/**
* Enable scrolling motion effect on the indicator bar.
* `{ damping: 30, restDelta: 0.001 }`{lang="ts-type"}
* @default true
*/
indicatorMotion?: boolean | SpringOptions | undefined;
ui?: { root?: SlotClass; container?: SlotClass; indicator?: SlotClass; beam?: SlotClass; } | undefined;
}
Slots
/**
* Slots for the ChangelogVersions component
*/
interface ChangelogVersionsSlots {
header(): any;
badge(): any;
date(): any;
title(): any;
description(): any;
image(): any;
body(): any;
footer(): any;
authors(): any;
actions(): any;
indicator(): any;
default(): any;
}
[!TIP]
ChangelogVersions 안에서
ChangelogVersion컴포넌트의 모든 슬롯을 사용할 수 있어요. 이 슬롯들은 자동으로 전달되므로,versionsprop을 사용할 때 각 버전을 개별적으로 커스터마이즈할 수 있어요.<template> <UChangelogVersions :versions="versions"> <template #body="{ version }"> <Markdown :value="version.content" /> </template> </UChangelogVersions> </template>
테마 (Theme)
export default defineAppConfig({
ui: {
changelogVersions: {
slots: {
root: 'relative',
container: 'flex flex-col gap-y-8 sm:gap-y-12 lg:gap-y-16',
indicator: 'absolute hidden lg:block overflow-hidden inset-y-3 start-32 h-full w-px bg-border -ms-[8.5px]',
beam: 'absolute start-0 top-0 w-full bg-primary will-change-[height]'
}
}
}
})