21st.dev 원본
Radial Glow Background · Gold
배경 · MIT
갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.
저장한 HTML에서는 갤러리의 재생 설정이 적용되지 않아요.
SOURCE FILES
원본 코드 읽기
수집한 원본 소스와 실행 안내를 함께 제공합니다. 실행 HTML에는 미리보기를 위한 실행 환경이 들어 있습니다.
gold-radial-glow.jsx
<div className="min-h-screen w-full bg-[#020617] relative">
{/* Gold Radial Glow Background */}
<div
className="absolute inset-0 z-0"
style={{
backgroundImage: `radial-gradient(circle 500px at 50% 100px, rgba(251,191,36,0.4), 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-[#020617] relative">
{/* Gold Radial Glow Background */}
<div
className="absolute inset-0 z-0"
style={{
backgroundImage: `radial-gradient(circle 500px at 50% 100px, rgba(251,191,36,0.4), 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-5070123bf273",
"sourceRevision": "1550af7903f50b4f19a1b44786f27ca01f3ef6ab",
"license": "MIT",
"files": [
{
"file": "gold-radial-glow.jsx",
"sha256": "a340e1f3e543e398f84bd127622622d66a3b80423b49f35710092525be7fef7f",
"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 · Gold
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
이 장면을 만드는 원리
빛의 위치와 실제 정보의 역할
표현의 목적과 사용자 작업을 먼저 구분하고, 장식이 전달하는 정보의 범위를 정합니다.
- 이 예제에서는
- 금빛 배경은 500px 반경의 radial-gradient 한 장입니다. 중심은 가로 50%, 세로 100px이며 금빛의 알파는 0.4입니다. 이동·마우스 반응·시간 변화가 없는 정적 표현이고, 원본에는 실제 콘텐츠가 없습니다.
코드와 함께 확인하기
코드에서 찾기
circle 500px at 50% 100pxgold-radial-glow.jsx중심의 세로 위치는 높이의 비율이 아닌 고정 CSS 길이입니다.
직접 해보기
같은 폭에서 미리보기 높이를 바꿔 배경 중심을 비교합니다.
살펴볼 변화중심의 세로 기준이 상단 100px로 유지되는지 확인합니다. 빛이 세로 중앙을 따라가는 효과로 설명하지 않습니다.
화면을 그대로 두거나 포인터를 움직입니다.
살펴볼 변화소스에 시간·입력 갱신이 없으므로 자동으로 움직이는 배경으로 소개하지 않습니다.
배경 레이어와 콘텐츠의 경계
부모 제약, 레이어 관계, 실제 콘텐츠와 입력의 책임을 컴포넌트 계약에 명시합니다.
- 이 예제에서는
- min-h-screen인 relative 부모가 배경의 범위를 정하고 absolute inset-0 z-0 자식이 그 영역을 덮습니다. 콘텐츠는 주석 자리뿐이며 pointer-events-none은 없습니다. 버튼이나 제목을 추가할 때 읽기 구조와 레이어·포인터 관계를 제품에서 정해야 합니다.
코드와 함께 확인하기
코드에서 찾기
absolute inset-0 z-0gold-radial-glow.jsx배경 자식은 부모 전체를 덮지만 입력 통과 규칙은 선언하지 않습니다.
직접 해보기
로컬 소스에 긴 제목과 버튼을 넣고 320px 폭에서 확인합니다.
살펴볼 변화제목과 버튼이 배경 위에서 읽히고 포인터·키보드로 접근 가능해야 합니다. 빈 원본만으로 이 결과를 보장하지 않습니다.
