All Projects → godaddy → Svgs

godaddy / Svgs

Licence: mit
svgs is a compatiblity layer between svg and react-native-svg

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Svgs

Svgsort
svg path sorter for more efficient (pen)plotting.
Stars: ✭ 162 (-10.99%)
Mutual labels:  svg
Svg2vectordrawable
Node.js module and command-line tools for convert SVG to Android vector drawable.
Stars: ✭ 171 (-6.04%)
Mutual labels:  svg
Portfolio Template
A beautiful minimal and accessible portfolio template for Developers. Give it a star 🌟 if you find it useful.
Stars: ✭ 175 (-3.85%)
Mutual labels:  svg
D3tutorial
📊📈 A D3 v6 tutorial - interactive bar chart and multiple coordinated views (MCV)
Stars: ✭ 163 (-10.44%)
Mutual labels:  svg
Svg utils
Python tools to create and manipulate SVG files
Stars: ✭ 169 (-7.14%)
Mutual labels:  svg
Nachos Ui
Nachos UI is a React Native component library.
Stars: ✭ 2,037 (+1019.23%)
Mutual labels:  react-native-web
Svg Spritemap Webpack Plugin
SVG spritemap plugin for webpack
Stars: ✭ 160 (-12.09%)
Mutual labels:  svg
Feathericon
simply generic vector icon collection - including sketch file, svg files, and font files.
Stars: ✭ 178 (-2.2%)
Mutual labels:  svg
File Icon Vectors
A collection of file type icons in SVG format
Stars: ✭ 171 (-6.04%)
Mutual labels:  svg
Psvg
Programmable Scalable Vector Graphics -- drawings that draw themselves
Stars: ✭ 177 (-2.75%)
Mutual labels:  svg
React Native Svg Icon
A simple, but flexible SVG icon component for React Native
Stars: ✭ 164 (-9.89%)
Mutual labels:  svg
Gerbolyze
Render high-resolution bitmap images to PCB gerber files
Stars: ✭ 169 (-7.14%)
Mutual labels:  svg
React Native Paper Dates
Smooth and fast cross platform Material Design date and time picker for React Native Paper
Stars: ✭ 173 (-4.95%)
Mutual labels:  react-native-web
React Rough
🐇 React Components for Rough.js
Stars: ✭ 164 (-9.89%)
Mutual labels:  svg
Blade Heroicons
A package to easily make use of Heroicons in your Laravel Blade views.
Stars: ✭ 173 (-4.95%)
Mutual labels:  svg
React Native Svg Charts
📈 One library to rule all charts for React Native 📊
Stars: ✭ 2,056 (+1029.67%)
Mutual labels:  svg
Lfai Landscape
🌄 Open Source AI Landscape - provides overview of top tier projects in the open source AI ecosystem, shows projects through GitHub data, funding or market cap, first and last commits, contributor count and much other information.
Stars: ✭ 172 (-5.49%)
Mutual labels:  svg
Oshmi
SCADA HMI for substations and automation applications.
Stars: ✭ 180 (-1.1%)
Mutual labels:  svg
Reactnativeuniversal
A demonstration of sharing javascript react-native code between mobile, desktop and web environments
Stars: ✭ 178 (-2.2%)
Mutual labels:  react-native-web
Picasso.js
A charting library streamlined for building interactive visualizations for the Qlik product suites.
Stars: ✭ 175 (-3.85%)
Mutual labels:  svg

svgs Version npmBuild StatusDependenciesCoverage Status

The svgs module is compatibility layer between react-native-svg and regular react (browser) based SVG elements. This allows you to write SVG in the react and react-native using exactly the same API. Bringing your applications a step closer to writing fully isomorphic application.

The library itself is written in ES6 and comes with the correct babel transforms as dependencies so it's easy to integrate in your existing tool chains and webpack builds.

There are 2 ways in using this package, you could use svgs instead of react-native-svg which is recommended. But you could also instruct your WebPack builder to use svgs as an alias for react-native-svg.

Table of Contents

Install

For regular react usage:

npm install --save svgs

For React-Native usage:

npm install --save svgs
npm install --save react-native-svg
react-native link react-native-svg

Word of caution, make sure that you install a react-native-svg version that works with your react-native version. See the react-native-svg project for a list of supported React versions.

WebPack

To use this package as alias for react-native-svg you need to update your WebPack configuration to include the following snippet:

resolve: {
  alias: {
    ...
    'react-native-svg': 'svgs',
  }
}

API

The API that we expose is exactly the same as the react-native-svg project so please visit: https://github.com/react-native-community/react-native-svg for the full API documentation. But here is a quick little overview of the available elements:

import Svg, {
  Circle,
  ClipPath,
  Defs,
  Ellipse,
  G,
  Image,
  Line,
  LinearGradient,
  Mask,
  Path,
  Pattern,
  Polygon,
  Polyline,
  RadialGradient,
  Rect,
  Stop,
  Svg,
  Symbol,
  TSpan,
  Text,
  TextPath,
  Use
} from 'svgs';

Any incompatibilities should be seen as a bug and be reported in the svgs/issue page on Github.

Example

Import all the SVG elements and make a Twitter logo.

import React, { Component } from 'react';
import Svg, { Path } from 'svgs';

class Twitter extends Component {
  render() {
    return (
      <Svg height='1208' width='1000' viewbox='0 0 1000 1208.3' preserveAspectRatio='meet'>
        <Path fill='#000' d='M0 1007.9q139.6 92.1 305.8 92.1 76.7 0 146.9-18.1 70.2-18.1 126.5-50 56.2-31.9 103.9-75.6 47.7-43.8 82.5-95.7 34.8-51.8 59.2-108.9 24.4-57.1 36.5-116.3 12-59.1 12-117.5 0-17.9-0.4-26.6 13.4-10 42.1-25.5 28.8-15.4 51-30.8 22.3-15.4 34-33.3-15.8 7.1-41.5 10-25.6 2.9-56.4 3.7-30.8 0.9-44.2 2.5 34.6-21.6 69.2-58.1 34.6-36.5 45-69.8-31.3 19.2-76.3 38.3-45 19.2-77 25.9-28-30.4-65.7-47.5-37.7-17.1-79.8-17.1-54.1 0-100.2 27.5-46 27.5-72.7 74.6-26.6 47.1-26.6 102.5 0 24.1 5 46.6-122.5-6.6-229.4-63.1-106.9-56.4-181.9-150.6-26.7 46.7-26.7 102.9 0 52.1 23.8 97.1 23.7 45 64.6 72.9-48.4-1.2-90-25.4l0 2.5q0 73.7 45.4 130.2 45.4 56.5 114.6 70.2-25 7.5-52.5 7.5-19.2 0-37.9-3.7 19.1 61.6 70.4 101.2 51.2 39.6 116.2 40.8-108.7 87.5-247.9 87.5-25.8 0-47.5-2.9z' />
      </Svg>
    );
  }
}

Accessibility

If you want Section 508 Accessibility add the title prop to the <Svg /> component like this:

<Svg title="Image Description" width="1000" height="1000" ... />

When this renders on native, you'll get your SVG wrapped in a View with an accessibilityLabel. On web, the SVG element will get two aria labels and a <title> element that are required for accessibility.

<svg role="img" aria-label="[title]" width="1000" height="1000">
  <title>Image Description</title>
  ...
</svg>

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].