CompositionAvailable

Phosphor Icons

All six Phosphor weights with accessible labels and tree-shakable icon imports.

Loading example…

Installation

Add the component and its dependencies from the registry running on your computer.

terminal
npx shadcn@latest add https://brutallab.facilito.dev/r/icon.json

Usage

Import the component into your project and keep the source code under your control.

tsx
"use client";
import { useState } from "react";
import {
  HeartIcon,
  GaugeIcon,
  RepeatIcon,
  KeyboardIcon,
  SpeakerHighIcon,
  StarIcon,
  type IconWeight,
} from "@phosphor-icons/react";
import { Icon, iconWeights } from "@/components/ui/icon";
export default function Demo() {
  const [weight, setWeight] = useState<IconWeight>("bold");
  return (
    <div className="grid gap-6">
      <label className="flex items-center gap-3">
        Weight / Variante
        <select
          aria-label="Icon weight"
          value={weight}
          onChange={(event) => setWeight(event.target.value as IconWeight)}
          className="rounded border border-ink bg-card text-card-foreground p-2"
        >
          {iconWeights.map((value) => (
            <option key={value}>{value}</option>
          ))}
        </select>
      </label>
      <div className="flex flex-wrap gap-6">
        {[HeartIcon, GaugeIcon, RepeatIcon, KeyboardIcon, SpeakerHighIcon, StarIcon].map(
          (glyph, i) => (
            <Icon key={i} icon={glyph} weight={weight} size={32} />
          ),
        )}
      </div>
      <div className="flex flex-wrap gap-5">
        {iconWeights.map((value) => (
          <div key={value} className="grid justify-items-center gap-2">
            <Icon icon={HeartIcon} weight={value} size={32} />
            <span className="text-xs text-foreground">{value}</span>
          </div>
        ))}
      </div>
    </div>
  );
}

States & interaction

Appearance, behavior and keyboard checks.

  • Bold is the default functional weight. Thin, light and regular for detail; fill for selection; duotone for illustration. Never override stroke-width.
  • Decorative icons do not receive focus. Their button or link defines hover, focus and accessible name.

API Reference

BrutalLab-specific properties. Native attributes are supported as well.

PropTypeDefaultDescription
Phosphor IconSee examplePass any icon imported from @phosphor-icons/react.
thin | light | regular | bold | fill | duotoneboldAll six Phosphor weights. Bold is the functional default; no SVG stroke-width overrides.
IconProps / stringSee exampleSize, color, mirroring and optional accessible label.

Accessibility

Rules that should remain intact when adapting the component to a product.

Controls have accessible names, visible focus and keyboard support.