{"id":15559424,"url":"https://github.com/citguru/svgit","last_synced_at":"2025-10-07T10:30:35.017Z","repository":{"id":42113406,"uuid":"178727940","full_name":"CITGuru/svgit","owner":"CITGuru","description":"Customizeable SVG to React Component","archived":false,"fork":false,"pushed_at":"2022-12-09T17:52:00.000Z","size":867,"stargazers_count":8,"open_issues_count":35,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-13T09:43:51.618Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CITGuru.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-31T18:42:58.000Z","updated_at":"2022-04-17T10:27:31.000Z","dependencies_parsed_at":"2023-01-25T22:46:36.551Z","dependency_job_id":null,"html_url":"https://github.com/CITGuru/svgit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CITGuru%2Fsvgit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CITGuru%2Fsvgit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CITGuru%2Fsvgit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CITGuru%2Fsvgit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CITGuru","download_url":"https://codeload.github.com/CITGuru/svgit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235614466,"owners_count":19018448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T15:48:36.309Z","updated_at":"2025-10-07T10:30:29.660Z","avatar_url":"https://github.com/CITGuru.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# svgit\n\n\u003e Customizeable SVG to React Component\n\n[![NPM](https://img.shields.io/npm/v/svgit.svg)](https://www.npmjs.com/package/svgit) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\nThis is a simple react library built on [react-inlinesvg](https://github.com/gilbarbara/react-inlinesvg) for manipulating svgs. You can pretty much manipulate `path`,`g`, and other svg components by using their index (more to come) and attrs. This is still at its crude stage.\n\n## Install\n\n```bash\nnpm install --save svgit\n```\n\n## Usage\n\n```jsx\nimport React, { Component } from 'react'\n\nimport SVG from 'svgit'\n\nclass Example extends Component {\n  render () {\n    return (\n      \u003cSVG width=\"50\" title=\"New title\" height=\"50\" selectors={{index:1, attrs: { width: \"20\", height: \"30\" }}} /\u003e\n    )\n  }\n}\n```\n\n\n## Props\n----\n\n**src** {string}  \nThe SVG file you want to load. It can be an `url` or a string (base64 or encoded)\n\n**wrapper** {function} ▶︎ `React.createFactory('span')`  \nA React class or a function that returns a component instance to be used as the wrapper component.\n\n**preloader** {node}  \nA component to be shown while the SVG is loading.\n\n**selector** {object}  \nSelect a single svg element to be customized. E.g - `{index:4, attrs: { fill:\"yellow\" }}`.\n\n*index* - index of the element starting from 0 \n*attrs* - any applicable svg attributes and properties\n\n**selectors** {array}  \nSelect multiple svg elements to be customized. E.g - `[{index:4, attrs: { fill:\"yellow\" }}]`.\n\n*index* - index of the element starting from 0 \n*attrs* - any applicable svg attributes and properties\n\n**className** {string}  \nA class to add to the default wrapper.\n\n**onLoad** {function} ▶︎ a random 8 characters string `[A-Za-z0-9]`  \nA callback to be invoked upon successful load.  \nThis will receive 2 arguments: the `src` prop and a `isCached` boolean\n\n**onError** {function}  \nA callback to be invoked if loading the SVG fails.  \nThis will receive a single argument:\n\n- a xhr `RequestError` with:\n\n```js\n{\n    ...,\n    isHttpError: bool,\n    status: number\n}\n```\n\n- or an `InlineSVGError`, which has the following properties:\n\n```js\n{\n    name: 'InlineSVGError',\n    isSupportedBrowser: bool,\n    isConfigurationError: bool,\n    isUnsupportedBrowserError: bool,\n    message: string\n}\n```\n\nYou should head over to [react-inlinesvg](https://github.com/gilbarbara/react-inlinesvg/) for more info on react-inlinesvg\n\n## Contribution\n\nYes you can contribute by sending a PR. Much code.\n\n## License\n\nMIT © [Oyetoke Toby](https://github.com/CITGuru)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitguru%2Fsvgit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcitguru%2Fsvgit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcitguru%2Fsvgit/lists"}