# svg-to-chakra

> Transform SVG to React Chakra UI ✨

Latest version **0.0.0** (published 2021-08-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install svg-to-chakra
pnpm add svg-to-chakra
yarn add svg-to-chakra
bun add svg-to-chakra
```

Provides the command `create-chakraicon`.

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2021-08-26 |
| First published | 2021-08-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 10.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 100 |
| Author | ri7nz |
| Maintainers | ri7nz |
| Keywords | generator, chakra-ui, reactjs, react-native, react, javascript, cli, svg |

## Links

- npm: https://www.npmjs.com/package/svg-to-chakra
- Repository: https://github.com/kodingdotninja/create-chakraicon
- Issues: https://github.com/kodingdotninja/create-chakraicon/issues
- npm.io page: https://npm.io/package/svg-to-chakra

## Dependencies (5)

- [minimist](https://npm.io/package/minimist.md) 1.2.5
- [svg-parser](https://npm.io/package/svg-parser.md) 2.0.4
- [@babel/types](https://npm.io/package/@babel/types.md) 7.15.0
- [@babel/generator](https://npm.io/package/@babel/generator.md) 7.15.0
- [@svgr/hast-util-to-babel-ast](https://npm.io/package/@svgr/hast-util-to-babel-ast.md) 5.5.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.0 (latest) — 2021-08-26

## README

# create-chakraicon
> transform SVG asset to be React Chakra-UI Icon

### CLI
## Usage (CLI)


```console
npx create-chakraicon -n "MyIcon" -i ./myicon.svg -o ./MyIcon.js
```

### Options
* `-n/--name`:  it will be `displayName` in Component Properties.
* `-i/--input`:  where your put the `SVG` file.
* `-o/--output`: where your want to save your file.

### Pipe (stdout)
```console
$> echo "
<svg viewBox=\"0 0 200 200\">
    <path
      fill=\"#666\"
      d=\"M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0\"
    />
  </svg>
" | create-chakraicon -n "Rin"
// output
import { createIcon } from "@chakra-ui/react";
export const Rin = createIcon({
  displayName: "Rin",
  viewBox: "0 0 200 200",
  d: "M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0"
});
```

### Pipe (output file)
```console
$> echo "
<svg viewBox=\"0 0 200 200\">
    <path
      fill=\"#666\"
      d=\"M 100, 100 m -75, 0 a 75,75 0 1,0 150,0 a 75,75 0 1,0 -150,0\"
    />
  </svg>
" | create-chakraicon -n "Rin" > RinIcon.js 
```

## Usage (API)

```js
import { api } from 'create-chakraicon'
// or
import api from 'create-chakraicon/api'
// exported function
api {
  createChakraProperties: [Function: createChakraProperties],
  createChakraFunctional: [Function: createChakraFunctional],
  importChakraIcon: [Function: importChakraIcon],
  createSourceChakraIcon: [Function: createSourceChakraIcon],
  hastSVGToChakraProperties: [Function: hastSVGToChakraProperties]
}

```

<!--TYPEDEFS-->
## Typedefs

<dl>
<dt><a href="#PropsChakraProperties">PropsChakraProperties</a> ⇒ <code>Object</code></dt>
<dd></dd>
<dt><a href="#PropsChakraFunctional">PropsChakraFunctional</a> ⇒ <code>Object</code></dt>
<dd></dd>
<dt><a href="#SvgProperties">SvgProperties</a> ⇒ <code>Object</code></dt>
<dd><p>example of @param</p>
<pre><code class="language-js">{
    type: &#39;root&#39;,
    children: [
      {
        type: &#39;element&#39;,
        tagName: &#39;svg&#39;,
        properties: { viewBox: &#39;0 0 200 200&#39; },
        children: [ [Object], [length]: 1 ],
        metadata: &#39;\n  &#39;
      },
      [length]: 1
    ]
  }
}
</code></pre>
</dd>
</dl>

<a name="PropsChakraProperties"></a>

## PropsChakraProperties ⇒ <code>Object</code>
**Kind**: global typedef  
**Returns**: <code>Object</code> - t.ObjectExpression  
**See**: {https://babeljs.io/docs/en/babel-types#objectexpression}  
**Properties**

| Name | Type |
| --- | --- |
| displayName | <code>String</code> | 
| viewBox | <code>String</code> | 
| [path] | <code>String</code> | 
| [d] | <code>String</code> | 

<a name="PropsChakraFunctional"></a>

## PropsChakraFunctional ⇒ <code>Object</code>
**Kind**: global typedef  
**Returns**: <code>Object</code> - t.ExportNameDeclaration  
**See**

- {https://babeljs.io/docs/en/babel-types#objectexpression}
- {https://babeljs.io/docs/en/babel-types#exportnameddeclaration}

**Properties**

| Name | Type | Description |
| --- | --- | --- |
| displayName | <code>String</code> | Will make as Identifier of your export function name |
| objectExpression | <code>Object</code> | BabelAST for Object Properties Chakra Icon |

<a name="SvgProperties"></a>

## SvgProperties ⇒ <code>Object</code>
example of @param
```js
{
    type: 'root',
    children: [
      {
        type: 'element',
        tagName: 'svg',
        properties: { viewBox: '0 0 200 200' },
        children: [ [Object], [length]: 1 ],
        metadata: '\n  '
      },
      [length]: 1
    ]
  }
}
```

**Kind**: global typedef  
**Returns**: <code>Object</code> - SvgProperties  

| Param | Type | Description |
| --- | --- | --- |
| SVG | <code>Object</code> | HAST |

**Properties**

| Name | Type |
| --- | --- |
| d | <code>String</code> | 
| viewBox | <code>String</code> | 

<!--END TYPEDEFS-->

## Alternative
* [**SVGR**](https://react-svgr.com/)
* [**create-chakra-icon**](https://www.npmjs.com/package/create-chakra-icon)
   
## License
[See HERE](./LICENSE)

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