Skip to content
All components
Primitives

Featured icon

Draw attention to a section, dialog, empty state or feature with an icon framed in a decorative container.

An icon in a decorative container: four treatments, two shapes, four sizes.

Installation

tdpxl is not an npm dependency of your app. The @tdpxl/cli command (not published to npm yet) copies the source into your project, with the registry items and npm packages it imports.

npx @tdpxl/cli add featured-icon

Then import it from @/components/ui/featured-icon. New project? Start with the installation guide.

Examples

Each example is one branch of the official demo, rendered in its own frame. The code is that branch as you would write it, with imports pointing at the default install paths.

Emphasis

Compare the light, gradient, dark and outline treatments. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { FlagIcon } from "lucide-react"

import { FeaturedIcon } from "@/components/ui/featured-icon"

export function FeaturedIconEmphasis() {
  return (
    <div className="flex w-full max-w-md flex-col gap-6">
      <div className="flex flex-wrap items-center gap-3">
        <FeaturedIcon emphasis="light">
          <FlagIcon />
        </FeaturedIcon>
        <FeaturedIcon emphasis="gradient">
          <FlagIcon />
        </FeaturedIcon>
        <FeaturedIcon emphasis="dark">
          <FlagIcon />
        </FeaturedIcon>
        <FeaturedIcon emphasis="outline">
          <FlagIcon />
        </FeaturedIcon>
      </div>
    </div>
  )
}

Colors

Compare featured icon color roles. Color is decorative; nearby text carries the meaning. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import {
  AlertTriangleIcon,
  CheckCircle2Icon,
  InboxIcon,
  LockIcon,
  MailIcon,
  SparklesIcon,
  Trash2Icon,
} from "lucide-react"

import { FeaturedIcon } from "@/components/ui/featured-icon"

export function FeaturedIconColors() {
  return (
    <div className="flex w-full max-w-md flex-col gap-6">
      <div className="flex flex-wrap items-center gap-3">
        <FeaturedIcon color="neutral">
          <InboxIcon />
        </FeaturedIcon>
        <FeaturedIcon color="primary">
          <SparklesIcon />
        </FeaturedIcon>
        <FeaturedIcon color="success">
          <CheckCircle2Icon />
        </FeaturedIcon>
        <FeaturedIcon color="warning">
          <AlertTriangleIcon />
        </FeaturedIcon>
        <FeaturedIcon color="error">
          <Trash2Icon />
        </FeaturedIcon>
        <FeaturedIcon color="information">
          <MailIcon />
        </FeaturedIcon>
        <FeaturedIcon color="highlight">
          <LockIcon />
        </FeaturedIcon>
      </div>
    </div>
  )
}

Square sizes

Compare the square shape across the four sizes; the radius and the icon scale with the container. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { UploadCloudIcon } from "lucide-react"

import { FeaturedIcon } from "@/components/ui/featured-icon"

export function FeaturedIconSquareSizes() {
  return (
    <div className="flex w-full max-w-md flex-col gap-6">
      <div className="flex flex-wrap items-end gap-3">
        <FeaturedIcon size="sm" shape="square" emphasis="gradient">
          <UploadCloudIcon />
        </FeaturedIcon>
        <FeaturedIcon size="md" shape="square" emphasis="gradient">
          <UploadCloudIcon />
        </FeaturedIcon>
        <FeaturedIcon size="lg" shape="square" emphasis="gradient">
          <UploadCloudIcon />
        </FeaturedIcon>
        <FeaturedIcon size="xl" shape="square" emphasis="gradient">
          <UploadCloudIcon />
        </FeaturedIcon>
      </div>
    </div>
  )
}

In context

Lead a heading and description with a featured icon. The icon stays decorative because the heading says the same thing. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { AlertTriangleIcon } from "lucide-react"

import { FeaturedIcon } from "@/components/ui/featured-icon"

export function FeaturedIconInContext() {
  return (
    <div className="flex w-full max-w-md flex-col gap-6">
      <div className="flex items-start gap-4 rounded-12 border border-soft-200 bg-white-0 p-4">
        <FeaturedIcon color="error" size="lg">
          <AlertTriangleIcon />
        </FeaturedIcon>
        <div className="flex flex-col gap-1">
          <p className="text-label-md text-strong-950">Delete project</p>
          <p className="text-paragraph-sm text-sub-600">
            The project and its files will be removed for everyone. This cannot be undone.
          </p>
        </div>
      </div>
    </div>
  )
}

Labelled

Give a standalone featured icon an accessible name with label; it is then exposed as one named image. Preserves the complete example's required parts, labels and providers. The example's local state remains owned by that composition.

"use client"

import { CheckCircle2Icon } from "lucide-react"

import { FeaturedIcon } from "@/components/ui/featured-icon"

export function FeaturedIconLabelled() {
  return (
    <div className="flex w-full max-w-md flex-col gap-6">
      <div className="flex items-center gap-3">
        <FeaturedIcon color="success" emphasis="dark" label="Verified">
          <CheckCircle2Icon />
        </FeaturedIcon>
        <span className="text-paragraph-sm text-sub-600">Standalone icon with an accessible name</span>
      </div>
    </div>
  )
}

API reference

Generated from the component's TypeScript signatures. Inherited DOM and primitive props are listed separately.

FeaturedIcon

Frame an icon in a decorative container to draw attention to a section, an empty state or a dialog. Hidden from assistive technology unless label is set.

FeaturedIcon props
PropTypeDefaultDescription
inputMode"search" | "text" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined—Hints at the type of data that might be entered by the user while editing the element or its contents
aria-describedbystring | undefined—Identifies the element (or elements) that describes the object.
aria-invalidboolean | "false" | "true" | "grammar" | "spelling" | undefined—Indicates the entered value does not conform to the format expected by the application.
aria-labelstring | undefined—Defines a string value that labels the current element.
aria-labelledbystring | undefined—Identifies the element (or elements) that labels the current element.
childrenReact.ReactNode—Represents all of the things React can render.
color"primary" | "neutral" | "error" | "success" | "warning" | "information" | "highlight" | null | undefined"primary"Semantic color role of the container and icon. Decorative: keep any meaning in nearby text.
emphasis"light" | "gradient" | "dark" | "outline" | null | undefined"light"Visual treatment: light tint, soft gradient, solid dark fill or outlined surface.
shape"circle" | "square" | null | undefined"circle"circle or square (rounded corners that scale with size).
size"sm" | "md" | "lg" | "xl" | null | undefined"md"sm 32px, md 40px, lg 48px, xl 56px; the icon scales with it.
labelstring | undefined—Accessible name. When set, the icon is exposed as an image with this name; omit it when nearby text says the same thing.
Inherited props (13)
FeaturedIcon inherited props
PropTypeDefaultDescription
classNamestring | undefined—Additional classes for this part. Preserve contrast, visible focus and responsive content when adapting styles.
refReact.Ref<HTMLSpanElement> | undefined—Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref).
defaultCheckedboolean | undefined—Initial checked state for a control supporting uncontrolled selection. Inherited DOM typing does not give a layout wrapper checkbox behavior.
defaultValuestring | number | readonly string[] | undefined—Initial value for a control supporting uncontrolled state. Inherited DOM typing alone does not give a layout wrapper input behavior.
autoFocusboolean | undefined—Request automatic focus when the element mounts or the primitive opens, according to its source behavior. Choose initial focus deliberately in context.
idstring | undefined—Stable DOM identifier used by labels, descriptions or other explicit associations.
roleReact.AriaRole | undefined—Semantic role appropriate to the rendered element. Preserve required relationships and keyboard behavior.
onFocusReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native focus event. Preserve the component's existing keyboard and focus behavior.
onBlurReact.FocusEventHandler<HTMLSpanElement> | undefined—Receive the native blur event when focus leaves this control.
onChangeReact.ChangeEventHandler<HTMLSpanElement, Element> | undefined—Receive the native change event; read the actual control value or checked state from its event target.
onKeyDownReact.KeyboardEventHandler<HTMLSpanElement> | undefined—Receive keyboard events. Preserve built-in keyboard behavior unless deliberately implementing an accessible alternative.
onClickReact.MouseEventHandler<HTMLSpanElement> | undefined—Receive activation events. The consumer owns the action performed and its result.
onSelectReact.ReactEventHandler<HTMLSpanElement> | undefined—Handle the selection event defined by this part's source signature. DOM text-selection events differ from menu or command activation callbacks.

Accessibility & usage

From registry/ui/featured-icon.meta.json (authored guidance; human review may still be pending). Behavior is checked by Storybook tests, not certified here.

When to use

  • Lead a dialog, empty state, card or feature list with a recognizable icon.
  • Reinforce the tone of a message, such as an error or success, next to text that states it.
  • Mark steps or features in marketing and onboarding layouts.

When not to use

  • An icon that people click; use an icon-only button with a name.
  • A status that must be read; use an alert or a badge with text.
  • A person or entity; use an avatar.

Anatomy

FeaturedIcon
Container with color, emphasis (light, gradient, dark, outline), shape (circle, square) and size (sm to xl).
Icon
Single SVG child, sized by the container.

Keyboard & interaction

  • Not focusable and not operable.
  • Hidden from assistive technology unless label is set; with label it is role=img with that name.

Responsive behavior

  • Sizes are fixed so the icon stays crisp; choose a smaller size in dense or narrow layouts.
  • Keep the icon beside or above its text so they reflow together.

Content guidelines

  • Choose an icon that matches the nearby heading.
  • Write a label only for standalone icons, describing the meaning ('Verified'), not the picture ('Green check').

Alternatives

  • Button — An operable icon-only action with an accessible name.
  • Avatar — A picture or initials that identify a person.
  • Badge — A short readable status.
  • Empty — A complete empty state with title, description and actions.

Resources