성능
주의프레임 속도: 평균 60 fps, p5 59.9 · 긴 작업: 1개, 총 88 ms, 최장 88 ms · 소스 gzip 8.1 KB · 런타임 192 KB
Shift TabsMIT토글Animata
Animata가 만든 토글 React 컴포넌트입니다. MIT 라이선스에 따라 Animata에서 수정 없이 수집했으며 여기서 실시간으로 보여 줍니다.
품질 보고
등급과 점수는 빌드 또는 테스트 때 실행한 자동 검사에서 나옵니다. 실행하지 않은 항목은 '미검사'로 표시하며, 숫자를 지어내지 않습니다.
프레임 속도: 평균 60 fps, p5 59.9 · 긴 작업: 1개, 총 88 ms, 최장 88 ms · 소스 gzip 8.1 KB · 런타임 192 KB
문제 0 · 스크린 리더: 통과
지속 움직임 없음
넘침 없음
프레임 속도와 긴 작업 수치는 헤드리스 Chromium에서 소프트웨어 WebGL로 측정했습니다. 이 사이트의 컴포넌트끼리만 비교해야 하며, 실제 기기의 성능이 아닙니다.
해당 없음: 정지 상태에서 보이는 애니메이션이 없습니다. 호버로 시작되는 애니메이션은 검사하지 않았습니다.
axe-core 위반이 없습니다.

검사일 2026년 11월 15일 · 수치는 자동 스크립트에서 오며, 손으로 쓴 예시가 아닙니다.
실제 크기로 보여 줍니다.
복사한 내용은 라이선스 고지로 시작합니다. 코드를 쓸 때 남겨 두세요.
<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-border-style:solid;--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-duration:initial;--tw-ease:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-animation-delay:0s;--tw-animation-direction:normal;--tw-animation-duration:initial;--tw-animation-fill-mode:none;--tw-animation-iteration-count:1;--tw-enter-blur:0;--tw-enter-opacity:1;--tw-enter-rotate:0;--tw-enter-scale:1;--tw-enter-translate-x:0;--tw-enter-translate-y:0;--tw-exit-blur:0;--tw-exit-opacity:1;--tw-exit-rotate:0;--tw-exit-scale:1;--tw-exit-translate-x:0;--tw-exit-translate-y:0}}}@layer theme{:root,:host{--font-sans:-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-mono:"Paper Mono", ui-monospace, monospace;--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-500:oklch(79.5% .184 86.047);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-zinc-200:oklch(92% .004 286.32);--color-zinc-700:oklch(37% .013 285.805);--color-zinc-950:oklch(14.1% .005 285.823);--spacing:.25rem;--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--font-weight-medium:500;--radius-md:calc(var(--radius) - 2px);--radius-lg:var(--radius);--ease-out:cubic-bezier(.22, 1, .36, 1);--default-transition-duration:.2s;--default-transition-timing-function:var(--ease-out);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-border:hsl(var(--border));--color-ring:hsl(var(--ring));--color-background:hsl(var(--background));--color-foreground:hsl(var(--foreground));--color-accent:hsl(var(--accent));--ease-apple:cubic-bezier(.4, 0, .6, 1)}}@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}*{border-color:var(--color-border)}body{background-color:var(--color-background);color:var(--color-foreground)}:root{--background:0 0% 100%;--foreground:0 0% 11%;--card:0 0% 100%;--card-foreground:0 0% 11%;--popover:0 0% 100%;--popover-foreground:0 0% 11%;--primary:0 0% 11%;--primary-foreground:0 0% 100%;--secondary:0 0% 96%;--secondary-foreground:0 0% 11%;--muted:0 0% 96%;--muted-foreground:0 0% 43%;--accent:262 83% 58%;--accent-foreground:0 0% 100%;--destructive:0 84% 60%;--destructive-foreground:0 0% 98%;--border:0 0% 90%;--input:0 0% 90%;--ring:262 83% 58%;--radius:.75rem;--surface-alt:0 0% 96%;--surface-card:0 0% 100%;--surface-dark:0 0% 7%;--text-secondary:0 0% 43%;--ink:#76756f;--ink-faint:#e3e3e3;--link:210 100% 40%;--link-hover:210 100% 32%;--shadow-sm:0 1px 2px #0000000d;--shadow-md:0 2px 8px #0000000f, 0 4px 16px #0000000a;--shadow-lg:0 4px 12px #0000000f, 0 12px 32px #00000014;--footer-surface:#f5f5f7;--footer-ink:#0f1d42;--footer-ink-muted:#1a2d5c;--footer-accent:#1a4fff;--footer-gold:#fc0;--footer-category-title:#1d1d1f;--footer-category-link:#515154;--footer-stamp:#9f9f9f}.dark{--background:0 0% 0%;--foreground:0 0% 96%;--card:0 0% 4%;--card-foreground:0 0% 96%;--popover:0 0% 4%;--popover-foreground:0 0% 96%;--primary:0 0% 96%;--primary-foreground:0 0% 0%;--secondary:0 0% 10%;--secondary-foreground:0 0% 96%;--muted:0 0% 10%;--muted-foreground:0 0% 45%;--accent:262 83% 65%;--accent-foreground:0 0% 100%;--destructive:0 62% 30%;--destructive-foreground:0 0% 98%;--border:0 0% 12%;--input:0 0% 12%;--ring:262 83% 65%;--surface-alt:0 0% 4%;--surface-card:0 0% 6%;--surface-dark:0 0% 2%;--text-secondary:0 0% 55%;--ink:#e3e3e3;--ink-faint:#76756f;--link:262 80% 70%;--link-hover:262 80% 80%;--shadow-sm:none;--shadow-md:none;--shadow-lg:none;--footer-surface:#1d1d1f;--footer-ink:#f5f5f7;--footer-ink-muted:#86868b;--footer-accent:#fc0;--footer-gold:#fc0;--footer-category-title:#f5f5f7;--footer-category-link:#86868b;--footer-stamp:#48484a}}@layer components{.text-animator-demo .text-animation-stage,[data-text-animator-demo] .text-animation-stage{perspective:900px;padding:clamp(1rem,5cqi,1.5rem);font-size:clamp(1rem,10cqi,2rem);font-weight:500;line-height:1.1}.text-animator-demo .text-animation-title,.text-animator-demo .text-animation-kinetic-word,[data-text-animator-demo] .text-animation-title,[data-text-animator-demo] .text-animation-kinetic-word{text-align:center;letter-spacing:-.025em}.text-animator-demo .text-animation-title,[data-text-animator-demo] .text-animation-title{text-wrap:balance;font-variant-numeric:tabular-nums}}@layer utilities{.flex{display:flex}.h-10{height:calc(var(--spacing) * 10)}.origin-top-right{transform-origin:100% 0}.rotate-0{rotate:0deg}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.gap-3{gap:calc(var(--spacing) * 3)}.overflow-visible{overflow:visible}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-accent{border-color:var(--color-accent)}.border-border{border-color:var(--color-border)}.border-b-accent{border-bottom-color:var(--color-accent)}.bg-background{background-color:var(--color-background)}.bg-foreground{background-color:var(--color-foreground)}.bg-transparent{background-color:#0000}.px-1{padding-inline:var(--spacing)}.px-4{padding-inline:calc(var(--spacing) * 4)}.text-center{text-align:center}.font-mono{font-family:var(--font-mono)}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.text-accent{color:var(--color-accent)}.text-foreground{color:var(--color-foreground)}.ring{--tw-ring-shadow:var(--tw-ring-inset, ) 0 0 0 calc(1px + 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)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.hover\:rotate-6:hover{rotate:6deg}.hover\:bg-foreground:hover{background-color:var(--color-foreground)}}.focus-visible\:z-10:focus-visible{z-index:10}.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(--color-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)}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:var(--color-background)}.active\:scale-\[0\.97\]:active{scale:.97}@media (prefers-reduced-motion:reduce){.motion-reduce\:transition-none{transition-property:none}@media (hover:hover){.motion-reduce\:hover\:rotate-0:hover{rotate:0deg}}.motion-reduce\:active\:scale-100:active{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x) var(--tw-scale-y)}}@media (min-width:40rem){.sm\:gap-4{gap:calc(var(--spacing) * 4)}}@keyframes orbit-move{0%{transform:translate(-50%,-50%)rotateY(-40deg)rotateX(70deg)rotate(0)translate(100px)}to{transform:translate(-50%,-50%)rotateY(-40deg)rotateX(70deg)rotate(360deg)translate(100px)}}@keyframes counter-rotate{0%{opacity:1;transform:rotate(0)rotateX(-70deg)rotateY(40deg)scale(1)}25%{opacity:1;transform:rotate(-90deg)rotateX(-70deg)rotateY(40deg)scale(1.2)}50%{opacity:.3;transform:rotate(-180deg)rotateX(-70deg)rotateY(40deg)scale(.8)}75%{opacity:.3;transform:rotate(-270deg)rotateX(-70deg)rotateY(40deg)scale(.8)}to{opacity:1;transform:rotate(-360deg)rotateX(-70deg)rotateY(40deg)scale(1)}}@keyframes orbit-indexes{0%,25%,to{z-index:11}50%,99%{z-index:9}}}@property --tw-animation-delay{syntax:"*";inherits:false;initial-value:0s}@property --tw-animation-direction{syntax:"*";inherits:false;initial-value:normal}@property --tw-animation-duration{syntax:"*";inherits:false}@property --tw-animation-fill-mode{syntax:"*";inherits:false;initial-value:none}@property --tw-animation-iteration-count{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-enter-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-enter-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-blur{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-opacity{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-rotate{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-scale{syntax:"*";inherits:false;initial-value:1}@property --tw-exit-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-exit-translate-y{syntax:"*";inherits:false;initial-value:0}.preview{margin-bottom:calc(var(--spacing) * 4)}.preview-light{background-color:#fefefe;background-image:radial-gradient(#efefef 1px,#0000 1px),radial-gradient(#efefef 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}.preview-dark{background-image:radial-gradient(#6a6a6a 1px,#0000 1px),radial-gradient(#6a6a6a 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}.component-list-item{border-color:var(--color-zinc-200);background-color:#fefefe;background-image:radial-gradient(#efefef 1px,#0000 1px),radial-gradient(#efefef 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}.dark .component-list-item{border-color:var(--color-zinc-700);background-color:var(--color-zinc-950);background-image:radial-gradient(#6a6a6a 1px,#0000 1px),radial-gradient(#6a6a6a 1px,#0000 1px);background-position:0 0,10px 10px;background-size:20px 20px}[style*="opacity: 1"]>.scroll-baby{color:var(--color-yellow-300)}[style*="opacity: 1"]>.scroll-baby:where(.dark,.dark *){color:var(--color-yellow-500)}[style*="opacity: 1"]>.scroll-file{color:var(--color-blue-300)}[style*="opacity: 1"]>.scroll-file:where(.dark,.dark *){color:var(--color-blue-500)}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@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-duration{syntax:"*";inherits:false}@property --tw-ease{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}// animata source (MIT). npm i clsx react tailwind-merge · Tailwind CSS v4
// ── animata/tabs/shared.ts (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/tabs/shared.ts)
import { type FocusEvent, type KeyboardEvent, useCallback, useState } from "react";
import { cn } from "@/lib/utils";
/** Visible focus ring — use with a matching border-radius class. */
export function tabFocusClass(radiusClass: string) {
return cn(
radiusClass,
"outline-none focus-visible:z-10",
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
);
}
export function useTabSelection({
defaultActiveIndex = 0,
activeIndex: activeIndexProp,
onActiveIndexChange,
}: {
defaultActiveIndex?: number;
activeIndex?: number;
onActiveIndexChange?: (index: number) => void;
}) {
const [uncontrolledIndex, setUncontrolledIndex] = useState(defaultActiveIndex);
const [keyboardFocusIndex, setKeyboardFocusIndex] = useState<number | null>(null);
const activeIndex = activeIndexProp ?? uncontrolledIndex;
const focusedIndex = keyboardFocusIndex ?? (activeIndex >= 0 ? activeIndex : 0);
const setActiveIndex = useCallback(
(index: number) => {
onActiveIndexChange?.(index);
if (activeIndexProp === undefined) {
setUncontrolledIndex(index);
}
setKeyboardFocusIndex(null);
},
[activeIndexProp, onActiveIndexChange],
);
const setFocusedIndex = useCallback((index: number) => {
setKeyboardFocusIndex(index);
}, []);
return { activeIndex, setActiveIndex, focusedIndex, setFocusedIndex };
}
export function focusTabInList(tablist: HTMLElement, index: number) {
queueMicrotask(() => {
tablist.querySelectorAll<HTMLElement>('[role="tab"]')[index]?.focus();
});
}
export function handleTabListFocusCapture(
event: FocusEvent<HTMLElement>,
activeIndex: number,
setFocusedIndex: (index: number) => void,
) {
const related = event.relatedTarget as Node | null;
if (related && event.currentTarget.contains(related)) {
return;
}
const index = activeIndex >= 0 ? activeIndex : 0;
setFocusedIndex(index);
focusTabInList(event.currentTarget, index);
}
/** Manual activation: arrows move focus; Enter / Space select the focused tab. */
export function handleTabListKeyDown(
event: KeyboardEvent<HTMLElement>,
count: number,
setActiveIndex: (index: number) => void,
setFocusedIndex: (index: number) => void,
) {
if (count < 1) {
return;
}
const tablist = event.currentTarget;
const tabs = tablist.querySelectorAll<HTMLElement>('[role="tab"]');
const target = event.target as HTMLElement;
const currentTab = target.closest<HTMLElement>('[role="tab"]');
if (!currentTab || !tablist.contains(currentTab)) {
return;
}
const currentIndex = Array.from(tabs).indexOf(currentTab);
if (currentIndex === -1) {
return;
}
if (event.key === "Enter" || event.key === " ") {
event.preventDefault();
setActiveIndex(currentIndex);
setFocusedIndex(currentIndex);
return;
}
if (count < 2) {
return;
}
let next: number | null = null;
switch (event.key) {
case "ArrowRight":
case "ArrowDown":
next = (currentIndex + 1) % count;
break;
case "ArrowLeft":
case "ArrowUp":
next = (currentIndex - 1 + count) % count;
break;
case "Home":
next = 0;
break;
case "End":
next = count - 1;
break;
default:
return;
}
event.preventDefault();
setFocusedIndex(next);
focusTabInList(tablist, next);
}
// ── animata/tabs/shift-tabs.tsx (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/tabs/shift-tabs.tsx)
"use client";
import {
Children,
type ComponentProps,
createContext,
type FocusEvent,
isValidElement,
type KeyboardEvent,
type ReactNode,
use,
useMemo,
} from "react";
import { cn } from "@/lib/utils";
import {
handleTabListFocusCapture,
handleTabListKeyDown,
tabFocusClass,
useTabSelection,
} from "./shared";
type ShiftTabsContextValue = {
activeIndex: number;
setActiveIndex: (index: number) => void;
focusedIndex: number;
setFocusedIndex: (index: number) => void;
};
const ShiftTabsContext = createContext<ShiftTabsContextValue | null>(null);
type ShiftTabSlotContextValue = {
index: number;
};
const ShiftTabSlotContext = createContext<ShiftTabSlotContextValue | null>(null);
function useShiftTabs() {
const context = use(ShiftTabsContext);
if (!context) {
throw new Error("ShiftTabs primitives must be used within <ShiftTabs>.");
}
return context;
}
function ShiftTabSlot({ index, children }: { index: number; children: ReactNode }) {
const value = useMemo(() => ({ index }), [index]);
return <ShiftTabSlotContext.Provider value={value}>{children}</ShiftTabSlotContext.Provider>;
}
function useShiftTabSlot() {
const context = use(ShiftTabSlotContext);
if (!context) {
throw new Error("ShiftTabs.Tab must be a direct child of <ShiftTabs.List>.");
}
return context;
}
type ShiftTabsRootProps = {
children: ReactNode;
defaultActiveIndex?: number;
activeIndex?: number;
onActiveIndexChange?: (index: number) => void;
className?: string;
};
function ShiftTabsRoot({
children,
defaultActiveIndex = 0,
activeIndex: activeIndexProp,
onActiveIndexChange,
className,
}: ShiftTabsRootProps) {
const { activeIndex, setActiveIndex, focusedIndex, setFocusedIndex } = useTabSelection({
defaultActiveIndex,
activeIndex: activeIndexProp,
onActiveIndexChange,
});
const rootContext = useMemo(
() => ({ activeIndex, setActiveIndex, focusedIndex, setFocusedIndex }),
[activeIndex, setActiveIndex, focusedIndex, setFocusedIndex],
);
return (
<ShiftTabsContext.Provider value={rootContext}>
<div className={className}>{children}</div>
</ShiftTabsContext.Provider>
);
}
type ShiftTabsListProps = ComponentProps<"nav"> & {
"aria-label"?: string;
};
function ShiftTabsList({
className,
children,
"aria-label": ariaLabel = "Tabs",
onKeyDown,
onFocusCapture,
...props
}: ShiftTabsListProps) {
const { activeIndex, setActiveIndex, setFocusedIndex } = useShiftTabs();
const tabs = Children.toArray(children).filter(isValidElement);
const count = tabs.length;
return (
<nav aria-label={ariaLabel} className={cn("overflow-visible", className)} {...props}>
<div
role="tablist"
tabIndex={0}
onFocusCapture={(event: FocusEvent<HTMLElement>) => {
onFocusCapture?.(event);
handleTabListFocusCapture(event, activeIndex, setFocusedIndex);
}}
onKeyDown={(event: KeyboardEvent<HTMLElement>) => {
onKeyDown?.(event);
if (!event.defaultPrevented) {
handleTabListKeyDown(event, count, setActiveIndex, setFocusedIndex);
}
}}
className="flex flex-wrap items-center justify-center gap-3 sm:gap-4"
>
{tabs.map((tab, index) => (
<ShiftTabSlot key={tab.key ?? index} index={index}>
{tab}
</ShiftTabSlot>
))}
</div>
</nav>
);
}
function ShiftTabsLabel({ className, ...props }: ComponentProps<"span">) {
return (
<span
className={cn("select-none px-1 text-center font-mono text-sm font-medium", className)}
{...props}
/>
);
}
type ShiftTabsTabProps = ComponentProps<"button"> & {
label?: string;
};
function ShiftTabsTab({
className,
children,
label,
onClick,
onFocus,
...props
}: ShiftTabsTabProps) {
const { activeIndex, setActiveIndex, setFocusedIndex } = useShiftTabs();
const { index } = useShiftTabSlot();
const isSelected = activeIndex === index;
return (
<button
type="button"
role="tab"
aria-selected={isSelected}
{...(label ? { "aria-label": label } : {})}
onClick={(event) => {
onClick?.(event);
if (!event.defaultPrevented) {
setActiveIndex(index);
}
}}
onFocus={(event: FocusEvent<HTMLButtonElement>) => {
onFocus?.(event);
if (!event.defaultPrevented) {
setFocusedIndex(index);
}
}}
className={cn(
tabFocusClass("rounded-lg"),
"transition-colors duration-200",
"active:scale-[0.97] motion-reduce:active:scale-100",
isSelected
? "bg-foreground border-b-2 border-b-accent"
: "bg-transparent hover:bg-foreground",
className,
)}
{...props}
>
<span
className={cn(
"flex h-10 items-center justify-center rounded-md border-2 bg-background px-4",
"transition-transform duration-200 ease-out motion-reduce:transition-none motion-reduce:hover:rotate-0",
isSelected
? "rotate-0 border-accent text-accent"
: "origin-top-right border-border text-foreground hover:rotate-6",
)}
>
{children}
</span>
</button>
);
}
const ShiftTabs = Object.assign(ShiftTabsRoot, {
List: ShiftTabsList,
Tab: ShiftTabsTab,
Label: ShiftTabsLabel,
});
export default ShiftTabs;
export { ShiftTabsLabel, ShiftTabsList, ShiftTabsRoot, ShiftTabsTab, useShiftTabs };
// ── lib/utils.ts (https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/lib/utils.ts)
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}
export function absoluteUrl(path: string) {
return `${process.env.NEXT_PUBLIC_APP_URL}${path}`;
}
// Linear interpolation
export function lerp(a: number, b: number, n: number) {
return (1 - n) * a + n * b;
}
// Get distance between two points
export function getDistance(x1: number, y1: number, x2: number, y2: number) {
return Math.hypot(x2 - x1, y2 - y1);
}컨트롤 · HTML · CSS · JS
코드를 고치고 컨트롤로 다듬어 보세요. 입력하는 대로 미리보기가 바뀝니다.

이 컴포넌트는 번들된 빌드로 실행되므로 여기서는 스크립트를 읽기만 할 수 있습니다. HTML과 CSS는 수정할 수 있고 전체 소스는 코드 탭에 있습니다.
모든 컴포넌트를 바로 편집하고, 컨트롤로 다듬고, 전체 소스를 내려받고, 고급 프롬프트를 복사하세요.
1회 결제 $49임시 가격
테스트 모드: 실제 결제는 이루어지지 않습니다.
무료: 미리보기, 복사 버튼, 레슨 설명.
움직이며 색이 바뀌는 손잡이로 상태를 한눈에 압니다.
설정, 필터, 켜기와 끄기.
트랙 너비, 손잡이 크기, 이징을 조정합니다.
Animata (github.com/codse/animata)(MIT)의 "Shift Tabs (토글)" 컴포넌트를 내 React + Tailwind CSS 앱에 추가해 줘. 소스 파일: https://github.com/codse/animata/blob/25c27e5a874c60a56dcc1609df3b2c4f5f8456f8/animata/tabs/shift-tabs.tsx. 움직이며 색이 바뀌는 손잡이로 상태를 한눈에 압니다. 사용처: 설정, 필터, 켜기와 끄기. 조정할 설정: 트랙 너비, 손잡이 크기, 이징을 조정합니다. 라이트와 다크 테마를 지원하고 prefers-reduced-motion을 존중해 줘. MIT 라이선스 고지는 유지해 줘.
조정, 접근성, 연동 단계까지 담은 긴 프롬프트입니다.