Performance
Non testeNon teste
Split-Flap DisplayMITCarteGodUI
Composant React Carte par Lucas Bassetti. Repris sans modification depuis GodUI sous licence MIT et présenté ici en direct.
Rapport qualite
La note et le score proviennent de contrôles automatiques lancés à la compilation ou aux tests. Si un contrôle n'a pas été exécuté, il est indiqué Non testé — aucun chiffre n'est inventé.
Non teste
Non teste
Non teste
Non teste
Les chiffres viennent d'un script automatique, pas d'exemples ecrits a la main.
Affiché à taille réelle.
La copie commence par la notice de licence. Gardez-la lorsque vous utilisez le code.
<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-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--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-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction: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-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}}}@layer theme{:root,:host{--font-sans:var(--font-sans);--font-serif:var(--font-serif);--font-mono:var(--font-mono);--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);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--text-6xl:3.75rem;--text-6xl--line-height:1;--font-weight-medium:500;--font-weight-semibold:600;--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);--blur-sm:8px;--aspect-video:16 / 9;--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}.static{position:static}.sticky{position:sticky}.inset-x-0{inset-inline:0}.top-0{top:0}.top-1\/2{top:50%}.bottom-0{bottom:0}.z-10{z-index:10}.z-raised{z-index:var(--z-raised)}.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}.inline-flex{display:inline-flex}.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)}.h-1\/2{height:50%}.h-9{height:calc(var(--spacing) * 9)}.h-14{height:calc(var(--spacing) * 14)}.h-20{height:calc(var(--spacing) * 20)}.h-\[200\%\]{height:200%}.h-full{height:100%}.h-px{height:1px}.min-h-0{min-height:0}.w-6{width:calc(var(--spacing) * 6)}.w-10{width:calc(var(--spacing) * 10)}.w-14{width:calc(var(--spacing) * 14)}.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}.shrink-0{flex-shrink:0}.origin-bottom{transform-origin:bottom}.origin-top{transform-origin:top}.-translate-y-1\/2{--tw-translate-y:calc(calc(1 / 2 * 100%) * -1);translate:var(--tw-translate-x) var(--tw-translate-y)}.animate-split-flap-fall{animation:.12s cubic-bezier(.3,.7,.4,1) forwards split-flap-fall}.animate-split-flap-rise{animation:.12s cubic-bezier(.22,1,.36,1) both split-flap-rise}.\[scrollbar-width\:thin\]{scrollbar-width:thin}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-1{gap:var(--spacing)}.gap-5{gap:calc(var(--spacing) * 5)}.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-lg{border-radius:var(--radius)}.rounded-t-md{border-top-left-radius:calc(var(--radius) - 2px);border-top-right-radius:calc(var(--radius) - 2px)}.rounded-b-md{border-bottom-right-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-background\/15{border-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.border-background\/15{border-color:color-mix(in oklab, var(--background) 15%, transparent)}}.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)}}.bg-background\/25{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\/25{background-color:color-mix(in oklab, var(--background) 25%, 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-foreground{background-color:var(--foreground)}.bg-muted{background-color:var(--muted)}.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))}.p-2{padding: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-6{padding-block:calc(var(--spacing) * 6)}.py-\[22vh\]{padding-block:22vh}.py-\[40vh\]{padding-block:40vh}.py-\[55vh\]{padding-block:55vh}.font-mono{font-family:var(--font-mono)}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-6xl{font-size:var(--text-6xl);line-height:var(--tw-leading,var(--text-6xl--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.2em\]{--tw-tracking:.2em;letter-spacing:.2em}.text-background{color:var(--background)}.text-muted-foreground{color:var(--muted-foreground)}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal, ) var(--tw-slashed-zero, ) var(--tw-numeric-figure, ) var(--tw-numeric-spacing, ) var(--tw-numeric-fraction, )}.shadow{--tw-shadow:var(--shadow);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-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, )}.select-none{-webkit-user-select:none;user-select:none}.\[backface-visibility\:hidden\]{backface-visibility:hidden}.\[perspective\:180px\]{perspective:180px}.\[perspective\:280px\]{perspective:280px}.\[perspective\:400px\]{perspective:400px}.\[transform-style\:preserve-3d\]{transform-style:preserve-3d}}: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-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@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-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{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-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}// 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/split-flap-display-demo.tsx (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/demos/split-flap-display-demo.tsx)
"use client";
import { SplitFlapDisplay } from "@godui/lab";
import * as React from "react";
import { DemoCenter } from "./_kit";
const WORDS = ["SPLIT", "FLAP", "SOLARI", "REVEAL", "GODUI"];
export function SplitFlapDisplayDemo() {
const [i, setI] = React.useState(0);
React.useEffect(() => {
const id = setInterval(() => setI((n) => (n + 1) % WORDS.length), 2600);
return () => clearInterval(id);
}, []);
return (
<DemoCenter className="flex-col gap-5 py-6">
<span className="text-xs font-medium tracking-[0.2em] text-muted-foreground uppercase">
Now showing
</span>
<SplitFlapDisplay value={WORDS[i]} length={6} align="center" size="md" />
</DemoCenter>
);
}
function useClock() {
const [time, setTime] = React.useState("");
React.useEffect(() => {
const tick = () => {
const d = new Date();
const p = (n: number) => String(n).padStart(2, "0");
setTime(`${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`);
};
tick();
const id = setInterval(tick, 1000);
return () => clearInterval(id);
}, []);
return time;
}
const D = "0123456789";
// One reel per HH:MM:SS column so each digit only cycles its valid range and
// wraps in a single flip (e.g. seconds-tens 5 → 0, never climbing 6 7 8 9).
const CLOCK_CHARSET = ["012", D, ":", "012345", D, ":", "012345", D];
export function SplitFlapClockDemo() {
const time = useClock();
return (
<DemoCenter className="flex-col gap-5 py-6">
<span className="text-xs font-medium tracking-[0.2em] text-muted-foreground uppercase">
Local time
</span>
<SplitFlapDisplay
value={time}
align="center"
size="sm"
charset={CLOCK_CHARSET}
/>
</DemoCenter>
);
}
// ── split-flap-display/index.ts (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/split-flap-display/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 {
type SplitFlapAlign,
SplitFlapDisplay,
type SplitFlapDisplayProps,
type SplitFlapSize,
} from "./split-flap-display";
// ── split-flap-display/split-flap-display.tsx (https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/split-flap-display/split-flap-display.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 { useReducedMotion } from "motion/react";
import * as React from "react";
/**
* Reveal-on-scroll, iframe-safe. Framer's `useInView` observes with the parent
* window's IntersectionObserver, which never intersects an element rendered
* inside a same-origin `<iframe>` (e.g. the docs mobile-preview stage). Creating
* the observer from the element's OWN `defaultView` roots it in that document's
* viewport, so the board reveals in an iframe just like on the page.
*/
function useInViewOnce(ref: React.RefObject<HTMLElement | null>): boolean {
const [inView, setInView] = React.useState(false);
React.useEffect(() => {
const el = ref.current;
if (!el || inView) return;
const win = el.ownerDocument.defaultView ?? window;
if (!("IntersectionObserver" in win)) {
setInView(true);
return;
}
const io = new win.IntersectionObserver(
([entry]) => {
if (entry.isIntersecting) {
setInView(true);
io.disconnect();
}
},
{ rootMargin: "0px 0px -15% 0px" },
);
io.observe(el);
return () => io.disconnect();
}, [ref, inView]);
return inView;
}
export type SplitFlapSize = "sm" | "md" | "lg";
export type SplitFlapAlign = "left" | "center" | "right";
export type SplitFlapDisplayProps = Omit<
React.HTMLAttributes<HTMLDivElement>,
"children"
> & {
/** The text the board settles on. Rendered uppercase against `charset`. */
value: string;
/**
* Fixed number of flaps. Shorter values are padded, longer ones truncated.
* Values are clamped to 0–100; non-finite or fractional values fall back to
* the value length, also capped at 100.
*/
length?: number;
/** How the value sits inside a wider `length`. */
align?: SplitFlapAlign;
/** Flap size preset. */
size?: SplitFlapSize;
/**
* Ordered glyph sequence the flaps rotate through (space is the blank flap).
* Pass an array to give each column its own reel by position — e.g. a clock's
* tens-of-seconds column only cycles `"012345"` so `5 → 0` wraps in one flip
* instead of climbing `6 7 8 9`.
*/
charset?: string | string[];
/** Seconds each successive column waits before it starts — the wave. */
stagger?: number;
/**
* Cap on how many flips a single column will spin before settling. Negative
* or non-finite values use the default cap; finite fractions round down.
*/
maxFlaps?: number;
};
/** Mechanical tick of one flap — the board's characteristic cadence (like the
* marquee's `--duration`, this is a domain constant, not a micro-motion token).
* Mirrors the `0.12s` baked into `--animate-split-flap-*`. */
const TICK = 0.12;
const DEFAULT_CHARSET = " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,:-'!?@#&/";
const DEFAULT_MAX_FLAPS = 12;
/** Practical cap for the board's per-render DOM and padding work. */
const MAX_LENGTH = 100;
function normalizeLength(length: number | undefined, valueLength: number) {
if (length == null || !Number.isFinite(length) || !Number.isInteger(length)) {
return Math.min(valueLength, MAX_LENGTH);
}
return Math.min(Math.max(length, 0), MAX_LENGTH);
}
function normalizeMaxFlaps(maxFlaps: number | undefined): number {
if (maxFlaps == null || !Number.isFinite(maxFlaps) || maxFlaps < 0) {
return DEFAULT_MAX_FLAPS;
}
return Math.floor(maxFlaps);
}
const sizeClasses: Record<SplitFlapSize, string> = {
sm: "h-9 w-6 text-xl [perspective:180px]",
md: "h-14 w-10 text-4xl [perspective:280px]",
lg: "h-20 w-14 text-6xl [perspective:400px]",
};
const alignClasses: Record<SplitFlapAlign, string> = {
left: "justify-start",
center: "justify-center",
right: "justify-end",
};
/** Forward distance from `a` to `b` walking the charset (wrapping). */
function fwdDistance(a: string, b: string, charset: string): number {
const i = charset.indexOf(a);
const j = charset.indexOf(b);
if (i < 0 || j < 0) return 0;
return (j - i + charset.length) % charset.length;
}
/** One step forward along the charset toward `to`. Blank is the empty state,
* not a reel glyph, so clearing to a space is always a single flip (never a
* long forward spin from wherever the space sits in the charset). */
function stepToward(from: string, to: string, charset: string): string {
if (to === " ") return " ";
const i = charset.indexOf(from);
const j = charset.indexOf(to);
if (i < 0 || j < 0 || i === j) return to;
return charset[(i + 1) % charset.length];
}
/** The glyph `offset` places before `char` along the charset. */
function charAtOffset(char: string, offset: number, charset: string): string {
const i = charset.indexOf(char);
if (i < 0) return char;
const n = charset.length;
return charset[(((i + offset) % n) + n) % n];
}
type HalfProps = {
char: string;
part: "top" | "bottom";
className?: string;
style?: React.CSSProperties;
onAnimationEnd?: React.AnimationEventHandler<HTMLDivElement>;
};
/** One leaf of a flap. The glyph is drawn at full card height inside a clipped
* half, so the top and bottom leaves reconstruct a single seamless letter. Used
* both as a static background leaf and — with animation classes — as a moving
* fold, so it always occupies exactly half the digit it sits in. */
function Half({ char, part, className, style, onAnimationEnd }: HalfProps) {
const isTop = part === "top";
return (
<div
className={`absolute inset-x-0 ${isTop ? "top-0 rounded-t-md border-b" : "bottom-0 rounded-b-md border-t"} h-1/2 overflow-hidden border-background/15 bg-foreground text-background ${className ?? ""}`}
style={style}
onAnimationEnd={onAnimationEnd}
>
<div
className={`absolute inset-x-0 ${isTop ? "top-0" : "bottom-0"} flex h-[200%] items-center justify-center font-mono font-semibold leading-none tabular-nums`}
>
{char === " " ? " " : char}
</div>
</div>
);
}
type FlapDigitProps = {
target: string;
active: boolean;
startDelay: number;
size: SplitFlapSize;
charset: string;
maxFlaps: number;
};
function FlapDigit({
target,
active,
startDelay,
size,
charset,
maxFlaps,
}: FlapDigitProps) {
const reduce = useReducedMotion();
const [settled, setSettled] = React.useState(" ");
const steppedRef = React.useRef(0);
const lastDesiredRef = React.useRef(" ");
// Blank until the board is scrolled into view, then settle on the target.
const desired = active ? target : " ";
// New target → reset the per-column wave counter so the first flip staggers.
if (desired !== lastDesiredRef.current) {
lastDesiredRef.current = desired;
steppedRef.current = 0;
}
React.useEffect(() => {
if (reduce) {
setSettled(desired);
return;
}
// Never spin more than `maxFlaps` — fast-forward the head of a long run.
// Blanks clear in one flip (see stepToward), so they never pre-position.
if (desired !== " " && fwdDistance(settled, desired, charset) > maxFlaps) {
setSettled(charAtOffset(desired, -maxFlaps, charset));
}
}, [reduce, desired, settled, charset, maxFlaps]);
const flipping = !reduce && settled !== desired;
const next = flipping ? stepToward(settled, desired, charset) : settled;
const firstOfRun = steppedRef.current === 0;
const fallDelay = firstOfRun ? startDelay : 0;
return (
<div
aria-hidden
className={`relative shrink-0 select-none ${sizeClasses[size]}`}
>
{/* Static leaves: the next glyph's top is revealed as the old top falls;
the old bottom holds until the new bottom rises over it. */}
<Half char={next} part="top" />
<Half char={settled} part="bottom" />
{flipping ? (
// Keyed on the step so each flip remounts and restarts the keyframes.
<React.Fragment key={`${settled}-${next}`}>
<Half
char={settled}
part="top"
className="z-raised origin-bottom animate-split-flap-fall [backface-visibility:hidden] [transform-style:preserve-3d]"
style={{ animationDelay: `${fallDelay}s` }}
/>
<Half
char={next}
part="bottom"
className="z-raised origin-top animate-split-flap-rise [backface-visibility:hidden] [transform-style:preserve-3d]"
style={{ animationDelay: `${fallDelay + TICK}s` }}
onAnimationEnd={() => {
steppedRef.current += 1;
setSettled(next);
}}
/>
</React.Fragment>
) : null}
{/* Center hinge shadow — a static seam, no animated paint. */}
<div className="pointer-events-none absolute inset-x-0 top-1/2 z-raised h-px -translate-y-1/2 bg-background/25" />
</div>
);
}
const SplitFlapDisplay = React.forwardRef<
HTMLDivElement,
SplitFlapDisplayProps
>(
(
{
value,
length,
align = "left",
size = "md",
charset = DEFAULT_CHARSET,
stagger = 0.06,
maxFlaps = DEFAULT_MAX_FLAPS,
className,
...props
},
forwardedRef,
) => {
const ref = React.useRef<HTMLDivElement>(null);
React.useImperativeHandle(
forwardedRef,
() => ref.current as HTMLDivElement,
);
const inView = useInViewOnce(ref);
const upper = value.toUpperCase();
const count = normalizeLength(length, upper.length);
const normalizedMaxFlaps = normalizeMaxFlaps(maxFlaps);
const chars = React.useMemo(() => {
const pad = Math.max(0, count - upper.length);
const body = upper.slice(0, count);
if (align === "left") return (body + " ".repeat(pad)).slice(0, count);
if (align === "right") return (" ".repeat(pad) + body).slice(-count);
const left = Math.floor(pad / 2);
return (" ".repeat(left) + body + " ".repeat(pad - left)).slice(0, count);
}, [upper, count, align]);
return (
<div
ref={ref}
role="img"
aria-label={value}
data-slot="split-flap-display"
className={`inline-flex gap-1 ${alignClasses[align]} rounded-lg bg-muted p-2 ${className ?? ""}`}
{...props}
>
{Array.from(chars).map((char, i) => (
<FlapDigit
// biome-ignore lint/suspicious/noArrayIndexKey: flaps are positional slots
key={i}
target={char}
active={inView}
startDelay={i * stagger}
size={size}
charset={
Array.isArray(charset) ? (charset[i] ?? DEFAULT_CHARSET) : charset
}
maxFlaps={normalizedMaxFlaps}
/>
))}
</div>
);
},
);
SplitFlapDisplay.displayName = "SplitFlapDisplay";
export { SplitFlapDisplay };Réglages · HTML · CSS · JS
Modifiez le code et ajustez-le avec les réglages. L'aperçu se met à jour pendant la saisie.

Ce composant tourne depuis un bundle compilé : son script est en lecture seule ici. Modifiez le HTML et le CSS ; la source complète est dans l'onglet Code.
Modifiez chaque composant en direct, ajustez-le avec des réglages, téléchargez la source complète et copiez les prompts avancés.
49 $ en une foisPrix provisoire
Mode test : aucun paiement réel.
Gratuit : aperçu, boutons de copie et notes de leçon.
Des marges généreuses, des coins doux et une seule couleur d’accent mettent le contenu en avant.
Listes de fonctions, profils, fiches produit et tableaux de bord.
Réglez la marge, la profondeur de l’ombre et la couleur d’accent.
Ajoute le composant « Split-Flap Display » de GodUI (github.com/LucasBassetti/godui) (MIT) à mon application React + Tailwind CSS. Fichier source : https://github.com/LucasBassetti/godui/blob/1f632a76a346f09dc9fe066969906c6f98763e1e/packages/lab/src/split-flap-display. Des marges généreuses, des coins doux et une seule couleur d’accent mettent le contenu en avant. À utiliser pour : Listes de fonctions, profils, fiches produit et tableaux de bord. Réglages à ajuster : Réglez la marge, la profondeur de l’ombre et la couleur d’accent. Prends en charge les thèmes clair et sombre et respecte prefers-reduced-motion. Conserve la mention de licence MIT.
Un prompt plus long avec les étapes de réglage, d'accessibilité et d'intégration.