# svg-reacted

> ```bash npm i -g svg-reacted ```

Latest version **0.0.5** (published 2021-10-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install svg-reacted
pnpm add svg-reacted
yarn add svg-reacted
bun add svg-reacted
```

Provides the command `svg-reacted`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2021-10-15 |
| First published | 2021-09-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | ropfoo |
| Maintainers | ropfoo |

## Links

- npm: https://www.npmjs.com/package/svg-reacted
- Repository: https://github.com/RopFoo/svg-reacted
- Homepage: https://github.com/RopFoo/svg-reacted#readme
- Issues: https://github.com/RopFoo/svg-reacted/issues
- npm.io page: https://npm.io/package/svg-reacted

## Recent versions

- 0.0.5 (latest) — 2021-10-15
- 0.0.4 — 2021-10-15
- 0.0.3 — 2021-09-30
- 0.0.1 — 2021-09-30

## README

# Install

```bash
npm i -g svg-reacted
```

# Usage

Create an **svgconfig.json** file in the root of your project.

```json
// svgconfig.json

{
    "useDefaultSize": true,
    "templateFile": "template/template.txt",
    "inputDir": "svg",
    "outputDir": "react",
    "svgComponent": {
        "nameExtension": "Icon",
        "type": "tsx",
        "fill": "black"
    }
}
```

Create a template file matching the defined path in your config file

Run the follwing command in the same location

```bash
npx svg-reacted your.svg
```

# Template File

### Supported Variables

|               |
| ------------- |
| **#{name}**   |
| **#{path}**   |
| **#{fill}**   |
| **#{width}**  |
| **#{height}** |

### Example React DOM

```txt
import React from 'react';

const #{name}: React.FC = ({size = 30}) => {
    return (
        <svg width={size} height={size} viewBox='0 0 #{width} #{height}' fill='#{fill}'>
            <path
            d='#{path}'
            fill='#{fill}'
            stroke='#{fill}'
            />
        </svg>
    );
};

export default #{name};

```

### Example React Native

```txt
import React from 'react';
import Svg, { Path } from 'react-native-svg';

const #{name}: React.FC = ({size = 30}) => {
    return (
        <Svg width={size} height={size} viewBox='0 0 #{width} #{height}' fill='#{fill}'>
            <Path
            d='#{path}'
            fill='#{fill}'
            stroke='#{fill}'
            />
        </Svg>
    );
};

export default #{name};

```

# Configuration

### General

|                    |         |                                |
| ------------------ | ------- | ------------------------------ |
| **useDefaultSize** | boolean |                                |
| **templateFile**   | string  | path to created temmplate file |
| **inputDir**       | string  |                                |
| **outputDir**      | string  |                                |

### svgComponent

|                   |         |                                |
| ----------------- | ------- | ------------------------------ |
| **usePascalCase** | boolean | turn first letter to uppercase |
| **nameExtension** | string  |                                |
| **type**          | string  | 'tsx', 'jsx'                   |
| **fill**          | string  |                                |
| **width**         | number  |                                |
| **height**        | number  |                                |

---
_Source: https://npm.io/package/svg-reacted · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
