Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
phosphor-icons-tailwindcss
Advanced tools
A TailwindCSS plugin for the Phosphor icon set.
install package:
pnpm add -D phosphor-icons-tailwindcss # or via npm, yarn, ...
register the plugin in your tailwind.config.js
:
// tailwind.config.js
import phosphorIcons from "phosphor-icons-tailwindcss";
/** @type {import("tailwindcss").Config } */
export default {
plugins: [phosphorIcons()],
};
Or if you are using Tailwind 4:
/* app.css, or whatever your entry CSS is */
@import 'tailwindcss';
@plugin 'phosphor-icons-tailwindcss';
[!IMPORTANT] This package only supports ESM. It should work well in most projects today, especially those using Vite.
You need to add two classes to your markup:
ph
class,ph-[<name><--weight>]
, corresponding to your desired icon.[!NOTE]
weight
is optional and defaults to "regular" if not specified.
For example:
<p>
<i class="ph ph-[info]"></i> <!-- render the regular info icon -->
<i class="ph ph-[pulse--duotone]"></i> <!-- render the pulse icon in duotone weight -->
</p>
For all available icon names and weight, visit phosphoricons.com.
The output CSS look something like this:
.ph {
--ph-url: none;
width: 1em;
height: 1em;
background-color: currentcolor;
color: inherit;
mask-image: var(--ph-url);
mask-size: 100% 100%;
mask-repeat: no-repeat;
}
.ph-\[info\] {
url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiBmaWxsPSJjdXJyZW50Q29sb3IiPjxwYXRoIGQ9Ik0xMjgsMjRBMTA0LDEwNCwwLDEsMCwyMzIsMTI4LDEwNC4xMSwxMDQuMTEsMCwwLDAsMTI4LDI0Wm0wLDE5MmE4OCw4OCwwLDEsMSw4OC04OEE4OC4xLDg4LjEsMCwwLDEsMTI4LDIxNlptMTYtNDBhOCw4LDAsMCwxLTgsOCwxNiwxNiwwLDAsMS0xNi0xNlYxMjhhOCw4LDAsMCwxLDAtMTYsMTYsMTYsMCwwLDEsMTYsMTZ2NDBBOCw4LDAsMCwxLDE0NCwxNzZaTTExMiw4NGExMiwxMiwwLDEsMSwxMiwxMkExMiwxMiwwLDAsMSwxMTIsODRaIi8+PC9zdmc+);
}
You may pass a configuration object to the plugin to customize the generated CSS. The following shows the default configuration:
// tailwind.config.js
import phosphorIcons from "phosphor-icons-tailwindcss";
/** @type {import("tailwindcss").Config } */
export default {
plugins: [phosphorIcons({
prefix: 'ph', // for the icon classes
customProperty: '--ph-url',
})],
};
Similarly, for Tailwind 4:
@import 'tailwindcss';
@plugin 'phosphor-icons-tailwindcss' {
prefix: ph;
customProperty: --ph-url;
}
ph-[info]
and not ph-info
?You may notice this library utilizes Tailwind's support for arbitrary value, i.e ph-[info]
instead of ph-info
to map to the regular info icon. This is to avoid unnecessary parsing during development, especially for Taliwind language server. Arbitrary value syntax allows parsing ad-hoc only the icons actually being used. Otherwise, parsing 9000+ icons may cause slow-down that negatively impacts developer experience.
You may find @iconify/tailwindcss helpful if you are already using the iconify ecosystem in your codebase.
phosphor-icons-tailwindcss
tries to stay minimal by only covering Phosphor icons, and it references directly @phosphor-icons/core for the SVG assets.
1.0.1
f058089
Thanks @vnphanquang! - update peerDependencies
to include Tailwind 4 alphaFAQs
Tailwind plugin for Phoshor icon set in pure CSS
The npm package phosphor-icons-tailwindcss receives a total of 30 weekly downloads. As such, phosphor-icons-tailwindcss popularity was classified as not popular.
We found that phosphor-icons-tailwindcss demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.