ChatShimmer
텍스트에 샤이머(shimmer) 애니메이션 효과를 표시해 주는 컴포넌트예요.
출처: Nuxt UI
본문
사용법
ChatShimmer 컴포넌트는 텍스트 위에 애니메이션 샤이머 그라데이션이 흐르는 요소를 렌더링해요. 채팅 인터페이스에서 스트리밍이나 로딩 상태를 나타낼 때 주로 사용해요.
[!NOTE]
이 컴포넌트는 스트리밍 중에
ChatTool과ChatReasoning컴포넌트에서 자동으로 사용돼요.
[!TIP]
사용자가 축소된 동작(reduced motion)을 선호하면 애니메이션이 자동으로 비활성화되고, 텍스트는 정적인 음영(muted) 텍스트로 표시돼요.
Text
text prop으로 샤이머 텍스트를 설정해 주세요.
<template>
<UChatShimmer text="Thinking..." />
</template>
Duration
duration prop으로 애니메이션 속도를 초 단위로 조절할 수 있어요.
<template>
<UChatShimmer text="Thinking..." :duration="4" />
</template>
Spread
spread prop으로 샤이머 하이라이트의 폭을 조절할 수 있어요. 실제 spread는 text.length * spread(픽셀 단위)로 계산돼요.
<template>
<UChatShimmer text="Thinking..." :spread="5" />
</template>
예시
[!TIP] 참고: /docs/components/chat
Chat 개요 페이지에서 설치 방법, 서버 설정, 사용 예시를 확인해 주세요.
API
Props
/**
* Props for the ChatShimmer component
*/
interface ChatShimmerProps {
/**
* The text to display with the shimmer effect.
*/
text: string;
/**
* The element or component this component should render as.
* @default 'span'
*/
as?: any;
/**
* The duration of the shimmer animation in seconds.
* @default 2
*/
duration?: number | undefined;
/**
* The spread multiplier for the shimmer highlight. The actual spread is computed as `text.length * spread` in pixels.
* @default 2
*/
spread?: number | undefined;
ui?: {} | undefined;
}
테마
export default defineAppConfig({
ui: {
chatShimmer: {
base: 'text-transparent bg-clip-text bg-no-repeat bg-size-[calc(200%+var(--spread)*2+2px)_100%,auto] bg-[image:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--ui-text-highlighted),#0000_calc(50%+var(--spread))),linear-gradient(var(--ui-text-muted),var(--ui-text-muted))] motion-safe:animate-[shimmer_var(--duration)_linear_infinite] motion-safe:rtl:animate-[shimmer-rtl_var(--duration)_linear_infinite] will-change-[background-position] motion-reduce:bg-none motion-reduce:text-muted'
}
}
})
변경 기록
사이트맵
전체 페이지 목록은 사이트맵에서 확인할 수 있어요.