Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

955 B
Raw Blame
import { cva } from "class-variance-authority";
import { Loader2 } from "@langfuse/icons";

const classes = cva("animate-spin", {
  variants: {
    variant: {
      primary: "text-primary",
      muted: "text-muted-foreground",
    },
    size: {
      xxs: "size-3",
      xs: "size-3.5",
      sm: "size-4",
      md: "size-5",
      lg: "size-6",
      xl: "size-8",
      xxl: "size-12",
      full: "size-full",
    },
    display: {
      block: "block",
      inline: "inline",
    },
  },
  defaultVariants: { display: "block" },
});

type ClassProps = NonNullable<Parameters<typeof classes>["0"]>;

type Variant = NonNullable<ClassProps["variant"]>;
type Size = NonNullable<ClassProps["size"]>;
type Display = NonNullable<ClassProps["display"]>;

export function Spinner({
  variant,
  size,
  display,
}: {
  variant?: Variant;
  size: Size;
  display?: Display;
}) {
  return <Loader2 __rawClassName={classes({ variant, size, display })} />;
}