07스켈레톤 → 내용 전환
막대가 실제 내용으로 부드럽게 바뀐다. 튀지 않게.
쓰임모든 스켈레톤의 마지막 장면
300ms위로 살짝페이드만

<main class="stage">
<div class="card">
<div class="skeleton">
<div class="bar b1"></div>
<div class="bar b2"></div>
<div class="bar b3"></div>
</div>
<div class="content">
<p class="t1">스켈레톤이 실제 내용으로</p>
<p class="t2">부드럽게 바뀝니다</p>
</div>
</div>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: $dur-loop; // 막대 ↔ 내용 한 바퀴
$easing: $ease-out;
$color: $subject-cream; // 내용 글자·막대 색 (주황 무대라 크림)
@include stage($stage-orange);
.card {
width: clamp(200px, 74%, 320px);
display: grid; // 두 레이어를 같은 칸에 겹친다
}
.skeleton, .content {
grid-area: 1 / 1;
display: grid;
gap: clamp(8px, 2.6vw, 10px);
align-content: center;
}
// ── 막대: 튀지 않게 페이드만 ──────────────────────────
.skeleton {
animation: fade-out $duration $easing infinite;
}
.bar { height: clamp(11px, 3.4vw, 14px); border-radius: $r-control; background: rgba($color, .35); }
.bar.b1 { width: 90%; }
.bar.b2 { width: 70%; }
.bar.b3 { width: 50%; }
@keyframes fade-out {
0%, 40% { opacity: 1; }
55%, 85% { opacity: 0; }
100% { opacity: 1; }
}
// ── 내용: 페이드 + 위로 살짝 (300ms) ───────────────────
.content {
color: $color;
font: 600 clamp(13px, 3.6vw, 16px)/1.4 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
animation: fade-in $duration $easing infinite;
}
.content p { margin: 0; }
@keyframes fade-in {
0%, 40% { opacity: 0; transform: translateY(6px); }
55%, 85% { opacity: 1; transform: translateY(0); }
100% { opacity: 0; transform: translateY(6px); }
}
// ── 접근성: 전환 반복을 멈추고 내용이 보이는 상태로 고정 ──────
@media (prefers-reduced-motion: reduce) {
.skeleton { display: none; }
.content { animation: none !important; opacity: 1; transform: translateY(0); }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #ff4d1f;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.card {
width: clamp(200px, 74%, 320px);
display: grid;
}
.skeleton, .content {
grid-area: 1/1;
display: grid;
gap: clamp(8px, 2.6vw, 10px);
align-content: center;
}
.skeleton {
animation: fade-out 2s ease-out infinite;
}
.bar {
height: clamp(11px, 3.4vw, 14px);
border-radius: 12px;
background: rgba(255, 247, 230, 0.35);
}
.bar.b1 {
width: 90%;
}
.bar.b2 {
width: 70%;
}
.bar.b3 {
width: 50%;
}
@keyframes fade-out {
0%, 40% {
opacity: 1;
}
55%, 85% {
opacity: 0;
}
100% {
opacity: 1;
}
}
.content {
color: #fff7e6;
font: 600 clamp(13px, 3.6vw, 16px)/1.4 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
animation: fade-in 2s ease-out infinite;
}
.content p {
margin: 0;
}
@keyframes fade-in {
0%, 40% {
opacity: 0;
transform: translateY(6px);
}
55%, 85% {
opacity: 1;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(6px);
}
}
@media (prefers-reduced-motion: reduce) {
.skeleton {
display: none;
}
.content {
animation: none !important;
opacity: 1;
transform: translateY(0);
}
}import type { CSSProperties, ReactNode } from "react";
import styles from "./SkeletonToContent.module.scss";
export type SkeletonToContentProps = {
loading: boolean;
children: ReactNode;
/** 막대 ↔ 내용 전환 시간 (기본 300ms) */
duration?: number;
easing?: string;
color?: string;
className?: string;
};
export default function SkeletonToContent({
loading,
children,
duration = 300,
easing = "ease-out",
color = "#fff7e6",
className = "",
}: SkeletonToContentProps) {
const vars = { "--duration": `${duration}ms`, "--easing": easing, "--color": color } as CSSProperties;
return (
<div className={`${styles.card} ${className}`} style={vars} aria-busy={loading}>
<div className={`${styles.skeleton} ${loading ? "" : styles.hide}`} aria-hidden={!loading}>
<div className={styles.bar} style={{ width: "90%" } as CSSProperties} />
<div className={styles.bar} style={{ width: "70%" } as CSSProperties} />
<div className={styles.bar} style={{ width: "50%" } as CSSProperties} />
</div>
<div className={`${styles.content} ${loading ? styles.hide : ""}`}>{children}</div>
</div>
);
}07 스켈레톤 → 내용 전환 — 측정 누적면적 8.035% · 움직인 프레임 7/23GODRICH 원작 · zip 에 SCSS·React 포함 · 스켈레톤 UI CSS 9종 — 복붙하면 되는 로딩 화면
이 데모가 속한 글
스켈레톤 UI CSS 9종 — 복붙하면 되는 로딩 화면스켈레톤 UI CSS는 실제 글자·이미지가 도착하기 전에 그 자리를 회색 막대나 동그라미로 미리 그려 두는 로딩 방식입니다. 빈 화면이나 뱅글뱅글 도는 스피너보다 "곧 뭔가 나온다"는 확신을 먼저 줍니다. 아래 아홉 이 글의 데모 전부 보기


