stenciljs/core

feat: support prop casing for SVG attributes

Closed

#5.674 geöffnet am 16. Apr. 2024

Auf GitHub ansehen
 (1 Kommentar) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (844 Forks)auto 404
Feature: Want this? Upvote it!Help Wanted

Repository-Metriken

Stars
 (13.111 Stars)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

Prerequisites

Describe the Feature Request

It'd be useful to support prop case for SVG attributes (similar to React).

Describe the Use Case

Spreading an object with props onto an SVG will not render properly and warnings/errors will be swallowed.

See repro case.

Describe Preferred Solution

SVG props get mapped to attributes.

In the following example, strokeWidth would be mapped and rendered as stroke-width

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 10">
  <circle cx={15} cy={5} r={3} stroke="green" strokeWidth={3} />
</svg>

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Contributor Guide