Skip to content

Featured Icon

An icon in a tinted container that leads cards, empty states and dialogs. Light, hard and outlined, six colours.

Version 0.2.0 ·

Featured Icon
Direction
Theme
Viewport

Installation

bunx --bun shadcn@latest add @dga/featured-icon

Usage

page.tsx
tsx
import { CheckmarkCircle02Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import { FeaturedIcon } from "@/components/ui/featured-icon";

<FeaturedIcon variant="success">
  <HugeiconsIcon icon={CheckmarkCircle02Icon} />
</FeaturedIcon>

A featured icon draws attention to a card, an empty state or a dialog, and hints at its meaning with colour.

Anatomy

  • Root: the tinted square or circle.
  • Icon: any Hugeicons icon, sized to the container (16 to 28px).

Examples

Appearance and colour

light is a tint, hard a solid fill and outlined a ring, in brand, neutral, success, error, warning and info. Sizes sm 32px to xl 56px; circle makes it round.

RTL

Place it at the start of a card; directional icons need rtl:-scale-x-100.

LTR (English)
RTL (Arabic)

Accessibility

  • Decorative by default (aria-hidden), because the text next to it carries the meaning.
  • If the icon alone carries meaning, pass role="img" and an aria-label.
  • Icons are checked at 3:1 against their fill and the page surface.

API Reference

FeaturedIcon

An icon in a tinted container, used to lead cards, empty states and dialogs. Decorative by default; pass role="img" and an aria-label if the icon carries meaning.

FeaturedIcon props
PropTypeDefault
"brand" | "neutral" | "success" | "error" | "warning" | "info"

Colour family.

"brand"
"light" | "outlined" | "hard"

`light` is a tinted container, `hard` a solid one and `outlined` a ring.

"light"
"sm" | "md" | "lg" | "xl"

Container size: `sm` 32px up to `xl` 56px.

"xl"
boolean

Round container instead of square.

false

Also accepts the props of the element it renders.

Deviations from DGA

ChangeReason
--featured-icon-brand-background (new)Featured icon brand hard fill (white icon): primary-sa-flag-600.
--featured-icon-brand-background-light (new)Featured icon brand light fill: primary-sa-flag-50, primary-sa-flag-950 in dark mode.
--featured-icon-brand-icon (new)Featured icon brand icon on the light fill and outlined: primary-sa-flag-600, primary-sa-flag-300 in dark mode.
--featured-icon-brand-border (new)Featured icon brand outlined border: primary-sa-flag-200, primary-sa-flag-800 in dark mode.

View all 26 deviations for this component

Contrast

108 pairs checked · all pass WCAG 2.1 AAShow 18 states
Variant / stateLightDark
brand / hard4.74:1 3:18.82:1 3:1
brand / light4.53:1 3:17.57:1 3:1
brand / outlined4.54:1 3:110.38:1 3:1
neutral / hard4.77:1 3:14.59:1 3:1
neutral / light4.34:1 3:17.51:1 3:1
neutral / outlined4.57:1 3:19.38:1 3:1
success / hard5.69:1 3:18.72:1 3:1
success / light5.39:1 3:17.88:1 3:1
success / outlined5.44:1 3:110.80:1 3:1
error / hard4.83:1 3:19.68:1 3:1
error / light4.44:1 3:17.04:1 3:1
error / outlined4.62:1 3:19.01:1 3:1
warning / hard5.42:1 3:19.32:1 3:1
warning / light5.20:1 3:18.57:1 3:1
warning / outlined5.19:1 3:111.30:1 3:1
info / hard4.56:1 3:19.24:1 3:1
info / light4.25:1 3:17.49:1 3:1
info / outlined4.37:1 3:19.88:1 3:1

Text needs 4.5:1, icons and focus rings 3:1. Disabled states are exempt. Full contrast report