Skip to content

Instantly share code, notes, and snippets.

@jacobparis
Last active December 11, 2024 11:24
Show Gist options
  • Save jacobparis/5657e2bcb1074b8bf39f19947d319a60 to your computer and use it in GitHub Desktop.
Save jacobparis/5657e2bcb1074b8bf39f19947d319a60 to your computer and use it in GitHub Desktop.
React Icon component
import { type IconName } from "#app/components/icons/icons.ts"
import href from "#app/components/icons/sprite.svg"
export function Icon({
name,
className,
...props
}: React.SVGProps<SVGSVGElement> & {
name: IconName
}) {
return (
<svg {...props} className={`inline self-center ${className}`}>
<use href={`${href}#${name}`} />
</svg>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment