Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@visx/text

Package Overview
Dependencies
Maintainers
4
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visx/text

visx text

  • 0.0.200-alpha.0
  • alpha
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
397K
increased by3.73%
Maintainers
4
Weekly downloads
 
Created

What is @visx/text?

@visx/text is a part of the VisX library, which provides a collection of reusable low-level visualization components for React. The @visx/text package specifically focuses on rendering text elements with various configurations, such as wrapping, truncation, and alignment, making it easier to handle text in SVG elements.

What are @visx/text's main functionalities?

Basic Text Rendering

This feature allows you to render basic text within an SVG element. You can specify the position, font size, and color of the text.

import { Text } from '@visx/text';

function BasicText() {
  return (
    <svg width={500} height={500}>
      <Text x={100} y={100} fontSize={16} fill="black">
        Hello, VisX!
      </Text>
    </svg>
  );
}

Text Wrapping

This feature allows you to wrap text within a specified width. This is useful for ensuring that long text strings fit within a given space.

import { Text } from '@visx/text';

function WrappedText() {
  return (
    <svg width={500} height={500}>
      <Text x={10} y={10} width={200} fontSize={16} fill="black">
        This is a long text that will wrap within the specified width.
      </Text>
    </svg>
  );
}

Text Truncation

This feature allows you to truncate text that exceeds a specified width. This is useful for ensuring that text does not overflow its container.

import { Text } from '@visx/text';

function TruncatedText() {
  return (
    <svg width={500} height={500}>
      <Text x={10} y={10} width={100} fontSize={16} fill="black" verticalAnchor="start" truncate>
        This is a long text that will be truncated.
      </Text>
    </svg>
  );
}

Text Alignment

This feature allows you to align text both horizontally and vertically within an SVG element. This is useful for centering text or aligning it to specific points.

import { Text } from '@visx/text';

function AlignedText() {
  return (
    <svg width={500} height={500}>
      <Text x={250} y={250} fontSize={16} fill="black" textAnchor="middle" verticalAnchor="middle">
        Centered Text
      </Text>
    </svg>
  );
}

Other packages similar to @visx/text

Keywords

FAQs

Package last updated on 16 Sep 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc