Skip to content
Primitives

Featured Icon

An icon in a tinted container — sizes, square/circle shapes, and semantic colors.

Motionnone

Install

Install Kineto and follow the theme setup once in your app.

bash
npm install kineto
tsx
import { FeaturedIcon, featuredIconVariants } from "kineto/featured-icon";

Preview

tsx
import * as React from "react";
import { cva, type VariantProps } from "class-variance-authority";
import { type LucideIcon } from "lucide-react";

import { cn } from "@/lib/cn";

const featuredIconVariants = cva(
  "inline-flex shrink-0 items-center justify-center [&_svg]:shrink-0",
  {
    variants: {
      size: {
        sm: "size-9 [&_svg]:size-4",
        md: "size-11 [&_svg]:size-5",
        lg: "size-14 [&_svg]:size-6",
      },
      shape: {
        square: "rounded-xl",
        circle: "rounded-full",
      },
      variant: {
        brand: "bg-brand/10 text-brand",
        gradient: "bg-gradient-brand text-brand-foreground shadow-soft",
        gray: "bg-muted text-muted-foreground",
        success: "bg-success/12 text-success",
        warning: "bg-warning/15 text-warning",
        destructive: "bg-destructive/10 text-destructive",
        outline: "border border-border bg-card text-foreground shadow-xs",
      },
    },
    defaultVariants: { size: "md", shape: "square", variant: "brand" },
  }
);

export interface FeaturedIconProps
  extends React.HTMLAttributes<HTMLSpanElement>,
    VariantProps<typeof featuredIconVariants> {
  icon: LucideIcon;
}

const FeaturedIcon = React.forwardRef<HTMLSpanElement, FeaturedIconProps>(
  ({ className, icon: Icon, size, shape, variant, ...props }, ref) => (
    <span
      ref={ref}
      className={cn(featuredIconVariants({ size, shape, variant }), className)}
      {...props}
    >
      <Icon />
    </span>
  )
);
FeaturedIcon.displayName = "FeaturedIcon";

export { FeaturedIcon, featuredIconVariants };

src/components/ui/featured-icon.tsx

Props

PropTypeDefaultDescription
iconLucideIcon—The icon to render.
variant"brand" | "gradient" | "gray" | "success" | "warning" | "destructive" | "outline""brand"Color.
size / shape"sm|md|lg" / "square|circle"—Sizing and shape.