Your own tabs or buttons pick a panel, and the content blurs out and the next one settles in. Good for a How I work section or a list of services.
How to use
Make two files in your project's components folder: panel-tabs.tsx and panel-tabs.module.css.
Paste the code into each one, keeping the licence note at the top of the component.
It needs nothing beyond React. Your project needs CSS Modules, which Next.js and Vite already have.
Import it where you want it, then change the words, colours and sizes to yours.
The code
"use client";
import { useEffect, useLayoutEffect, useRef, useState } from "react";
import styles from "./panel-tabs.module.css";
/** Seconds, and a CSS easing or four cubic-bezier numbers. */
export type PanelTransition = { duration?: number; ease?: string | [number, number, number, number] };
/** A panel's look as it comes in ("enter"), sits ("center") and leaves ("exit"), as CSS keyframes, e.g. { opacity: 0, filter: "blur(6px)" }. */
export type PanelVariants = { enter: Keyframe; center: Keyframe; exit: Keyframe };
export type TransitionPanelProps = {
This comes with paid plans
The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.
"use client";
import { useEffect, useLayoutEffect, useRef, useState } from "react";
import styles from "./panel-tabs.module.css";
/** Seconds, and a CSS easing or four cubic-bezier numbers. */
export type PanelTransition = { duration?: number; ease?: string | [number, number, number, number] };
/** A panel's look as it comes in ("enter"), sits ("center") and leaves ("exit"), as CSS keyframes, e.g. { opacity: 0, filter: "blur(6px)" }. */
export type PanelVariants = { enter: Keyframe; center: Keyframe; exit: Keyframe };
export type TransitionPanelProps = {
This comes with paid plans
The code for every component comes with paid plans, along with the rest of the AI toolkit. The first component under each heading is free.