BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/fulldev/ui/icon

icon

fulldev-ui/icon
FreeComponent

fulldev/ui publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by fulldev/ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://ui.full.dev/r/icon.json

Source

src/components/ui/icon/icon.astroui.full.dev/r/icon.json
1---
2import type { HTMLAttributes } from "astro/types"
3
4type Props = Omit<HTMLAttributes<"svg">, "name" | "href"> & {
5 href?: HTMLAttributes<"a">["href"]
6 name?: string | number | null
7}
8
9const { name, href, ...props } = Astro.props
10
11const hrefMap = {
12 "x.com": "x",
13 twitter: "twitter",
14 facebook: "facebook",
15 instagram: "instagram",
16 pinterest: "pinterest",
17 youtube: "youtube",
18 tiktok: "tiktok",
19 snapchat: "snapchat",
20 reddit: "reddit",
21 tumblr: "tumblr",
22 "wa.me": "whatsapp",
23 telegram: "telegram",
24 discord: "discord",
25 vimeo: "vimeo",
26 flickr: "flickr",
27 yelp: "yelp",
28 spotify: "spotify",
29 behance: "behance",
30 dribbble: "dribbble",
31 soundcloud: "soundcloud",
32 github: "github",
33 twitch: "twitch",
34 "tel:": "phone",
35 "mailto:": "mail",
36 "maps.app.goo.gl": "map-pin",
37 linkedin: "linkedin",
38} as const
39
40const icons = import.meta.glob(
41 [
42 "/node_modules/lucide-static/icons/*.svg",
43 "/node_modules/simple-icons/icons/*.svg",
44 ],
45 { eager: true }
46) as Record<string, { default: any }>
47
48const foundPath = () => {
49 let foundPath: string | undefined = undefined
50
51 // For x.com, use the Simple Icons X instead of Lucide's X icon.
52 if (name === "x.com") {
53 foundPath = "/node_modules/simple-icons/icons/x.svg"
54 } else if (name) {
55 foundPath = Object.keys(icons).find((key) => key.includes(`/${name}.svg`))
56 } else if (href) {
57 const hrefKey = Object.keys(hrefMap).find((key) =>
58 href.toString().includes(key)
59 )
60 const hrefValue = hrefMap[hrefKey as keyof typeof hrefMap]
61 foundPath = Object.keys(icons)
62 .reverse()
63 .find((key) => key.includes(`/${hrefValue}.svg`))
64 }
65
66 return foundPath
67}
68
69const iconPath = foundPath()
70const module = iconPath ? icons[iconPath] : undefined
71const Comp = module?.default
72---
73
74{
75 Comp && foundPath()?.includes("simple-icons") && (
76 <Comp
77 height={24}
78 width={24}
79 fill="currentColor"
80 class="size-[1em] text-base"
81 {...props}
82 />
83 )
84}
85
86{
87 Comp && foundPath()?.includes("lucide-static") && (
88 <Comp
89 height={24}
90 width={24}
91 fill="none"
92 class="size-[1em] text-base"
93 {...props}
94 />
95 )
96}

What it pulls in

npm packages

  • lucide-static
  • simple-icons

Files it writes

  • src/components/ui/icon/icon.astro
  • src/components/ui/icon/index.ts

Facts

Registry
fulldev/ui
Type
registry:ui
Access
Free
Files written
2
Licence
MIT
First indexed
2026-08-02
Last confirmed
today

Go to the source

Docs on fulldev/ui ui.full.dev fulldotdev/ui on GitHub Raw registry item This item as JSON

More from fulldev/ui

All 144 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionfulldev/uiComponentsFree1 dep · 5 files
alertalertfulldev/uiComponentsFreeno deps · 5 files
alert-dialogalert-dialogfulldev/uiComponentsFree1 dep · 13 files
avataravatarfulldev/uiComponentsFreeno deps · 7 files
badgebadgefulldev/uiComponentsFreeno deps · 3 files
bannerbannerfulldev/uiComponentsFreeno deps · 3 files
breadcrumbbreadcrumbfulldev/uiComponentsFreeno deps · 8 files
buttonbuttonfulldev/uiComponentsFreeno deps · 3 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex