bysages

Icon

Component

About

An inline icon wrapper that sizes any SVG glyph to the surrounding text's font size and color, used to drop a registry glyph or a custom SVG into a sentence or heading.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Icon to your project and fits it to your theme.

Code

How Icon is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { Icon } from "@/components/ui/icon";

const drop = (
  <svg viewBox="0 0 24 24">
    <path d="M12 2.5c3.5 4.4 6.5 8.2 6.5 11.4a6.5 6.5 0 1 1-13 0C5.5 10.7 8.5 6.9 12 2.5Z" />
  </svg>
);

export default function IconSizesDemo() {
  return (
    <p
      style={{
        margin: 0,
        display: "flex",
        alignItems: "center",
        gap: "var(--bs-space-4, 1rem)",
        color: "var(--foreground)",
      }}
    >
      <Icon size="sm" label="Small drop">
        {drop}
      </Icon>
      <Icon size="md" label="Medium drop">
        {drop}
      </Icon>
      <Icon size="lg" label="Large drop">
        {drop}
      </Icon>
    </p>
  );
}

Dependencies

More by bysages

View all
  • Switch

    Switch

    13
  • Avatar Group

    Avatar Group

    5
  • Typography

    Typography

    4
  • Spinner

    Spinner

    4
  • Grid

    Grid

  • Float Button

    Float Button

  • Timeline

    Timeline

  • Floating Panel

    Floating Panel