01Spinner vòng tròn cơ bản
Một viền tròn với một cạnh tô màu khác xoay liên tục để báo đang tải.
Dùng choTải toàn trang, màn hình chờ sau khi nhấn nút
1초 회전border 4px단색

<main class="stage">
<div class="spinner" role="status" aria-label="Đang tải"></div>
</main>@use "../../../../site/static/demo-tokens" as *;
$duration: 1s; // 한 바퀴 도는 시간
$easing: linear; // 등속
$color: $subject-blue; // 진한 구간 색
@include stage($stage-ink);
.spinner {
width: clamp(48px, 14vw, 72px);
height: clamp(48px, 14vw, 72px);
border-radius: 50%;
border: 6px solid rgba($subject-cream, .22);
border-top-color: $color; // 위쪽 한 변만 진하게
animation: spin $duration $easing infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
.spinner { animation: none; border-top-color: rgba($subject-cream, .22); }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #17141a;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.spinner {
width: clamp(48px, 14vw, 72px);
height: clamp(48px, 14vw, 72px);
border-radius: 50%;
border: 6px solid rgba(255, 247, 230, 0.22);
border-top-color: #2f6df6;
animation: spin 1s linear infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: reduce) {
.spinner {
animation: none;
border-top-color: rgba(255, 247, 230, 0.22);
}
}import type { CSSProperties } from "react";
import styles from "./RingSpinner.module.scss";
export type RingSpinnerProps = {
/** 스피너 지름 (기본 56px) */
size?: number;
/** 한 바퀴 도는 시간 (기본 1000ms) */
duration?: number;
/** 진한 구간 색 */
color?: string;
/** 접근성 라벨 */
label?: string;
};
type Vars = CSSProperties & { "--size"?: string; "--duration"?: string; "--color"?: string };
export default function RingSpinner({
size = 56,
duration = 1000,
color = "#2f6df6",
label = "Loading",
}: RingSpinnerProps) {
const vars: Vars = {
"--size": `${size}px`,
"--duration": `${duration}ms`,
"--color": color,
};
return <div className={styles.spinner} style={vars} role="status" aria-label={label} />;
}01 Spinner vòng tròn cơ bản — Diện tích đo được 1.248% · khung hình chuyển động 23/23Nguyên tác GODRICH · SCSS và React nằm trong tệp zip · 9 hiệu ứng css loading spinner animation gọn nhẹ
Bài viết chứa demo này
9 hiệu ứng css loading spinner animation gọn nhẹCSS loading spinner animation là một khối nhỏ tự xoay, tự nảy hoặc tự đổi độ sáng bằng thuần CSS để báo cho người dùng b Xem tất cả demo trong bài này


