@silky/group

0.2.0 • Public • Published

@silky/group

The <Group /> component is a React implementation of the <g> SVG element which is a container used to group other SVG elements.

<Group /> allows you to pass a className, an Emotion template, and transform properties for translate and rotate in order to improve performance inlining this attribute instead of creating style rules for each individual element.

Install

Yarn

yarn add @silky/group

NPM

npm install --save @silky/group

Import

ES5 Modules

import { Group } from '@silky/group';

CommonJS

const Group = require('@silky/group');

Browser

<script src="https://unpkg.com/@silky/group@:version/umd/silky-group.js"></script>

Usage

In this example you can see how to pass translate and rotate values for the transform attribute.

const App = () => (
  <svg>
    <Group transform={{ rotate: '10 20, 30', translate: [10, 20] }}>
      // ... SVG elements
    </Group>
  </svg>
);

render(<App />, document.getElementById('root'));

Props

className

  className?: string

css

  css?: Object

transform

  transform?: {
    matrix?: [number]
    rotate?: number | string
    scale?: number | [number]
    skew?: string | [string]
    translate?: [number | string]
  }

Package Sidebar

Install

npm i @silky/group

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

19.9 kB

Total Files

15

Last publish

Collaborators

  • davegomez