Application
Empty State
Centered placeholder with a featured icon, title, description, and an action.
MotionstaggerContainer + fadeUp on view
Install
Install Kineto and follow the theme setup once in your app.
bash
npm install kinetotsx
import { EmptyState } from "kineto/empty-state";Preview
No messages yet
When you receive messages, they'll show up here.
tsx
"use client";
import * as React from "react";
import { motion, type HTMLMotionProps } from "motion/react";
import { type LucideIcon } from "lucide-react";
import { cn } from "@/lib/cn";
import { FeaturedIcon } from "@/components/ui/featured-icon";
import { fadeUp, staggerContainer, viewportOnce } from "@/lib/motion-presets";
export interface EmptyStateProps extends Omit<HTMLMotionProps<"div">, "title"> {
icon?: LucideIcon;
title: React.ReactNode;
description?: React.ReactNode;
action?: React.ReactNode;
}
const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(
({ className, icon: Icon, title, description, action, ...props }, ref) => (
<motion.div
ref={ref}
variants={staggerContainer(0.07)}
initial="hidden"
whileInView="visible"
viewport={viewportOnce}
className={cn(
"flex flex-col items-center justify-center rounded-xl border border-dashed border-border bg-card/40 px-6 py-14 text-center",
className
)}
{...props}
>
{Icon ? (
<motion.div variants={fadeUp} className="mb-4">
<FeaturedIcon icon={Icon} variant="gray" size="lg" shape="circle" />
</motion.div>
) : null}
<motion.h3
variants={fadeUp}
className="font-display text-lg font-semibold tracking-tight"
>
{title}
</motion.h3>
{description ? (
<motion.p
variants={fadeUp}
className="mt-1.5 max-w-sm text-sm text-muted-foreground"
>
{description}
</motion.p>
) : null}
{action ? (
<motion.div variants={fadeUp} className="mt-5">
{action}
</motion.div>
) : null}
</motion.div>
)
);
EmptyState.displayName = "EmptyState";
export { EmptyState };src/components/ui/empty-state.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| icon | LucideIcon | — | Shown in a circular featured icon. |
| title / description | ReactNode | — | Copy. |
| action | ReactNode | — | e.g. a Button. |