21st.dev 원본
Radial Glow Background · Blue
배경 · MIT
갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.
저장한 HTML에서는 갤러리의 재생 설정이 적용되지 않아요.
SOURCE FILES
원본 코드 읽기
수집한 원본 소스와 실행 안내를 함께 제공합니다. 실행 HTML에는 미리보기를 위한 실행 환경이 들어 있습니다.
blue-radial-glow.jsx
<div className="min-h-screen w-full bg-[#0f172a] relative">
{/* Blue Radial Glow Background */}
<div
className="absolute inset-0 z-0"
style={{
backgroundImage: `radial-gradient(circle 600px at 50% 50%, rgba(59,130,246,0.3), transparent)`,
}}
/>
{/* Your Content/Components */}
</div>LICENSE
MIT License
Copyright (c) 2025 Megh Bari
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
함께 쓰는 파일 6개 보기
Usage.tsx실행 안내·자료
// Local module wrapper. The following JSX fragment is byte-identical to the included original.
// Preserve the adjacent MIT LICENSE when reusing it.
export default function Demo() {
return (
<div className="min-h-screen w-full bg-[#0f172a] relative">
{/* Blue Radial Glow Background */}
<div
className="absolute inset-0 z-0"
style={{
backgroundImage: `radial-gradient(circle 600px at 50% 50%, rgba(59,130,246,0.3), transparent)`,
}}
/>
{/* Your Content/Components */}
</div>
);
}
runtime/mount.tsx실행 안내·자료
/** Local sandbox host. Ready is a mount observation, never a verification result. */
import React, { Component, useEffect } from 'react';
import { createRoot } from 'react-dom/client';
declare global {
interface Window {
__STYLEGALLERY_PREVIEW__: { id: string; status: string; errors: string[] };
}
}
export function mount(Demo: React.ComponentType, id: string) {
const state = window.__STYLEGALLERY_PREVIEW__ = { id, status: 'loading', errors: [] as string[] };
const send = (message: object) => parent.postMessage({ ...message, id }, '*');
const report = (error: unknown) => {
const message = error instanceof Error ? error.message : String(error);
if (!state.errors.includes(message)) state.errors.push(message);
state.status = 'error';
document.body.dataset.previewStatus = 'error';
send({ type: 'sg-preview-error', message });
};
window.addEventListener('error', (event) => report(event.error ?? event.message));
window.addEventListener('unhandledrejection', (event) => report(event.reason));
window.addEventListener('securitypolicyviolation', (event) => report(`Blocked by preview policy: ${event.violatedDirective}`));
const theme = new URLSearchParams(location.search).get('theme') === 'dark' ? 'dark' : 'light';
document.documentElement.classList.toggle('dark', theme === 'dark');
document.documentElement.dataset.theme = theme;
const observe = () => {
const root = document.getElementById('root')!;
const elements = Array.from(root.querySelectorAll('*'));
const rect = root.getBoundingClientRect();
const diagnostics = {
textLength: (root.textContent ?? '').trim().length,
elementCount: elements.length,
visibleElementCount: elements.filter((element) => {
const bounds = element.getBoundingClientRect();
const style = getComputedStyle(element);
return bounds.width > 0 && bounds.height > 0 && style.display !== 'none' && style.visibility !== 'hidden' && Number(style.opacity) !== 0;
}).length,
images: [],
canvases: [],
rootRect: { width: rect.width, height: rect.height },
documentWidth: document.documentElement.scrollWidth,
viewportWidth: innerWidth,
};
send({ type: 'sg-preview-observation', diagnostics });
};
class Boundary extends Component<{ children: React.ReactNode }, { error: string | null }> {
state = { error: null as string | null };
static getDerivedStateFromError(error: Error) { return { error: error.message }; }
componentDidCatch(error: Error) { report(error); }
render() { return this.state.error ? <p role="alert">This preview could not render: {this.state.error}</p> : this.props.children; }
}
function Ready() {
useEffect(() => {
const preference = matchMedia('(prefers-reduced-motion: reduce)');
const syncSVG = () => document.querySelectorAll('svg').forEach((svg) => {
if (preference.matches) svg.pauseAnimations?.();
else svg.unpauseAnimations?.();
});
syncSVG();
preference.addEventListener('change', syncSVG);
let second = 0;
let delayed = 0;
const first = requestAnimationFrame(() => { second = requestAnimationFrame(() => {
if (state.status !== 'error') {
state.status = 'mounted';
document.body.dataset.previewStatus = 'mounted';
send({ type: 'sg-preview-ready' });
observe();
delayed = window.setTimeout(observe, 700);
}
}); });
return () => {
cancelAnimationFrame(first);
cancelAnimationFrame(second);
clearTimeout(delayed);
preference.removeEventListener('change', syncSVG);
};
}, []);
return <Demo />;
}
createRoot(document.getElementById('root')!).render(<Boundary><Ready /></Boundary>);
}
runtime/styles.css실행 안내·자료
@import "tailwindcss";
@custom-variant dark (&:where(.dark, .dark *));
@theme inline {
--color-foreground: var(--foreground);
}
:root {
--foreground: #172033;
background: #f8fafc;
color: var(--foreground);
color-scheme: light;
font-family: Arial, sans-serif;
}
:root.dark {
--foreground: #e2e8f0;
background: #0f172a;
color-scheme: dark;
}
body {
margin: 0;
min-height: 100vh;
}
#root {
min-height: 100vh;
}
#root[data-kind="spinner"] {
align-items: center;
box-sizing: border-box;
display: flex;
justify-content: center;
padding: 24px;
}
.spinner-sampler {
display: grid;
gap: 36px 24px;
grid-template-columns: repeat(2, minmax(0, 1fr));
max-width: 600px;
width: 100%;
}
.spinner-sample {
align-items: center;
display: flex;
flex-direction: column;
gap: 16px;
justify-content: center;
min-width: 0;
}
.spinner-label {
font-family: ui-monospace, monospace;
font-size: 11px;
overflow-wrap: anywhere;
text-align: center;
}
noscript {
display: block;
padding: 24px;
}
@media (min-width: 480px) {
.spinner-sampler {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after {
animation-play-state: paused !important;
}
}
THIRD-PARTY-LICENSES.txt실행 안내·자료
react 19.1.1 — LICENSE
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
========================================================================
react-dom 19.1.1 — LICENSE
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
========================================================================
scheduler 0.26.0 — LICENSE
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
provenance.json실행 안내·자료
{
"id": "21st-cd00cba61362",
"sourceRevision": "1550af7903f50b4f19a1b44786f27ca01f3ef6ab",
"license": "MIT",
"files": [
{
"file": "blue-radial-glow.jsx",
"sha256": "6e41caf5fff73ee1d5d7cb3506db5704ff336b8fdba698a96793c5a002ee77e7",
"kind": "jsx-fragment",
"sourcePath": "src/data/patterns.ts"
},
{
"file": "LICENSE",
"sha256": "939281af86bbfb04989214783a8c502ea263c5b7e4439fbcac6b02d0792120ca",
"kind": "license",
"sourcePath": "LICENSE"
}
],
"adaptations": [
"The original JSX fragment is wrapped in a React function without changing its JSX, classes, or inline styles."
],
"runtimeDependencies": {
"react": "19.1.1",
"react-dom": "19.1.1",
"scheduler": "0.26.0"
},
"runtime_verified": false
}
README.md실행 안내·자료
# Radial Glow Background · Blue
Original implementation revision: `1550af7903f50b4f19a1b44786f27ca01f3ef6ab`. Preserve the included MIT LICENSE. Original modules are byte-identical to their acquired sources. Usage.tsx and runtime/* are local integration support.
- The original JSX fragment is wrapped in a React function without changing its JSX, classes, or inline styles.
The standalone HTML includes all runtime JavaScript, CSS, and dependency notices. Open it directly to view the example; add ?theme=dark or ?theme=light to select the host theme. The two radial backgrounds keep their original fixed colors in either host theme. No external requests, storage, cookies, navigation, or provider app is needed.
To integrate source, use React 19, Tailwind CSS 4, and the included Usage.tsx. Kibo Spinner also needs lucide-react, clsx, and tailwind-merge; resolve @repo/shadcn-ui/ to packages/shadcn-ui/ and @/lib/utils to packages/shadcn-ui/lib/utils.ts. The supplied runtime styles define foreground tokens and the demo layout. Runtime dependency versions are recorded in provenance.json and their notices in THIRD-PARTY-LICENSES.txt.
The ready bridge signals a React mount, not verified behavior. Compilation and source integrity have been checked; browser behavior and accessibility remain unverified here.
BEHIND THE EXAMPLE
이 장면을 만드는 원리
부모가 바뀌어도 반경은 고정
반응형 표현은 실제 부모 크기와 콘텐츠 조건에서 관찰하고, 값의 단위를 구분합니다.
- 이 예제에서는
- 푸른 배경은 중심이 50% 50%라 영역의 중앙을 기준으로 합니다. 반경은 600px로 고정이며 색의 알파는 0.3입니다. 중심이 비율 좌표라고 해서 빛의 크기까지 비율로 확대되는 구현은 아닙니다.
코드와 함께 확인하기
코드에서 찾기
circle 600px at 50% 50%blue-radial-glow.jsx두 중심 좌표는 비율이고 원의 반경은 CSS 길이입니다.
직접 해보기
미리보기를 세로로 긴 영역과 가로로 긴 영역에서 비교합니다.
살펴볼 변화중앙 기준과 고정 반경이 만드는 분포를 확인합니다. 화면 크기마다 같은 비율의 조명을 만든다고 단정하지 않습니다.
색상 배경은 완성된 화면이 아니다
장식 표면과 콘텐츠 의미, 입력, 상태의 계약을 분리합니다.
- 이 예제에서는
- 원본은 bg-[#0f172a] 부모와 그라데이션 자식뿐입니다. min-h-screen은 임베드된 문서의 뷰포트를 기준으로 최소 높이를 만들고, 테마 변경용 변수나 상태는 없습니다. 이 갤러리에서도 배경 자체의 색은 호스트 테마와 무관하게 원본을 유지합니다.
코드와 함께 확인하기
코드에서 찾기
min-h-screen w-full bg-[#0f172a] relativeblue-radial-glow.jsx최소 높이와 고정 바탕색은 원본 클래스에서 정합니다.
document.documentElement.classList.togglemount.tsx테마는 로컬 호스트에만 적용되며 원본의 고정 색을 다시 쓰지 않습니다.
직접 해보기
호스트 테마를 밝게·어둡게 바꾸어 비교합니다.
살펴볼 변화원본의 남색·푸른 그라데이션은 유지됩니다. 제품에서 테마별 색을 원하면 별도 입력 계약을 추가해야 합니다.
로컬 소스에 긴 문구와 링크를 넣고 배경과 함께 확인합니다.
살펴볼 변화문구의 대비와 링크의 초점·입력 가능성을 실제 콘텐츠로 검토해야 합니다. 빈 배경에는 이 검증 대상이 없습니다.
