Socket
Socket
Sign inDemoInstall

@visx/group

Package Overview
Dependencies
10
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @visx/group

visx group


Version published
Weekly downloads
533K
decreased by-6.61%
Maintainers
4
Install size
1.78 MB
Created
Weekly downloads
 

Package description

What is @visx/group?

@visx/group is a part of the VisX library, which is a collection of reusable low-level visualization components. The @visx/group package specifically provides a way to group SVG elements together, making it easier to manage and transform collections of SVG elements as a single unit.

What are @visx/group's main functionalities?

Grouping SVG Elements

This feature allows you to group multiple SVG elements together and apply transformations like translation to the entire group. In this example, two circles are grouped together and the entire group is translated 100 units down and 100 units to the right.

import { Group } from '@visx/group';
import { Circle } from '@visx/shape';

function MyComponent() {
  return (
    <svg width={500} height={500}>
      <Group top={100} left={100}>
        <Circle cx={50} cy={50} r={20} fill="blue" />
        <Circle cx={150} cy={50} r={20} fill="red" />
      </Group>
    </svg>
  );
}

Nested Groups

This feature allows you to nest groups within other groups, enabling complex transformations and hierarchical structuring of SVG elements. In this example, a blue circle is grouped and translated, and within that group, another group containing a red circle is further translated.

import { Group } from '@visx/group';
import { Circle } from '@visx/shape';

function MyComponent() {
  return (
    <svg width={500} height={500}>
      <Group top={50} left={50}>
        <Circle cx={50} cy={50} r={20} fill="blue" />
        <Group top={50} left={50}>
          <Circle cx={50} cy={50} r={20} fill="red" />
        </Group>
      </Group>
    </svg>
  );
}

Other packages similar to @visx/group

Readme

Source

@visx/group

<Group /> provides a simplified API for SVG <g /> elements, which are containers for other SVG objects. You may pass in a top and left margin (instead of transform={translate(...)}) and a className.

Installation

npm install --save @visx/group

Keywords

FAQs

Last updated on 02 May 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc