mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-05-18 11:25:09 +02:00
General improvements in documentation (#1348)
* General improvements in documentation * fix typo * Update lucide-angular.md * Fix build * remove duplicated key --------- Co-authored-by: Karsa <contact@karsa.org>
This commit is contained in:
@@ -8,14 +8,6 @@ const DATE_OF_FORK = '2020-06-08T16:39:52+0100';
|
||||
|
||||
const directory = path.join(process.cwd(), "../icons");
|
||||
|
||||
export function getAllNames() {
|
||||
const fileNames = fs.readdirSync(directory).filter((file) => path.extname(file) === '.json');
|
||||
|
||||
return fileNames
|
||||
.filter((fileName) => fs.existsSync(directory + '/' + path.basename(fileName, '.json') + '.svg'))
|
||||
.map((fileName) => path.basename(fileName, '.json'));
|
||||
}
|
||||
|
||||
export interface GetDataOptions {
|
||||
withChildKeys?: boolean
|
||||
}
|
||||
@@ -49,7 +41,7 @@ export async function getData(name: string) {
|
||||
}
|
||||
|
||||
export async function getAllData(): Promise<{ name: string, iconNode: IconNodeWithKeys}[]> {
|
||||
const names = getAllNames();
|
||||
const names = Object.keys(iconNodes);
|
||||
|
||||
return Promise.all(names.map((name) => getData(name)));
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ watch(absoluteStrokeWidth, (enabled) => {
|
||||
<ResetButton @click="resetStyle"></ResetButton>
|
||||
</h2>
|
||||
<p class="copy">
|
||||
Lucide has a lot of customization options to match the icons with you UI.
|
||||
Lucide has a lot of customization options to match the icons with your UI.
|
||||
</p>
|
||||
|
||||
<div class="customizer">
|
||||
|
||||
@@ -28,7 +28,7 @@ For more details, see the [documentation](packages/lucide.md).
|
||||
|
||||
## React
|
||||
|
||||
Implementation of the lucide icon library for react applications.
|
||||
Implementation of the lucide icon library for React applications.
|
||||
|
||||
::: code-group
|
||||
|
||||
@@ -47,84 +47,138 @@ npm install lucide-react
|
||||
:::
|
||||
|
||||
For more details, see the [documentation](packages/lucide-react.md).
|
||||
For React Native use the `lucide-react-native` package.
|
||||
|
||||
## Vue 2
|
||||
## Vue
|
||||
|
||||
Implementation of the lucide icon library for vue applications.
|
||||
Implementation of the lucide icon library for Vue applications.
|
||||
|
||||
```bash
|
||||
yarn add lucide-vue
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-vue-next
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
npm install lucide-vue
|
||||
```
|
||||
|
||||
For more details, see the [documentation](packages/lucide-vue.md).
|
||||
|
||||
## Vue 3
|
||||
|
||||
Implementation of the lucide icon library for vue applications.
|
||||
|
||||
```bash
|
||||
```sh [yarn]
|
||||
yarn add lucide-vue-next
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-vue-next
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
For more details, see the [documentation](packages/lucide-vue-next.md).
|
||||
For Vue 2 use the `lucide-vue` package.
|
||||
|
||||
## Svelte
|
||||
|
||||
Implementation of the lucide icon library for vue applications.
|
||||
Implementation of the lucide icon library for Svelte applications.
|
||||
|
||||
```bash
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-svelte
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-svelte
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-svelte
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
For more details, see the [documentation](packages/lucide-svelte.md).
|
||||
|
||||
## Solid
|
||||
|
||||
Implementation of the lucide icon library for Solid applications.
|
||||
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-solid
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-solid
|
||||
```
|
||||
|
||||
```sh [npm]
|
||||
npm install lucide-solid
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
For more details, see the [documentation](packages/lucide-solid.md).
|
||||
|
||||
## Angular
|
||||
|
||||
```bash
|
||||
Implementation of the lucide icon library for Angular applications.
|
||||
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-angular
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-angular
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-angular
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
For more details, see the [documentation](packages/lucide-angular.md).
|
||||
|
||||
## Preact
|
||||
|
||||
Implementation of the lucide icon library for preact applications.
|
||||
|
||||
```bash
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-preact
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-preact
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-preact
|
||||
```
|
||||
|
||||
For more details, see the [documentation](packages/lucide-preact.md).
|
||||
:::
|
||||
|
||||
## Static usage
|
||||
|
||||
Implementation of the lucide icon library for multiple usages that like to use: SVG files icons, SVG Sprite, Icon Fonts and static SVG strings export in Common JS modules (for NodeJS).
|
||||
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-static
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-static
|
||||
```
|
||||
|
||||
```sh [npm]
|
||||
npm install lucide-static
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
For more details, see the [documentation](packages/lucide-static.md).
|
||||
|
||||
## Figma
|
||||
|
||||
@@ -134,16 +188,6 @@ Visit [Figma community page](https://www.figma.com/community/plugin/939567362549
|
||||
|
||||

|
||||
|
||||
## Laravel
|
||||
|
||||
Implementation of Lucide icon's using `blade-icons` for Laravel based projects.
|
||||
|
||||
```bash
|
||||
composer require mallardduck/blade-lucide-icons
|
||||
```
|
||||
|
||||
For more details, see the [documentation](https://github.com/mallardduck/blade-lucide-icons/blob/main/README.md).
|
||||
|
||||
## Flutter
|
||||
|
||||
Implementation of Lucide icon library for Flutter applications.
|
||||
|
||||
@@ -4,16 +4,22 @@ Implementation of the lucide icon library for Angular applications.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-angular
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-angular
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
```sh [npm]
|
||||
npm install lucide-angular
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## How to use
|
||||
|
||||
### Step 1: Import `LucideAngularModule`
|
||||
@@ -98,7 +104,9 @@ To add custom icons, you will first need to convert them to an [svgson format](h
|
||||
|
||||
## Loading all icons
|
||||
|
||||
> :warning: You may also opt to import all icons if necessary using the following format but be aware that this will significantly increase your application build size.
|
||||
::: danger
|
||||
You may also opt to import all icons if necessary using the following format but be aware that this will significantly increase your application build size.
|
||||
:::
|
||||
|
||||
```js
|
||||
import { icons } from 'lucide-angular';
|
||||
|
||||
@@ -8,28 +8,34 @@ Implementation of the lucide icon library for preact applications.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-preact
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-preact
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-preact
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## How to use
|
||||
|
||||
It's build with ESmodules so it's completely tree-shakable.
|
||||
Each icon can be imported as a preact component.
|
||||
It's build with ES Modules so it's completely tree-shakable.
|
||||
|
||||
Each icon can be imported as a Preact component, what renders a inline SVG Element. This way only the icons that are imported into your project are included in the final bundle. The rest of the icons are tree-shaken away.
|
||||
|
||||
### Example
|
||||
|
||||
You can pass additional props to adjust the icon.
|
||||
Additional props can be passed to adjust the icon:
|
||||
|
||||
```js
|
||||
```jsx
|
||||
import { Camera } from 'lucide-preact';
|
||||
// Returns PreactComponent
|
||||
|
||||
// Usage
|
||||
const App = () => {
|
||||
@@ -39,7 +45,7 @@ const App = () => {
|
||||
export default App;
|
||||
```
|
||||
|
||||
### Props
|
||||
## Props
|
||||
|
||||
| name | type | default |
|
||||
| --------------------- | --------- | ------------ |
|
||||
@@ -48,29 +54,31 @@ export default App;
|
||||
| `strokeWidth` | *number* | 2 |
|
||||
| `absoluteStrokeWidth` | *boolean* | false |
|
||||
|
||||
### Custom props / svg attributes
|
||||
### Applying props
|
||||
|
||||
You can also pass custom props that will be added in the as attributes. With that you can modify the icons look by passing svg attributes.
|
||||
To apply custom props to change the look of the icon, this can be done by simply pass them as props to the component. All SVG attributes are available as props to style the SVGs. See the list of SVG Presentation Attributes on [MDN](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation).
|
||||
|
||||
```js
|
||||
```jsx
|
||||
// Usage
|
||||
const App = () => {
|
||||
return <Camera fill="red" stroke-linejoin="bevel" />;
|
||||
};
|
||||
```
|
||||
|
||||
> svg attributes in preact aren't transformed, so if want to change e.g. the `stroke-linejoin` you need to pass it in kebabcase, the way svg spec is written so. See this topic in the [preact documentation](https://preactjs.com/guide/v10/differences-to-react/#svg-inside-jsx).
|
||||
> SVG attributes in Preact aren't transformed, so if you want to change for example the `stroke-linejoin` you need to pass it in kebabcase. Basically how the SVG spec want you to write it. See this topic in the [Preact documentation](https://preactjs.com/guide/v10/differences-to-react/#svg-inside-jsx).
|
||||
|
||||
### One generic icon component
|
||||
## One generic icon component
|
||||
|
||||
It is possible to create one generic icon component to load icons.
|
||||
It is possible to create one generic icon component to load icons. It's not recommended.
|
||||
|
||||
> ⚠️ Example below importing all EsModules, caution using this example, not recommended when you using bundlers, your application build size will grow strongly.
|
||||
::: danger
|
||||
Example below importing all ES Modules, caution using this example. All icons will be imported. When using bundlers like: `Webpack`, `Rollup` or `Vite` the application build size will grow strongly and harming the performance the application.
|
||||
:::
|
||||
|
||||
#### Icon Component Example
|
||||
### Icon Component Example
|
||||
|
||||
```js
|
||||
import * as icons from 'lucide-preact';
|
||||
```jsx
|
||||
import { icons } from 'lucide-preact';
|
||||
|
||||
const Icon = ({ name, color, size }) => {
|
||||
const LucideIcon = icons[name];
|
||||
@@ -80,3 +88,15 @@ const Icon = ({ name, color, size }) => {
|
||||
|
||||
export default Icon;
|
||||
```
|
||||
|
||||
#### Using the Icon Component
|
||||
|
||||
```jsx
|
||||
import Icon from './Icon';
|
||||
|
||||
const App = () => {
|
||||
return <Icon name="home" />;
|
||||
};
|
||||
|
||||
export default App;
|
||||
```
|
||||
|
||||
@@ -6,28 +6,32 @@ Implementation of the lucide icon library for React Native applications
|
||||
|
||||
First, ensure that you have `react-native-svg@^12.0.0` installed. Then, install the package:
|
||||
|
||||
```bash
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-react-native
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-react-native
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-react-native
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## How to use
|
||||
|
||||
It's build with ESmodules so it's completely tree-shakable.
|
||||
Each icon can be imported as a react component.
|
||||
Each icon can be imported as a React component.
|
||||
|
||||
### Example
|
||||
|
||||
You can pass additional props to adjust the icon.
|
||||
Additional props can be passed to adjust the icon:
|
||||
|
||||
```js
|
||||
```jsx
|
||||
import { Camera } from 'lucide-react-native';
|
||||
// Returns ReactComponent
|
||||
|
||||
// Usage
|
||||
const App = () => {
|
||||
@@ -37,7 +41,7 @@ const App = () => {
|
||||
export default App;
|
||||
```
|
||||
|
||||
### Props
|
||||
## Props
|
||||
|
||||
| name | type | default |
|
||||
| --------------------- | --------- | ------------ |
|
||||
@@ -46,27 +50,29 @@ export default App;
|
||||
| `strokeWidth` | *number* | 2 |
|
||||
| `absoluteStrokeWidth` | *boolean* | false |
|
||||
|
||||
### Custom props
|
||||
### Applying props
|
||||
|
||||
You can also pass custom props that will be added in the svg as attributes.
|
||||
To apply custom props to change the look of the icon, this can be done by simply pass them as props to the component.
|
||||
|
||||
```js
|
||||
```jsx
|
||||
// Usage
|
||||
const App = () => {
|
||||
return <Camera fill="red" />;
|
||||
};
|
||||
```
|
||||
|
||||
### One generic icon component
|
||||
## One generic icon component
|
||||
|
||||
It is possible to create one generic icon component to load icons.
|
||||
|
||||
> :warning: Example below importing all EsModules, caution using this example, not recommended when you using bundlers, your application build size will grow strongly.
|
||||
::: warning
|
||||
Example below importing all ES Modules, caution using this example. All icons will be imported. When using bundlers like: `Webpack`, `Rollup` or `Vite` the application build size will grow strongly and harming the performance the application.
|
||||
:::
|
||||
|
||||
#### Icon Component Example
|
||||
### Icon Component Example
|
||||
|
||||
```js
|
||||
import * as icons from 'lucide-react';
|
||||
```jsx
|
||||
import { icons } from 'lucide-react';
|
||||
|
||||
const Icon = ({ name, color, size }) => {
|
||||
const LucideIcon = icons[name];
|
||||
@@ -76,3 +82,15 @@ const Icon = ({ name, color, size }) => {
|
||||
|
||||
export default Icon;
|
||||
```
|
||||
|
||||
#### Using the Icon Component
|
||||
|
||||
```jsx
|
||||
import Icon from './Icon';
|
||||
|
||||
const App = () => {
|
||||
return <Icon name="home" />;
|
||||
};
|
||||
|
||||
export default App;
|
||||
```
|
||||
|
||||
@@ -4,28 +4,34 @@ Implementation of the lucide icon library for react applications
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-react
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-react
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-react
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## How to use
|
||||
|
||||
It's build with ESmodules so it's completely tree-shakable.
|
||||
Each icon can be imported as a react component.
|
||||
It's build with ES Modules so it's completely tree-shakable.
|
||||
|
||||
Each icon can be imported as a React component, what renders a inline SVG Element. This way only the icons that are imported into your project are included in the final bundle. The rest of the icons are tree-shaken away.
|
||||
|
||||
### Example
|
||||
|
||||
You can pass additional props to adjust the icon.
|
||||
Additional props can be passed to adjust the icon:
|
||||
|
||||
```js
|
||||
```jsx
|
||||
import { Camera } from 'lucide-react';
|
||||
// Returns ReactComponent
|
||||
|
||||
// Usage
|
||||
const App = () => {
|
||||
@@ -35,7 +41,7 @@ const App = () => {
|
||||
export default App;
|
||||
```
|
||||
|
||||
### Props
|
||||
## Props
|
||||
|
||||
| name | type | default |
|
||||
| --------------------- | --------- | ------------ |
|
||||
@@ -44,27 +50,29 @@ export default App;
|
||||
| `strokeWidth` | *number* | 2 |
|
||||
| `absoluteStrokeWidth` | *boolean* | false |
|
||||
|
||||
### Custom props
|
||||
### Applying props
|
||||
|
||||
You can also pass custom props that will be added in the svg as attributes.
|
||||
To apply custom props to change the look of the icon, this can be done by simply pass them as props to the component. All SVG attributes are available as props to style the SVGs. See the list of SVG Presentation Attributes on [MDN](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation).
|
||||
|
||||
```js
|
||||
```jsx
|
||||
// Usage
|
||||
const App = () => {
|
||||
return <Camera fill="red" />;
|
||||
return <Camera size={48} fill="red" />;
|
||||
};
|
||||
```
|
||||
|
||||
### One generic icon component
|
||||
## One generic icon component
|
||||
|
||||
It is possible to create one generic icon component to load icons.
|
||||
It is possible to create one generic icon component to load icons. It's not recommended.
|
||||
|
||||
> :warning: Example below importing all EsModules, caution using this example, not recommended when you using bundlers, your application build size will grow strongly.
|
||||
::: danger
|
||||
Example below importing all ES Modules, caution using this example. All icons will be imported. When using bundlers like: `Webpack`, `Rollup` or `Vite` the application build size will grow strongly and harming the performance the application.
|
||||
:::
|
||||
|
||||
#### Icon Component Example
|
||||
### Icon Component Example
|
||||
|
||||
```js
|
||||
import * as icons from 'lucide-react';
|
||||
```jsx
|
||||
import { icons } from 'lucide-react';
|
||||
|
||||
const Icon = ({ name, color, size }) => {
|
||||
const LucideIcon = icons[name];
|
||||
@@ -74,3 +82,15 @@ const Icon = ({ name, color, size }) => {
|
||||
|
||||
export default Icon;
|
||||
```
|
||||
|
||||
#### Using the Icon Component
|
||||
|
||||
```jsx
|
||||
import Icon from './Icon';
|
||||
|
||||
const App = () => {
|
||||
return <Icon name="home" />;
|
||||
};
|
||||
|
||||
export default App;
|
||||
```
|
||||
|
||||
@@ -4,28 +4,34 @@ Implementation of the lucide icon library for solid applications.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-solid
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-solid
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-solid
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## How to use
|
||||
|
||||
It's build with ESmodules so it's completely tree-shakable.
|
||||
Each icon can be imported as a solid component.
|
||||
It's build with ES Modules so it's completely tree-shakable.
|
||||
|
||||
Each icon can be imported as a Solid component, what renders a inline SVG Element. This way only the icons that are imported into your project are included in the final bundle. The rest of the icons are tree-shaken away.
|
||||
|
||||
### Example
|
||||
|
||||
You can pass additional props to adjust the icon.
|
||||
Additional props can be passed to adjust the icon:
|
||||
|
||||
```js
|
||||
```jsx
|
||||
import { Camera } from 'lucide-solid';
|
||||
// Returns SolidComponent
|
||||
|
||||
// Usage
|
||||
const App = () => {
|
||||
@@ -35,7 +41,7 @@ const App = () => {
|
||||
export default App;
|
||||
```
|
||||
|
||||
### Props
|
||||
## Props
|
||||
|
||||
| name | type | default |
|
||||
| --------------------- | --------- | ------------ |
|
||||
@@ -44,32 +50,37 @@ export default App;
|
||||
| `strokeWidth` | *number* | 2 |
|
||||
| `absoluteStrokeWidth` | *boolean* | false |
|
||||
|
||||
### Custom props / svg attributes
|
||||
### Applying props
|
||||
|
||||
You can also pass custom props that will be added in the as attributes. With that you can modify the icons look by passing svg attributes.
|
||||
To apply custom props to change the look of the icon, this can be done by simply pass them as props to the component. All SVG attributes are available as props to style the SVGs. See the list of SVG Presentation Attributes on [MDN](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation).
|
||||
|
||||
```js
|
||||
```jsx
|
||||
// Usage
|
||||
const App = () => {
|
||||
return <Camera fill="red" stroke-linejoin="bevel" />;
|
||||
};
|
||||
```
|
||||
|
||||
### One generic icon component
|
||||
## One generic icon component
|
||||
|
||||
It is possible to create one generic icon component to load icons.
|
||||
It is possible to create one generic icon component to load icons. It's not recommended.
|
||||
|
||||
> :warning: Example below importing all EsModules, caution using this example, not recommended when you using bundlers, your application build size will grow strongly.
|
||||
::: danger
|
||||
Example below importing all ES Modules, caution using this example. All icons will be imported. When using bundlers like: `Webpack`, `Rollup` or `Vite` the application build size will grow strongly and harming the performance the application.
|
||||
:::
|
||||
|
||||
#### Icon Component Example
|
||||
### Icon Component Example
|
||||
|
||||
```tsx
|
||||
import * as icons from 'lucide-solid';
|
||||
import type { LucideProps } from 'lucide-solid';
|
||||
import { icons, type LucideProps } from 'lucide-solid';
|
||||
import { splitProps } from 'solid-js';
|
||||
import { Dynamic } from 'solid-js/web';
|
||||
|
||||
const Icon = (props: { name: keyof typeof icons } & LucideProps) => {
|
||||
interface IconProps extends LucideProps {
|
||||
name: keyof typeof icons;
|
||||
}
|
||||
|
||||
const Icon = (props: IconProps) => {
|
||||
const [local, others] = splitProps(props, ["name"]);
|
||||
|
||||
return <Dynamic component={icons[local.name]} {...others} />
|
||||
@@ -77,3 +88,15 @@ const Icon = (props: { name: keyof typeof icons } & LucideProps) => {
|
||||
|
||||
export default Icon;
|
||||
```
|
||||
|
||||
#### Using the Icon Component
|
||||
|
||||
```tsx
|
||||
import Icon from './Icon';
|
||||
|
||||
const App = () => {
|
||||
return <Icon name="home" />;
|
||||
};
|
||||
|
||||
export default App;
|
||||
```
|
||||
|
||||
@@ -11,22 +11,30 @@ This package include the following lucide implementations:
|
||||
|
||||
This package is suitable for specific use cases, for example if you want to use icon fonts, SVG sprites, normal SVGs or Common.js SVG strings in your javascript project.
|
||||
|
||||
> ⚠️ While they can be useful for prototyping, it is not recommended to use the SVG sprites or icon fonts provided by this package in production web apps as all the available icons are included in the app, hence increasing loading time and data usage. We recommend to use a bundler and treeshaking to make sure only the icons you use are bundled with your app. Threeshaking is only available in these packages: [lucide](lucide), [lucide-react](lucide-react), [lucide-vue](lucide-vue), [lucide-vue-next](lucide-vue-next), [lucide-angular](lucide-angular), [lucide-preact](lucide-preact)
|
||||
::: warning
|
||||
While they can be useful for prototyping, it is not recommended to use the SVG sprites or icon fonts provided by this package in production web apps as all the available icons are included in the app, hence increasing loading time and data usage. We recommend to use a bundler and tree-shaking to make sure only the icons you use are bundled with your app. Tree-shaking is only available in these packages: [lucide](lucide), [lucide-react](lucide-react), [lucide-vue](lucide-vue), [lucide-vue-next](lucide-vue-next), [lucide-angular](lucide-angular), [lucide-preact](lucide-preact)
|
||||
:::
|
||||
|
||||
## Installation
|
||||
|
||||
## Package Managers
|
||||
|
||||
```sh
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-static
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-static
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-static
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
### CDN
|
||||
|
||||
```html
|
||||
|
||||
@@ -4,25 +4,33 @@ Implementation of the lucide icon library for svelte applications.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-svelte
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-svelte
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-svelte
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## How to use
|
||||
|
||||
All the icons are Svelte components, that ouputs Svg elements. So each icon can be imported and used as a component. This also helps with the use of threeshaking so you only import the icons you use.
|
||||
It's build with ES Modules so it's completely tree-shakable.
|
||||
|
||||
Each icon can be imported as a Svelte component, what renders a inline SVG Element. This way only the icons that are imported into your project are included in the final bundle. The rest of the icons are tree-shaken away.
|
||||
|
||||
### Example
|
||||
|
||||
Default usage:
|
||||
|
||||
```html
|
||||
```svelte
|
||||
<script>
|
||||
import { Skull } from 'lucide-svelte';
|
||||
</script>
|
||||
@@ -30,9 +38,9 @@ Default usage:
|
||||
<Skull />
|
||||
```
|
||||
|
||||
You can pass additional props to adjust the icon.
|
||||
Additional props can be passed to adjust the icon:
|
||||
|
||||
```html
|
||||
```svelte
|
||||
<script>
|
||||
import { Camera } from 'lucide-svelte';
|
||||
</script>
|
||||
@@ -40,7 +48,7 @@ You can pass additional props to adjust the icon.
|
||||
<Camera color="#ff3e98" />
|
||||
```
|
||||
|
||||
### Available props
|
||||
## Props
|
||||
|
||||
| name | type | default |
|
||||
| --------------------- | --------- | ------------ |
|
||||
@@ -48,14 +56,12 @@ You can pass additional props to adjust the icon.
|
||||
| `color` | *string* | currentColor |
|
||||
| `strokeWidth` | *number* | 2 |
|
||||
| `absoluteStrokeWidth` | *boolean* | false |
|
||||
| `*<SVGProps>` | *string* | - |
|
||||
|
||||
### Applying props
|
||||
|
||||
\* All SVGProps are available to style the svgs. See the list of SVG Presentation Attributes on [MDN](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation)
|
||||
To apply custom props to change the look of the icon, this can be done by simply pass them as props to the component. All SVG attributes are available as props to style the SVGs. See the list of SVG Presentation Attributes on [MDN](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation).
|
||||
|
||||
### Example of custom props
|
||||
|
||||
```html
|
||||
```svelte
|
||||
<script>
|
||||
import { Phone } from 'lucide-svelte';
|
||||
</script>
|
||||
@@ -65,15 +71,17 @@ You can pass additional props to adjust the icon.
|
||||
|
||||
This results a filled phone icon.
|
||||
|
||||
### One generic icon component
|
||||
## One generic icon component
|
||||
|
||||
It is possible to create one generic icon component to load icons.
|
||||
It is possible to create one generic icon component to load icons. It's not recommended.
|
||||
|
||||
> ⚠️ Example below importing all EsModules, caution using this example, not recommended when you bundle your application,the build size will grow strongly. Because it will import all the icons.
|
||||
::: danger
|
||||
Example below importing all ES Modules, caution using this example. All icons will be imported. When using bundlers like: `Webpack`, `Rollup` or `Vite` the application build size will grow strongly and harming the performance the application.
|
||||
:::
|
||||
|
||||
#### Icon Component Example
|
||||
### Icon Component Example
|
||||
|
||||
```html
|
||||
```svelte
|
||||
<script>
|
||||
import * as icons from 'lucide-svelte';
|
||||
export let name;
|
||||
@@ -82,12 +90,13 @@ It is possible to create one generic icon component to load icons.
|
||||
<svelte:component this="{icons[name]}" {...$$props} />
|
||||
```
|
||||
|
||||
##### Then you can use it like this
|
||||
#### Using the Icon Component
|
||||
|
||||
```html
|
||||
```svelte
|
||||
<script>
|
||||
import LucideIcon from './LucideIcon';
|
||||
</script>
|
||||
|
||||
<LucideIcon name="Menu" />
|
||||
```
|
||||
|
||||
|
||||
@@ -2,32 +2,41 @@
|
||||
|
||||
Implementation of the lucide icon library for Vue 3 applications.
|
||||
|
||||
> ⚠️ This version of lucide is for Vue 3, For Vue 2 got to [lucide-vue](lucide-vue)
|
||||
## Vue 3 or Vue 2
|
||||
|
||||
::: tip
|
||||
This version of lucide is for Vue 3, For Vue 2 got to [lucide-vue ->](lucide-vue)
|
||||
:::
|
||||
|
||||
## Installation
|
||||
|
||||
**With yarn**
|
||||
::: code-group
|
||||
|
||||
```bash
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-vue-next
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-vue-next
|
||||
```
|
||||
|
||||
**With npm**
|
||||
|
||||
```bash
|
||||
```sh [npm]
|
||||
npm install lucide-vue-next
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## How to use
|
||||
|
||||
It's build with ESmodules so it's completely tree-shakable.
|
||||
Each icon can be imported as a vue component.
|
||||
It's build with ES Modules so it's completely tree-shakable.
|
||||
|
||||
Each icon can be imported as a Vue component, what renders a inline SVG Element. This way only the icons that are imported into your project are included in the final bundle. The rest of the icons are tree-shaken away.
|
||||
|
||||
### Example
|
||||
|
||||
You can pass additional props to adjust the icon.
|
||||
|
||||
``` html
|
||||
```vue
|
||||
<template>
|
||||
<Camera
|
||||
color="red"
|
||||
@@ -40,7 +49,7 @@ import { Camera } from 'lucide-vue-next';
|
||||
</script>
|
||||
```
|
||||
|
||||
### Props
|
||||
## Props
|
||||
|
||||
| name | type | default |
|
||||
| ----------------------- | --------- | ------------ |
|
||||
@@ -50,34 +59,27 @@ import { Camera } from 'lucide-vue-next';
|
||||
| `absolute-stroke-width` | *boolean* | false |
|
||||
| `default-class` | *string* | lucide-icon |
|
||||
|
||||
### Custom props
|
||||
### Applying props
|
||||
|
||||
You can also pass custom props that will be added in the svg as attributes.
|
||||
To apply custom props to change the look of the icon, this can be done by simply pass them as props to the component. All SVG attributes are available as props to style the SVGs. See the list of SVG Presentation Attributes on [MDN](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation).
|
||||
|
||||
``` html
|
||||
```vue
|
||||
<template>
|
||||
<Camera fill="red" />
|
||||
</template>
|
||||
```
|
||||
|
||||
### One generic icon component
|
||||
## One generic icon component
|
||||
|
||||
It is possible to create one generic icon component to load icons.
|
||||
It is possible to create one generic icon component to load icons. It's not recommended.
|
||||
|
||||
> ⚠️ Example below importing all EsModules, caution using this example, not recommended when you using bundlers, your application build size will grow strongly.
|
||||
::: danger
|
||||
Example below importing all ES Modules, caution using this example. All icons will be imported. When using bundlers like: `Webpack`, `Rollup` or `Vite` the application build size will grow strongly and harming the performance the application.
|
||||
:::
|
||||
|
||||
#### Icon Component Example
|
||||
|
||||
``` html
|
||||
<template>
|
||||
<component
|
||||
:is="icon"
|
||||
:size="size"
|
||||
:color="color"
|
||||
:stroke-width="strokeWidth" :default-class="defaultClass"
|
||||
/>
|
||||
</template>
|
||||
### Icon Component Example
|
||||
|
||||
```vue
|
||||
<script setup>
|
||||
import { computed } from 'vue';
|
||||
import * as icons from "lucide-vue-next";
|
||||
@@ -95,15 +97,25 @@ const props = defineProps({
|
||||
|
||||
const icon = computed(() => icons[props.name]);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<component
|
||||
:is="icon"
|
||||
:size="size"
|
||||
:color="color"
|
||||
:stroke-width="strokeWidth" :default-class="defaultClass"
|
||||
/>
|
||||
</template>
|
||||
```
|
||||
|
||||
##### Then you can use it like this
|
||||
### Using the Icon Component
|
||||
|
||||
``` html
|
||||
All other props listed above also work on the `Icon` Component.
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div id="app">
|
||||
<Icon name="Airplay" />
|
||||
</div>
|
||||
</template>
|
||||
```
|
||||
All other props listed above also work on the `Icon` Component.
|
||||
|
||||
@@ -2,36 +2,46 @@
|
||||
|
||||
Implementation of the lucide icon library for Vue applications.
|
||||
|
||||
> ⚠️ This version of lucide is for Vue 2, For Vue 3 got to [lucide-vue-next](lucide-vue-next)
|
||||
## Vue 2 or Vue 3
|
||||
|
||||
::: tip
|
||||
This version of lucide is for Vue 2, For Vue 3 go to [lucide-vue-next ->](lucide-vue-next)
|
||||
:::
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide-vue
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide-vue
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
```sh [npm]
|
||||
npm install lucide-vue
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
## How to use
|
||||
|
||||
It's build with ESmodules so it's completely tree-shakable.
|
||||
Each icon can be imported as a vue component.
|
||||
It's build with ES Modules so it's completely tree-shakable.
|
||||
|
||||
Each icon can be imported as a Vue component, what renders a inline SVG Element. This way only the icons that are imported into your project are included in the final bundle. The rest of the icons are tree-shaken away.
|
||||
|
||||
### Example
|
||||
|
||||
You can pass additional props to adjust the icon.
|
||||
Additional props can be passed to adjust the icon:
|
||||
|
||||
```html
|
||||
```vue
|
||||
<template>
|
||||
<Camera color="red" :size="32" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Returns Vue component
|
||||
import { Camera } from 'lucide-vue';
|
||||
|
||||
export default {
|
||||
@@ -41,7 +51,7 @@ You can pass additional props to adjust the icon.
|
||||
</script>
|
||||
```
|
||||
|
||||
### Props
|
||||
## Props
|
||||
|
||||
| name | type | default |
|
||||
| ----------------------- | --------- | ------------ |
|
||||
@@ -51,25 +61,27 @@ You can pass additional props to adjust the icon.
|
||||
| `absolute-stroke-width` | *boolean* | false |
|
||||
| `default-class` | *string* | lucide-icon |
|
||||
|
||||
### Custom props
|
||||
### Applying props
|
||||
|
||||
You can also pass custom props that will be added in the svg as attributes.
|
||||
To apply custom props to change the look of the icon, this can be done by simply pass them as props to the component. All SVG attributes are available as props to style the SVGs. See the list of SVG Presentation Attributes on [MDN](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation).
|
||||
|
||||
```html
|
||||
```vue
|
||||
<template>
|
||||
<Camera fill="red" />
|
||||
</template>
|
||||
```
|
||||
|
||||
### One generic icon component
|
||||
## One generic icon component
|
||||
|
||||
It is possible to create one generic icon component to load icons.
|
||||
It is possible to create one generic icon component to load icons. It's not recommended.
|
||||
|
||||
> ⚠️ Example below importing all EsModules, caution using this example, not recommended when you using bundlers, your application build size will grow strongly.
|
||||
::: danger
|
||||
Example below importing all ES Modules, caution using this example. All icons will be imported. When using bundlers like: `Webpack`, `Rollup` or `Vite` the application build size will grow strongly and harming the performance the application.
|
||||
:::
|
||||
|
||||
#### Icon Component Example
|
||||
### Icon Component Example
|
||||
|
||||
```html
|
||||
```vue
|
||||
<template>
|
||||
<component :is="icon" />
|
||||
</template>
|
||||
@@ -93,9 +105,9 @@ It is possible to create one generic icon component to load icons.
|
||||
</script>
|
||||
```
|
||||
|
||||
##### Then you can use it like this
|
||||
#### Using the Icon Component
|
||||
|
||||
```html
|
||||
```vue
|
||||
<template>
|
||||
<div id="app">
|
||||
<Icon name="Airplay" />
|
||||
|
||||
@@ -6,15 +6,21 @@ Implementation of the lucide icon library for web applications.
|
||||
|
||||
### Package Managers
|
||||
|
||||
```sh
|
||||
::: code-group
|
||||
|
||||
```sh [pnpm]
|
||||
pnpm install lucide
|
||||
```
|
||||
|
||||
```sh [yarn]
|
||||
yarn add lucide
|
||||
```
|
||||
|
||||
```sh [npm]
|
||||
npm install lucide
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
yarn add lucide
|
||||
```
|
||||
:::
|
||||
|
||||
### CDN
|
||||
|
||||
@@ -35,9 +41,9 @@ Here is a complete example with unpkg
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<body>
|
||||
<i icon-name="volume-2" class="my-class"></i>
|
||||
<i icon-name="x"></i>
|
||||
<i icon-name="menu"></i>
|
||||
<i data-lucide="volume-2" class="my-class"></i>
|
||||
<i data-lucide="x"></i>
|
||||
<i data-lucide="menu"></i>
|
||||
|
||||
<script src="https://unpkg.com/lucide@latest"></script>
|
||||
<script>
|
||||
@@ -49,11 +55,11 @@ Here is a complete example with unpkg
|
||||
### With ESModules
|
||||
|
||||
To reduce bundle size, lucide is built to be fully tree-shakable.
|
||||
The `createIcons` function will search for HTMLElements with the attribute `icon-name` and replace it with the svg from the given icon name.
|
||||
The `createIcons` function will search for HTMLElements with the attribute `data-lucide` and replace it with the svg from the given icon name.
|
||||
|
||||
```html
|
||||
<!-- Your HTML file -->
|
||||
<i icon-name="menu"></i>
|
||||
<i data-lucide="menu"></i>
|
||||
```
|
||||
|
||||
```js
|
||||
@@ -74,7 +80,9 @@ createIcons({
|
||||
});
|
||||
```
|
||||
|
||||
#### Additional Options
|
||||
## Advanced Usage
|
||||
|
||||
### Additional Options
|
||||
|
||||
In the `createIcons` function you can pass some extra parameters to adjust the `nameAttr` or add custom attributes like for example classes.
|
||||
|
||||
@@ -89,11 +97,11 @@ createIcons({
|
||||
'stroke-width': 1,
|
||||
stroke: '#333'
|
||||
},
|
||||
nameAttr: 'icon-name' // attribute for the icon name.
|
||||
nameAttr: 'data-lucide' // attribute for the icon name.
|
||||
});
|
||||
```
|
||||
|
||||
#### Treeshake the library, only use the icons you use
|
||||
### Treeshake the library, only use the icons you use
|
||||
|
||||
```js
|
||||
import { createIcons, Menu, ArrowRight, Globe } from 'lucide';
|
||||
@@ -107,7 +115,7 @@ createIcons({
|
||||
});
|
||||
```
|
||||
|
||||
#### Custom Element binding
|
||||
### Custom Element binding
|
||||
|
||||
```js
|
||||
import { createElement, Menu } from 'lucide';
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
"has": [
|
||||
{
|
||||
"type": "query",
|
||||
"key": "page"
|
||||
"key": "search"
|
||||
}
|
||||
],
|
||||
"destination": "/icons",
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"contributors": [
|
||||
"danielbayley"
|
||||
],
|
||||
"aliases": ["circle-slashed"],
|
||||
"tags": [
|
||||
"diameter",
|
||||
"zero",
|
||||
|
||||
Reference in New Issue
Block a user