效能
未檢測未檢測
Image CompareMIT卡片GodUI
由 Lucas Bassetti 製作的卡片 React 元件。依據 MIT 授權從 GodUI 原樣收錄,此處為即時預覽。
品質報告
等級和分數來自建置或測試時跑過的自動檢查。沒跑過的項目會標成「未檢測」,不會填假資料。
未檢測
未檢測
未檢測
未檢測
資料來自自動腳本,不是手工填寫。
以實際尺寸顯示。
複製內容以授權聲明開頭,使用程式碼時請保留。
<div id="root"></div>:root{--bg:#f6f4f0;--ink:#17181a;--background:40 20% 96%;--foreground:24 10% 8%;--card:0 0% 100%}html,body{min-height:100%;margin:0;background:var(--bg);color:var(--ink)}html,body{height:100%;overflow:hidden}body{display:grid;place-items:center}#root{display:grid;place-items:center;max-width:100%;max-height:100%;box-sizing:border-box;padding:16px;color:hsl(var(--foreground))}#root.full{width:100%;height:100%;padding:0}@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation-play-state:paused!important;transition-duration:0s!important}}
/*! tailwindcss v4.3.5 | MIT License | https://tailwindcss.com */
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:block))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-serif:var(--font-serif);--font-mono:var(--font-mono);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--font-weight-medium:500;--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--radius-xl:calc(var(--radius) + 4px);--radius-2xl:1rem;--shadow-2xs:var(--shadow-2xs);--shadow-xs:var(--shadow-xs);--shadow-sm:var(--shadow-sm);--shadow-md:var(--shadow-md);--shadow-lg:var(--shadow-lg);--shadow-xl:var(--shadow-xl);--shadow-2xl:var(--shadow-2xl);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--shadow:var(--shadow)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab, currentcolor 50%, transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.top-0{top:0}.top-3{top:calc(var(--spacing) * 3)}.right-3{right:calc(var(--spacing) * 3)}.left-3{left:calc(var(--spacing) * 3)}.z-10{z-index:10}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.mx-auto{margin-inline:auto}.flex{display:flex}.grid{display:grid}.aspect-\[3\/4\]{aspect-ratio:3/4}.aspect-\[4\/3\]{aspect-ratio:4/3}.aspect-\[5\/2\]{aspect-ratio:5/2}.aspect-square{aspect-ratio:1}.aspect-video{aspect-ratio:var(--aspect-video)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-9{width:calc(var(--spacing) * 9);height:calc(var(--spacing) * 9)}.h-0\.5{height:calc(var(--spacing) * .5)}.h-full{height:100%}.min-h-0{min-height:0}.w-0\.5{width:calc(var(--spacing) * .5)}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-3xl{max-width:var(--container-3xl)}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xl{max-width:var(--container-xl)}.flex-1{flex:1}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, )}.animate-pulse{animation:var(--animate-pulse)}.cursor-grab{cursor:grab}.touch-none{touch-action:none}.\[scrollbar-width\:thin\]{scrollbar-width:thin}.flex-col{flex-direction:column}.place-items-center{place-items:center}.items-center{align-items:center}.justify-center{justify-content:center}.overflow-hidden{overflow:hidden}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:2147483647px}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-border,.border-border\/60{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\/60{border-color:color-mix(in oklab, var(--border) 60%, transparent)}}.border-white{border-color:var(--color-white)}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab, red, red)){.bg-black\/60{background-color:color-mix(in oklab, var(--color-black) 60%, transparent)}}.bg-card\/40{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\/40{background-color:color-mix(in oklab, var(--card) 40%, transparent)}}.bg-card\/80{background-color:var(--card)}@supports (color:color-mix(in lab, red, red)){.bg-card\/80{background-color:color-mix(in oklab, var(--card) 80%, transparent)}}.bg-white\/20{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.bg-white\/20{background-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.bg-white\/90{background-color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-card\/90{--tw-gradient-from:var(--card)}@supports (color:color-mix(in lab, red, red)){.from-card\/90{--tw-gradient-from:color-mix(in oklab, var(--card) 90%, transparent)}}.from-card\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.py-1{padding-block:var(--spacing)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-\[22vh\]{padding-block:22vh}.py-\[40vh\]{padding-block:40vh}.py-\[55vh\]{padding-block:55vh}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[11px\]{font-size:11px}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-muted-foreground{color:var(--muted-foreground)}.text-white{color:var(--color-white)}.shadow-\[0_0_0_1px_rgba\(0\,0\,0\,0\.1\)\]{--tw-shadow:0 0 0 1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-lg{--tw-shadow:var(--shadow-lg);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-white\/40{--tw-ring-color:#fff6}@supports (color:color-mix(in lab, red, red)){.ring-white\/40{--tw-ring-color:color-mix(in oklab, var(--color-white) 40%, transparent)}}.grayscale{--tw-grayscale:grayscale(100%);filter:var(--tw-blur, ) var(--tw-brightness, ) var(--tw-contrast, ) var(--tw-grayscale, ) var(--tw-hue-rotate, ) var(--tw-invert, ) var(--tw-saturate, ) var(--tw-sepia, ) var(--tw-drop-shadow, )}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, );backdrop-filter:var(--tw-backdrop-blur, ) var(--tw-backdrop-brightness, ) var(--tw-backdrop-contrast, ) var(--tw-backdrop-grayscale, ) var(--tw-backdrop-hue-rotate, ) var(--tw-backdrop-invert, ) var(--tw-backdrop-opacity, ) var(--tw-backdrop-saturate, ) var(--tw-backdrop-sepia, )}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.select-none{-webkit-user-select:none;user-select:none}.\[transition\:clip-path_120ms_ease-out\]{transition:clip-path .12s ease-out}.\[transition\:scale_150ms_ease\]{transition:scale .15s}@media (hover:hover){:is(:where(.group):hover .group-hover\:hidden){display:none}:is(:where(.group):hover .group-hover\:scale-110){--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:var(--ring)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset, ) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.active\:cursor-grabbing:active{cursor:grabbing}.\[\&_img\]\:pointer-events-none img{pointer-events:none}.\[\&_img\]\:block img{display:block}.\[\&_img\]\:size-full img{width:100%;height:100%}.\[\&_img\]\:object-cover img{object-fit:cover}}:root,.light,:root[data-theme=light]{--background:oklch(100% 0 0);--foreground:oklch(14.5% 0 0);--card:oklch(100% 0 0);--card-foreground:oklch(14.5% 0 0);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.5% 0 0);--primary:oklch(20.5% 0 0);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(97% 0 0);--secondary-foreground:oklch(20.5% 0 0);--accent:oklch(97% 0 0);--accent-foreground:oklch(20.5% 0 0);--muted:oklch(97% 0 0);--muted-foreground:oklch(55.6% 0 0);--destructive:oklch(57.7% .245 27.325);--border:oklch(92.2% 0 0);--input:oklch(92.2% 0 0);--ring:oklch(70.8% 0 0);--chart-1:oklch(64.6% .222 41.116);--chart-2:oklch(60% .118 184.704);--chart-3:oklch(39.8% .07 227.392);--chart-4:oklch(82.8% .189 84.429);--chart-5:oklch(76.9% .188 70.08);--sidebar:oklch(98.5% 0 0);--sidebar-foreground:oklch(14.5% 0 0);--sidebar-primary:oklch(20.5% 0 0);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(97% 0 0);--sidebar-accent-foreground:oklch(20.5% 0 0);--sidebar-border:oklch(92.2% 0 0);--sidebar-ring:oklch(70.8% 0 0);--font-sans:var(--font-geist-sans,"Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif);--font-serif:var(--font-geist-sans,"Geist", ui-serif, Georgia, Cambria, "Times New Roman", Times, serif);--font-mono:var(--font-geist-mono,"Geist Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);--radius:.625rem;--shadow-2xs:0 1px 2px #00000005;--shadow-xs:0 1px 3px #0000000a;--shadow-sm:0 2px 6px #0000000d;--shadow:0 4px 12px #0000000f;--shadow-md:0 8px 20px #00000014;--shadow-lg:0 16px 32px #0000001a;--shadow-xl:0 24px 48px #0000001f;--shadow-2xl:0 40px 80px #00000029;--syntax-plain:oklch(20% .036 266);--syntax-punctuation:oklch(54% .022 266);--syntax-keyword:oklch(52% .19 302);--syntax-property:oklch(56% .11 90);--syntax-string:oklch(52% .106 168);--syntax-comment:oklch(63% .016 266);--syntax-number:oklch(54% .115 235);--inline-code-bg:var(--muted);--inline-code-fg:var(--foreground);--inline-code-border:var(--border);--code-block:oklch(97.8% 0 0);--code-block-foreground:oklch(20.5% 0 0);--code-block-border:oklch(92.2% 0 0);--search-bg:var(--card);--search-fg:var(--muted-foreground);--search-border:var(--border);--search-kbd-bg:var(--muted);--search-kbd-fg:var(--muted-foreground);--search-placeholder:var(--muted-foreground);--search-highlight-bg:var(--primary);--search-highlight-fg:var(--primary-foreground);--theme-panel-bg:var(--card);--theme-panel-border:var(--border);--theme-panel-fg:var(--muted-foreground);--theme-panel-active-bg:var(--muted);--theme-panel-active-fg:var(--foreground);--z-base:0;--z-raised:10;--z-overlay:20;--z-sticky:30;--z-popover:40;--z-modal:50;--z-toast:60;--color-bg:var(--background);--color-fg:var(--foreground);--color-border:var(--border);--color-primary:var(--primary);--color-primary-fg:var(--primary-foreground);--color-secondary-bg:var(--secondary);--color-secondary-fg:var(--secondary-foreground);--color-destructive:var(--destructive);--color-destructive-fg:oklch(100% 0 0);--glow-highlight:61, 102, 223;--color-primary-rgb:61, 102, 223;--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--god-gradient:linear-gradient(135deg, oklch(55% .19 266) 0%, oklch(100% 0 0) 50%, oklch(85% .12 90) 100%);--god-glow:0 0 24px oklch(55% .19 266/.14), 0 0 80px oklch(85% .12 90/.06);--rainbow-1:oklch(55% .19 266);--rainbow-2:oklch(68% .16 305);--rainbow-3:oklch(82% .1 185);--rainbow-4:oklch(78% .12 14);--rainbow-5:oklch(80% .13 90);--rainbow-speed:2s}@media (color-gamut:p3){:root,.light{--syntax-string:oklch(52% .13 168);--syntax-number:oklch(54% .13 235)}}@media (prefers-color-scheme:dark){:root:not(.light){--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--chart-1:oklch(48.8% .243 264.376);--chart-2:oklch(69.6% .17 162.48);--chart-3:oklch(76.9% .188 70.08);--chart-4:oklch(62.7% .265 303.9);--chart-5:oklch(64.5% .246 16.439);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(100% 0 0/.1);--sidebar-ring:oklch(55.6% 0 0);--syntax-plain:oklch(93.5% .01 266);--syntax-punctuation:oklch(65% .02 266);--syntax-keyword:oklch(78% .135 302);--syntax-property:oklch(83% .12 90);--syntax-string:oklch(80% .13 168);--syntax-comment:oklch(58% .02 266);--syntax-number:oklch(80% .12 224);--code-block:oklch(18.5% 0 0);--code-block-foreground:oklch(98.5% 0 0);--code-block-border:oklch(27% 0 0);--inline-code-bg:var(--muted);--inline-code-fg:var(--foreground);--inline-code-border:var(--border);--search-bg:var(--card);--search-fg:var(--muted-foreground);--search-border:var(--border);--search-kbd-bg:var(--muted);--search-kbd-fg:var(--muted-foreground);--search-placeholder:var(--muted-foreground);--search-highlight-bg:var(--primary);--search-highlight-fg:var(--primary-foreground);--theme-panel-bg:var(--card);--theme-panel-border:var(--border);--theme-panel-fg:var(--muted-foreground);--theme-panel-active-bg:var(--muted);--theme-panel-active-fg:var(--foreground);--shadow-2xs:0 1px 2px #0000001f;--shadow-xs:0 1px 3px #00000026;--shadow-sm:0 2px 6px #0003;--shadow:0 4px 12px #00000040;--shadow-md:0 8px 20px #0000004d;--shadow-lg:0 16px 32px #00000059;--shadow-xl:0 24px 48px #0006;--shadow-2xl:0 40px 80px #00000080;--color-bg:var(--background);--color-fg:var(--foreground);--color-border:var(--border);--color-primary:var(--primary);--color-primary-fg:var(--primary-foreground);--color-secondary-bg:var(--secondary);--color-secondary-fg:var(--secondary-foreground);--color-destructive:var(--destructive);--color-destructive-fg:oklch(100% 0 0);--glow-highlight:66, 108, 229;--color-primary-rgb:66, 108, 229;--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--god-gradient:linear-gradient(135deg, oklch(57% .19 266) 0%, oklch(100% 0 0) 50%, oklch(86% .12 90) 100%);--god-glow:0 0 24px oklch(57% .19 266/.28), 0 0 80px oklch(86% .12 90/.12);--rainbow-1:oklch(72% .145 266);--rainbow-2:oklch(74% .16 305);--rainbow-3:oklch(84% .1 185);--rainbow-4:oklch(80% .116 14);--rainbow-5:oklch(84% .13 90);--rainbow-speed:2s}}:root[data-theme=dark],.dark{--background:oklch(14.5% 0 0);--foreground:oklch(98.5% 0 0);--card:oklch(20.5% 0 0);--card-foreground:oklch(98.5% 0 0);--popover:oklch(20.5% 0 0);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92.2% 0 0);--primary-foreground:oklch(20.5% 0 0);--secondary:oklch(26.9% 0 0);--secondary-foreground:oklch(98.5% 0 0);--accent:oklch(26.9% 0 0);--accent-foreground:oklch(98.5% 0 0);--muted:oklch(26.9% 0 0);--muted-foreground:oklch(70.8% 0 0);--destructive:oklch(70.4% .191 22.216);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.6% 0 0);--chart-1:oklch(48.8% .243 264.376);--chart-2:oklch(69.6% .17 162.48);--chart-3:oklch(76.9% .188 70.08);--chart-4:oklch(62.7% .265 303.9);--chart-5:oklch(64.5% .246 16.439);--sidebar:oklch(20.5% 0 0);--sidebar-foreground:oklch(98.5% 0 0);--sidebar-primary:oklch(48.8% .243 264.376);--sidebar-primary-foreground:oklch(98.5% 0 0);--sidebar-accent:oklch(26.9% 0 0);--sidebar-accent-foreground:oklch(98.5% 0 0);--sidebar-border:oklch(100% 0 0/.1);--sidebar-ring:oklch(55.6% 0 0);--syntax-plain:oklch(93.5% .01 266);--syntax-punctuation:oklch(65% .02 266);--syntax-keyword:oklch(78% .135 302);--syntax-property:oklch(83% .12 90);--syntax-string:oklch(80% .13 168);--syntax-comment:oklch(58% .02 266);--syntax-number:oklch(80% .12 224);--code-block:oklch(18.5% 0 0);--code-block-foreground:oklch(98.5% 0 0);--code-block-border:oklch(27% 0 0);--inline-code-bg:var(--muted);--inline-code-fg:var(--foreground);--inline-code-border:var(--border);--search-bg:var(--card);--search-fg:var(--muted-foreground);--search-border:var(--border);--search-kbd-bg:var(--muted);--search-kbd-fg:var(--muted-foreground);--search-placeholder:var(--muted-foreground);--search-highlight-bg:var(--primary);--search-highlight-fg:var(--primary-foreground);--theme-panel-bg:var(--card);--theme-panel-border:var(--border);--theme-panel-fg:var(--muted-foreground);--theme-panel-active-bg:var(--muted);--theme-panel-active-fg:var(--foreground);--shadow-2xs:0 1px 2px #0000001f;--shadow-xs:0 1px 3px #00000026;--shadow-sm:0 2px 6px #0003;--shadow:0 4px 12px #00000040;--shadow-md:0 8px 20px #0000004d;--shadow-lg:0 16px 32px #00000059;--shadow-xl:0 24px 48px #0006;--shadow-2xl:0 40px 80px #00000080;--color-bg:var(--background);--color-fg:var(--foreground);--color-border:var(--border);--color-primary:var(--primary);--color-primary-fg:var(--primary-foreground);--color-secondary-bg:var(--secondary);--color-secondary-fg:var(--secondary-foreground);--color-destructive:var(--destructive);--color-destructive-fg:oklch(100% 0 0);--glow-highlight:66, 108, 229;--color-primary-rgb:66, 108, 229;--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--god-gradient:linear-gradient(135deg, oklch(57% .19 266) 0%, oklch(100% 0 0) 50%, oklch(86% .12 90) 100%);--god-glow:0 0 24px oklch(57% .19 266/.28), 0 0 80px oklch(86% .12 90/.12);--rainbow-1:oklch(72% .145 266);--rainbow-2:oklch(74% .16 305);--rainbow-3:oklch(84% .1 185);--rainbow-4:oklch(80% .116 14);--rainbow-5:oklch(84% .13 90);--rainbow-speed:2s}@media (color-gamut:p3){@media (prefers-color-scheme:dark){:root:not(.light){--syntax-keyword:oklch(78% .14 302);--rainbow-1:oklch(72% .15 266);--rainbow-4:oklch(80% .12 14)}}.dark{--syntax-keyword:oklch(78% .14 302);--rainbow-1:oklch(72% .15 266);--rainbow-4:oklch(80% .12 14)}}@keyframes magic-rainbow{0%{background-position:0%}to{background-position:200%}}@keyframes magic-input-indeterminate{0%{background-position:110%}to{background-position:-10%}}@keyframes magic-input-sweep{0%{background-size:0% 100%}to{background-size:100% 100%}}@keyframes magic-input-spin{to{transform:rotate(360deg)}}@keyframes shimmer-slide{to{transform:translate(calc(100cqw - 100%))}}@keyframes spin-around{0%{transform:translateZ(0)rotate(0)}15%,35%{transform:translateZ(0)rotate(90deg)}65%,85%{transform:translateZ(0)rotate(270deg)}to{transform:translateZ(0)rotate(360deg)}}@keyframes progress-fold-indeterminate{0%{transform:translate(-100%)}to{transform:translate(250%)}}@keyframes mask-button-in{0%{-webkit-mask-position:0 0;mask-position:0 0}to{-webkit-mask-position:100% 0;mask-position:100% 0}}@keyframes mask-button-out{0%{-webkit-mask-position:100% 0;mask-position:100% 0}to{-webkit-mask-position:0 0;mask-position:0 0}}@keyframes aurora-text{0%{background-position:0%}50%{background-position:100%}to{background-position:0%}}@keyframes marquee{0%{transform:translate(0)}to{transform:translateX(calc(-100% - var(--gap)))}}@keyframes marquee-vertical{0%{transform:translateY(0)}to{transform:translateY(calc(-100% - var(--gap)))}}@keyframes split-flap-fall{0%{transform:rotateX(0)}to{transform:rotateX(-90deg)}}@keyframes split-flap-rise{0%{transform:rotateX(90deg)}to{transform:rotateX(0)}}@keyframes blueprint-sweep{0%{transform:translate(-50%, -50%) rotate(var(--blueprint-angle,25deg));opacity:0}15%,85%{opacity:1}to{transform:translate(150%, 150%) rotate(var(--blueprint-angle,25deg));opacity:0}}@keyframes light-rays-sweep{0%{transform:rotate(calc(var(--rays-angle,0deg) - 6deg)) scale(1);opacity:calc(var(--rays-intensity,.6) * .7)}to{transform:rotate(calc(var(--rays-angle,0deg) + 6deg)) scale(1.08);opacity:var(--rays-intensity,.6)}}@keyframes voice-orb-spin{to{transform:rotate(360deg)}}@keyframes voice-orb-breathe{0%,to{transform:scale(1)}50%{transform:scale(1.04)}}@keyframes voice-orb-ring{0%{opacity:.6;transform:scale(.85)}to{opacity:0;transform:scale(1.4)}}@keyframes app-showcase-scroll{0%{transform:translateY(0)}to{transform:translateY(-50%)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes pulse{50%{opacity:.5}}// godui source (MIT). npm i clsx motion react tailwind-merge · Tailwind CSS v4
// ── cn.ts (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/cn.ts)
/*
MIT License
Copyright (c) 2026 Lucas Bassetti
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.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
canvas-confetti (ISC) was replaced with an original MIT helper by Incidental AI.
Sample photographs and brand marks were replaced with Incidental AI assets. Credit GodUI / Lucas Bassetti as attribution only; the name is not used for marketing.
*/
import { clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...a){ return twMerge(clsx(a)); }
// ── demos/_kit.tsx (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/demos/_kit.tsx)
/*
MIT License
Copyright (c) 2026 Lucas Bassetti
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.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
canvas-confetti (ISC) was replaced with an original MIT helper by Incidental AI.
Sample photographs and brand marks were replaced with Incidental AI assets. Credit GodUI / Lucas Bassetti as attribution only; the name is not used for marketing.
*/
"use client";
import { forwardRef, type ReactNode } from "react";
import { cn } from "../cn";
type MaxWidth = "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "none";
const maxWidthClass: Record<MaxWidth, string> = {
sm: "max-w-sm",
md: "max-w-md",
lg: "max-w-lg",
xl: "max-w-xl",
"2xl": "max-w-2xl",
"3xl": "max-w-3xl",
none: "",
};
/**
* Center a compact demo in the stage. Use with the default (non-fullWidth)
* Example layout — buttons, inputs, cards, small widgets.
*/
export function DemoCenter({
children,
className,
max = "none",
}: {
children: ReactNode;
className?: string;
/** Optional max-width on the centering shell. */
max?: MaxWidth;
}) {
return (
<div
className={cn(
"mx-auto flex w-full items-center justify-center",
maxWidthClass[max],
className,
)}
>
{children}
</div>
);
}
type MediaAspect = "square" | "video" | "photo" | "portrait" | "wide";
const aspectClass: Record<MediaAspect, string> = {
square: "aspect-square",
video: "aspect-video",
photo: "aspect-[4/3]",
portrait: "aspect-[3/4]",
wide: "aspect-[5/2]",
};
/**
* Media / image demos — one width + aspect language across compare, accordion,
* galleries, and tilt/holo cards. Stays centered (no Example fullWidth).
*/
export function DemoMedia({
children,
className,
max = "md",
aspect,
}: {
children: ReactNode;
className?: string;
max?: Exclude<MaxWidth, "none">;
aspect?: MediaAspect;
}) {
return (
<div
className={cn(
"mx-auto w-full",
maxWidthClass[max],
aspect ? aspectClass[aspect] : null,
className,
)}
>
{children}
</div>
);
}
type ScrollPortVariant = "fill" | "framed";
type DemoScrollPortProps = {
children: ReactNode;
className?: string;
/**
* `fill` — fills the stage (pair with Example `fullWidth`).
* `framed` — fixed-height bordered card, centered (no `fullWidth`).
*/
variant?: ScrollPortVariant;
/** Height for the framed variant (CSS length). Default `26rem`. */
height?: string;
/** Max width for the framed variant. Default `md`. */
max?: Exclude<MaxWidth, "none">;
/** Sticky cue at the top of the port (e.g. "Scroll to reveal"). */
hint?: string;
};
/**
* Scroll viewport for scroll-driven demos. Forward the ref into the component's
* `scrollContainer` / `container` prop so the preview stage (not the window)
* drives the scrub.
*/
function ScrollHint({ hint }: { hint: string }) {
return (
<div className="sticky top-0 z-10 flex justify-center bg-gradient-to-b from-card/90 to-transparent py-3">
<span className="rounded-full border border-border/60 bg-card/80 px-2.5 py-1 font-medium text-[11px] text-muted-foreground backdrop-blur-sm">
{hint}
</span>
</div>
);
}
export const DemoScrollPort = forwardRef<HTMLDivElement, DemoScrollPortProps>(
function DemoScrollPort(
{
children,
className,
variant = "fill",
height = "26rem",
max = "md",
hint,
},
ref,
) {
if (variant === "framed") {
return (
<div
ref={ref}
data-scroll-container
className={cn(
"relative mx-auto w-full overflow-x-hidden overflow-y-auto rounded-2xl border border-border bg-card/40 [scrollbar-width:thin]",
maxWidthClass[max],
className,
)}
style={{ height }}
>
{hint ? <ScrollHint hint={hint} /> : null}
{children}
</div>
);
}
return (
<div
ref={ref}
data-scroll-container
className={cn(
"relative h-full min-h-0 w-full overflow-x-hidden overflow-y-auto",
className,
)}
>
{hint ? <ScrollHint hint={hint} /> : null}
{children}
</div>
);
},
);
/**
* Vertical runway inside a scroll port so scrubbing demos have distance to
* travel before / after the focal content.
*/
export function DemoScrollRunway({
children,
className,
pad = "lg",
}: {
children: ReactNode;
className?: string;
pad?: "md" | "lg" | "xl";
}) {
const padClass = {
md: "py-[22vh]",
lg: "py-[40vh]",
xl: "py-[55vh]",
}[pad];
return (
<div className={cn("mx-auto w-full", padClass, className)}>{children}</div>
);
}
/**
* Full-bleed scene that fills the stage. Pair with Example `fullWidth` —
* backgrounds, docks, pointer playgrounds, glass surfaces.
*/
export function DemoScene({
children,
className,
}: {
children: ReactNode;
className?: string;
}) {
return (
<div
className={cn(
"relative flex h-full min-h-0 w-full flex-1 flex-col",
className,
)}
>
{children}
</div>
);
}
// ── demos/image-compare-demo.tsx (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/demos/image-compare-demo.tsx)
"use client";
import { ImageCompare } from "@godui/lab";
import { DemoMedia } from "@/components/demos/_kit";
const SRC_A = "https://picsum.photos/id/1015/800/600";
const SRC_B = "https://picsum.photos/id/1025/800/600";
export function ImageCompareDemo() {
return (
<DemoMedia max="md" aspect="photo">
<ImageCompare
beforeLabel="Color"
afterLabel="B&W"
before={<img src={SRC_A} alt="Color" />}
after={<img src={SRC_A} alt="Black and white" className="grayscale" />}
/>
</DemoMedia>
);
}
export function ImageCompareVerticalDemo() {
return (
<DemoMedia max="md" aspect="photo">
<ImageCompare
orientation="vertical"
before={<img src={SRC_B} alt="Color" />}
after={<img src={SRC_B} alt="Black and white" className="grayscale" />}
/>
</DemoMedia>
);
}
// ── image-compare/image-compare.tsx (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/image-compare/image-compare.tsx)
/*
MIT License
Copyright (c) 2026 Lucas Bassetti
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.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
canvas-confetti (ISC) was replaced with an original MIT helper by Incidental AI.
Sample photographs and brand marks were replaced with Incidental AI assets. Credit GodUI / Lucas Bassetti as attribution only; the name is not used for marketing.
*/
"use client";
import * as React from "react";
export type ImageCompareProps = Omit<
React.HTMLAttributes<HTMLDivElement>,
"onChange"
> & {
/** Content revealed on the left / top (the "before" state). */
before: React.ReactNode;
/** Content underneath, revealed as the handle moves (the "after" state). */
after: React.ReactNode;
/** Starting handle position, 0–100. */
initial?: number;
orientation?: "horizontal" | "vertical";
beforeLabel?: string;
afterLabel?: string;
onChange?: (position: number) => void;
};
const clamp = (n: number) => Math.min(100, Math.max(0, n));
const ImageCompare = React.forwardRef<HTMLDivElement, ImageCompareProps>(
(
{
before,
after,
initial = 50,
orientation = "horizontal",
beforeLabel,
afterLabel,
onChange,
className,
...props
},
ref,
) => {
const containerRef = React.useRef<HTMLDivElement>(null);
React.useImperativeHandle(
ref,
() => containerRef.current as HTMLDivElement,
);
const [pos, setPos] = React.useState(clamp(initial));
const [dragging, setDragging] = React.useState(false);
const horizontal = orientation === "horizontal";
const updateFromPointer = React.useCallback(
(clientX: number, clientY: number) => {
const el = containerRef.current;
if (!el) return;
const rect = el.getBoundingClientRect();
const next = horizontal
? ((clientX - rect.left) / rect.width) * 100
: ((clientY - rect.top) / rect.height) * 100;
const clamped = clamp(next);
setPos(clamped);
onChange?.(clamped);
},
[horizontal, onChange],
);
const handlePointerDown = (e: React.PointerEvent) => {
e.currentTarget.setPointerCapture(e.pointerId);
setDragging(true);
updateFromPointer(e.clientX, e.clientY);
};
const handlePointerMove = (e: React.PointerEvent) => {
if (!dragging) return;
updateFromPointer(e.clientX, e.clientY);
};
const stop = () => setDragging(false);
const handleKeyDown = (e: React.KeyboardEvent) => {
const step = e.shiftKey ? 10 : 2;
const dec = horizontal ? "ArrowLeft" : "ArrowUp";
const inc = horizontal ? "ArrowRight" : "ArrowDown";
if (e.key === dec) {
e.preventDefault();
setPos((p) => {
const n = clamp(p - step);
onChange?.(n);
return n;
});
} else if (e.key === inc) {
e.preventDefault();
setPos((p) => {
const n = clamp(p + step);
onChange?.(n);
return n;
});
}
};
// The "before" layer is clipped to the handle position.
const clip = horizontal
? `inset(0 ${100 - pos}% 0 0)`
: `inset(0 0 ${100 - pos}% 0)`;
// Full-span divider line.
const lineStyle: React.CSSProperties = horizontal
? { left: `${pos}%`, top: 0, bottom: 0, transform: "translateX(-50%)" }
: { top: `${pos}%`, left: 0, right: 0, transform: "translateY(-50%)" };
// Grabber centered on the opposite axis (uses the `translate` property so
// the `scale` hover utilities stay independent).
const handleStyle: React.CSSProperties = horizontal
? { left: `${pos}%`, top: "50%", translate: "-50% -50%" }
: { top: `${pos}%`, left: "50%", translate: "-50% -50%" };
const transition = dragging ? "" : "[transition:clip-path_120ms_ease-out]";
return (
<div
ref={containerRef}
onPointerDown={handlePointerDown}
onPointerMove={handlePointerMove}
onPointerUp={stop}
onPointerCancel={stop}
className={`group relative touch-none select-none overflow-hidden rounded-xl border border-border ${
className ?? ""
}`}
{...props}
>
{/* After (base) layer */}
<div className="[&_img]:pointer-events-none [&_img]:block [&_img]:size-full [&_img]:object-cover">
{after}
</div>
{afterLabel && (
<span className="pointer-events-none absolute right-3 top-3 rounded-md bg-black/60 px-2 py-1 text-xs font-medium text-white backdrop-blur-sm">
{afterLabel}
</span>
)}
{/* Before (clipped) layer */}
<div
aria-hidden="true"
style={{ clipPath: clip }}
className={`absolute inset-0 ${transition} [&_img]:pointer-events-none [&_img]:block [&_img]:size-full [&_img]:object-cover`}
>
{before}
</div>
{beforeLabel && (
<span className="pointer-events-none absolute left-3 top-3 rounded-md bg-black/60 px-2 py-1 text-xs font-medium text-white backdrop-blur-sm">
{beforeLabel}
</span>
)}
{/* Divider + grabber */}
<div
aria-hidden="true"
style={lineStyle}
className={`pointer-events-none absolute bg-white/90 shadow-[0_0_0_1px_rgba(0,0,0,0.1)] ${
horizontal ? "w-0.5" : "h-0.5"
}`}
/>
<button
type="button"
role="slider"
aria-label="Comparison position"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={Math.round(pos)}
aria-orientation={orientation}
onKeyDown={handleKeyDown}
style={handleStyle}
className="absolute grid size-9 cursor-grab touch-none place-items-center rounded-full border-2 border-white bg-white/20 text-white shadow-lg backdrop-blur-sm [transition:scale_150ms_ease] active:scale-95 active:cursor-grabbing focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 group-hover:scale-110"
>
<span className="absolute inset-0 animate-pulse rounded-full ring-2 ring-white/40 group-hover:hidden" />
<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
className={`size-4 ${horizontal ? "" : "rotate-90"}`}
aria-hidden="true"
>
<path d="m9 7-5 5 5 5M15 7l5 5-5 5" />
</svg>
</button>
</div>
);
},
);
ImageCompare.displayName = "ImageCompare";
export { ImageCompare };
// ── image-compare/index.ts (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/image-compare/index.ts)
/*
MIT License
Copyright (c) 2026 Lucas Bassetti
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.
Icon substitution (this copy only): lucide-react (ISC) was replaced with @tabler/icons-react (MIT).
canvas-confetti (ISC) was replaced with an original MIT helper by Incidental AI.
Sample photographs and brand marks were replaced with Incidental AI assets. Credit GodUI / Lucas Bassetti as attribution only; the name is not used for marketing.
*/
export { ImageCompare, type ImageCompareProps } from "./image-compare";控制項 · HTML · CSS · JS
直接改程式碼,再用控制項微調,預覽會隨輸入即時更新。

線上編輯每個元件,用控制項微調,下載完整原始碼,複製進階提示詞。
一次性 $49暫定價格
測試模式:不會真的扣款。
免費:預覽、複製按鈕和課程說明。
寬鬆的內邊距、柔和的圓角和單一強調色,讓內容站在前面。
功能列表、個人資料、商品卡和儀表盤。
調內邊距、陰影深度和強調色。
把 GodUI (github.com/LucasBassetti/godui)(MIT)中的「圖片對比」元件加入我的 React + Tailwind CSS 應用程式。原始檔:https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/packages/lab/src/image-compare。寬鬆的內邊距、柔和的圓角和單一強調色,讓內容站在前面。 適用情境:功能列表、個人資料、商品卡和儀表盤。 可調參數:調內邊距、陰影深度和強調色。 支援淺色與深色主題,遵循 prefers-reduced-motion。保留 MIT 授權聲明。
更完整的提示詞,包含調參、無障礙和接入步驟。