Empty State
weekendsuperhero-io-sistine/empty-stateFreeComponent
An empty state component, with the glass material system.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/Weekendsuperhero-io/sistine/main/public/r/empty-state.jsonSource
1import { cva, type VariantProps } from "class-variance-authority";2import * as React from "react";3import { type HoverEffect, hoverEffects } from "@/lib/hover-effects";4import { type MaterialAxisProps, materialSurface, splitAxisProps } from "@/lib/material";5import { cn } from "@/lib/utils";67/* Variant classes carry BEHAVIOR only; the surface comes from materialSurface. */8const emptyStateVariants = cva("", {9 variants: {10 variant: {11 default: "bg-card text-card-foreground border shadow-sm",12 glass: "text-foreground",13 },14 },15 defaultVariants: {16 variant: "glass",17 },18});1920/* Role: borderless adaptive glass. */21const ROLE = {};2223export interface EmptyStateProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof emptyStateVariants>, MaterialAxisProps {24 effect?: HoverEffect;25}2627const EmptyState = React.forwardRef<HTMLDivElement, EmptyStateProps>(({ className, variant = "glass", effect, children, ...props }, ref) => {28 const [axes, rest] = splitAxisProps(props);29 const m = materialSurface(variant === "default" ? null : ROLE, axes);3031 return (32 <div33 ref={ref}34 data-material={m?.["data-material"]}35 className={cn(36 m?.className,37 "flex flex-col items-center justify-center rounded-xl p-12 text-center",38 emptyStateVariants({39 variant,40 }),41 effect &&42 hoverEffects({43 hover: effect,44 }),45 className,46 )}47 {...rest}48 >49 {children}50 </div>51 );52});53EmptyState.displayName = "EmptyState";5455function EmptyStateIcon({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {56 return <div className={cn("mb-4 text-foreground-ui", className)} {...props} />;57}5859function EmptyStateTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {60 return <h3 className={cn("text-lg font-semibold text-foreground mb-2", className)} {...props} />;61}6263function EmptyStateDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {64 return <p className={cn("text-sm text-muted-foreground max-w-sm", className)} {...props} />;65}6667export { EmptyState, EmptyStateDescription, EmptyStateIcon, EmptyStateTitle };
What it pulls in
npm packages
Other registry items
Files it writes
More from weekendsuperhero-io/sistine
All 71 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | weekendsuperhero-io/sistine | Components | Free | 5 deps · 4 files | |
| Alertalert | weekendsuperhero-io/sistine | Components | Free | 3 deps · 4 files | |
| Alert Dialogalert-dialog | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files | |
| Auto Foregroundauto-foreground | weekendsuperhero-io/sistine | Components | Free | no deps | |
| Avataravatar | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files | |
| Badgebadge | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files | |
| Breadcrumbbreadcrumb | weekendsuperhero-io/sistine | Components | Free | 5 deps · 4 files | |
| Buttonbutton | weekendsuperhero-io/sistine | Components | Free | 4 deps · 4 files |
