Search by

silarhi / ux-icons-js-bundle

guillaume-sainthillier

Render Symfony UX Icons in JavaScript, React and Vue, with the same attributes and configuration as ux_icon() — the PHP companion to @silarhi/ux-icons-js

Package info

github.com/silarhi/ux-icons-js-bundle

Type:symfony-bundle

pkg:composer/silarhi/ux-icons-js-bundle

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 1

v0.1.2 2026-10-20 10:19 UTC

This package is auto-updated.

Last update: 2026-10-20 10:56:53 UTC


README

Latest Stable Version Total Downloads License PHP Version CI Status Coverage npm Version

UX Icons JS Bundle

Render Symfony UX Icons in JavaScript, React and Vue.
Same attributes, same configuration, same HTML as ux_icon(), without innerHTML.

📖 Documentation

A backport of symfony/ux#4072 on top of an unmodified symfony/ux-icons, in two packages released from the same git tag:

  • silarhi/ux-icons-js-bundle (PHP): dumps your local icons, with the attributes ux_icon() gives them, as a JavaScript module with one named export per icon.
  • @silarhi/ux-icons-js (JS/TS): renders them in vanilla JavaScript, React or Vue.

Features

  • Same output as ux_icon(): default_icon_attributes, icon set icon_attributes, suffixes and aliases come from your ux_icons configuration, and the attributes you give follow the ux_icon() rules.
  • Tree-shaken: lucide:trash-2 is exported as LucideTrash2Icon, your bundler drops the icons you never import.
  • Dynamic names: an icon name from an API response loads that icon alone, await loadIcon(loaders, data.icon).
  • No innerHTML: createIconElement() builds SVG elements, the React and Vue components render elements.
  • Works with ux:icons:lock: write the import first, run ux:icons:lock, the icon is downloaded and dumped.

Requirements

PHP 8.2+, Symfony 6.4 / 7.x / 8.x, symfony/ux-icons 2.36.1+ or 3.5+ (3.x needs PHP 8.4; see the compatibility notes for 2.x). React 18/19 and Vue 3 are optional peer dependencies.

Installation

composer require silarhi/ux-icons-js-bundle
pnpm add @silarhi/ux-icons-js
// config/bundles.php — after UXIconsBundle, whose configuration it reuses
Silarhi\UxIconsJsBundle\SilarhiUxIconsJsBundle::class => ['all' => true],

Quick start

The icons are dumped into var/icons/ on cache warmup, or with php bin/console ux-icons-js:dump:

import { createIconElement } from '@silarhi/ux-icons-js'
import { UXIcon } from '@silarhi/ux-icons-js/react' // or '@silarhi/ux-icons-js/vue'
import { LucideTrash2Icon } from '../var/icons/index.js'

button.append(createIconElement(LucideTrash2Icon, { class: 'text-danger', 'aria-label': 'Delete' }))

const icon = <UXIcon icon={LucideTrash2Icon} className="text-danger" aria-label="Delete" />

Documentation

Everything else is on ux-icons-js-bundle.silarhi.dev:

Contributing

See CONTRIBUTING.md. Release notes are in CHANGELOG.md.

License

Released under the MIT License.