Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lucide Icon Support #322

Open
dimfeld opened this issue Mar 31, 2024 · 0 comments
Open

Lucide Icon Support #322

dimfeld opened this issue Mar 31, 2024 · 0 comments

Comments

@dimfeld
Copy link
Contributor

dimfeld commented Mar 31, 2024

Related: #267

More just reporting some research than a feature request.

lucide-svelte exposes each icon as a Svelte component. If you want to support it in a way that works with the Icon component, the plain lucide package is more similar to how FontAwesome works, though still different enough that it would still require new code paths.

In the lucide package, each icon is a 3-element array. The first element is the tag name to use (I assume always svg? But haven't looked).

The second element is the attributes to put on the tag. I haven't looked enough to see how much these tend to differ.

The third element is an array of the SVG elements to use. As you see in the example below from the User icon, this is not always a path.

[
    "svg",
    {
        "xmlns": "http://www.w3.org/2000/svg",
        "width": 24,
        "height": 24,
        "viewBox": "0 0 24 24",
        "fill": "none",
        "stroke": "currentColor",
        "stroke-width": 2,
        "stroke-linecap": "round",
        "stroke-linejoin": "round"
    },
    [
        [
            "path",
            {
                "d": "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"
            }
        ],
        [
            "circle",
            {
                "cx": "12",
                "cy": "7",
                "r": "4"
            }
        ]
    ]
]

It's theoretically possible that these can be recursive, and something like a <g> could be represented in the 3rd element by ["g", {}, [ subelements ] ]. But I haven't seen that occur in a brief perusal of the package, and given the relative simplicity of the icons here I wouldn't expect it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant