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 Vue Package #174

Merged
merged 17 commits into from
Feb 22, 2021
Merged

Conversation

ericfennis
Copy link
Member

@ericfennis ericfennis commented Jan 23, 2021

The lucide vue npm package.

Alpha pre-release on: 0.12.0-alpha.5.
Feedback is welcome!

Docs here below:

Lucide Vue

Use the lucide icon library in you Vue app.

Installation

yarn add lucide-vue

# or

npm install lucide-vue

How to use

It's build with ESmodules so it's completely threeshakable.
Each icon can be imported as a vue component.

Example

You can pass additional props to adjust the icon.

<template>
  <Camera
    color="red"
    :size="32"
  />
</template>

<script>
// Returns Vue component
import { Camera } from 'lucide-vue';

export default {
  name: "My Component",
  components: { Camera }
}

</script>

Props

name type default
size Number 24
color String currentColor
strokeWidth Number 2

Custom props

You can also pass custom props that will be added in the svg as attributes.

<template>
  <Camera fill="red" />
</template>

One generic icon component

It is possible to create one generic icon component to load icons.

⚠️ Example below importing all EsModules, caution using this example, not recommended when you using bundlers, your application build size will grow strongly.

Icon Component Example

...

WIP

@ericfennis ericfennis changed the title Lucide Vue Package 📦 Lucide Vue Package Jan 23, 2021
@mittalyashu
Copy link
Member

mittalyashu commented Jan 27, 2021

@ericfennis I was trying using the vue package, it doesn't add class attribute to icon

(forget about the second alert, see the first one)

CleanShot 2021-01-27 at 10 55 35@2x

<success-icon
	v-if="type === 'success'"
	class="alert-icon alert-icon-success"
/>

I can try adding a class to parent tag (non lucide icon) and target its child using CSS selector.

@ericfennis
Copy link
Member Author

@mittalyashu Thanks for testing this, I will add this test case to tests. To be clear, you using Vue 2 right?

@mittalyashu
Copy link
Member

To be clear, you using Vue 2 right?

@ericfennis yes

@mittalyashu
Copy link
Member

@ericfennis I mean, we can be discussed if we should add support for custom class and style attribute or not (you don't have to take my word).

@ericfennis
Copy link
Member Author

@mittalyashu Intentionally I wanted to support that, like we do with the react package. I consider this as a bug.

@mittalyashu
Copy link
Member

okay

@mittalyashu
Copy link
Member

Any ETA when non alpha/beta version will be released? @ericfennis

@ericfennis
Copy link
Member Author

I hope Soon, I'm working on it right now. But have some problems with inheriting styling and classes.

@ericfennis
Copy link
Member Author

@mittalyashu Just released 0.12.0-alpha.5 style and class attributes seems to work now.

@mittalyashu
Copy link
Member

Yup, seems to be working fine.

CleanShot 2021-01-28 at 10 46 29@2x

@vercel
Copy link

vercel bot commented Feb 16, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/lucide/lucide/5opQFhSCP4D29WmnmpiTNLYhZMNQ
✅ Preview: https://lucide-git-fork-ericfennis-feature-lucide-vue-lucide.vercel.app

@ericfennis ericfennis merged commit 4024911 into lucide-icons:master Feb 22, 2021
realguse pushed a commit to realguse/lucide that referenced this pull request Dec 25, 2024
* add configs

* Add vue components

* Add documentation

* add alpha release version

* improve npm ignore files

* add tests

* Make style and class attrs work

* 📦 bump version

* Add Icon suffix for component names

* bump version

* Add icon component example

* remove space

* improvements package.json

* update tests

* update workflow
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

Successfully merging this pull request may close these issues.

2 participants