Class added from settings are not recognized in Icons library with other BO theme like Claro

Created on 8 March 2025, 27 days ago

Problem/Motivation

Sometimes we want to declare settings to be able to inject class in the svg element.

Example :

hero_outline_24:
  label: Hero outline 24
  description: "Beautiful hand-crafted SVG icons, by the makers of Tailwind CSS."
  extractor: svg
  config:
    sources:
      - "/libraries/heroicons/24/outline/{icon_id}.svg"
  settings:
    stroke_width:
      title: Stroke width
      type: "integer"
      enum: [0, 1, 2, 3, 4, 5, 6]
      default: 2
    size:
      title: Size
      type: "integer"
      minimum: 12
      maximum: 128
      multipleOf: 4
      default: 24
    stroke_color:
      title: Fill color
      type: integer
      enum:
        - stroke-current
        - stroke-primary
        - ...
        - stroke-error-content
  template: >
    <svg xmlns="http://www.w3.org/2000/svg"
      viewBox="0 0 24 24"
      height="{{ size|default(24) }}"
      width="{{ size|default(24) }}"
      fill="none"
      class="{{ stroke_color|default('stroke-current') }}"
      stroke-width="{{ stroke_width|default(2) }}"
    >
      {{ content }} 
    </svg>

I have this use case with Tailwind / Heroicons within UI Suite DaisyUI which is working as expected.

There is still an issue when we go to icons library : when navigating with a BO theme different from UI Suite DaisyUI, these classes are not recognized ...

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

🇫🇷France G4MBINI Bègles

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024