New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vx/text

Package Overview
Dependencies
Maintainers
3
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vx/text

vx text

  • 0.0.193
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
63K
increased by21.94%
Maintainers
3
Weekly downloads
 
Created
Source

@vx/text

The @vx/text provides a better SVG <Text> component with the following features

  • Word-wrapping (when width prop is defined)
  • Vertical alignment (verticalAnchor prop)
  • Rotation (angle prop)
  • Scale-to-fit text (scaleToFit prop)

Example

Simple demo to show off a useful feature. Since svg <text> itself does not support verticalAnchor, normally text rendered at 0,0 would be outside the viewport and thus not visible. By using <Text> with the verticalAnchor="start" prop, the text will now be visible as you'd expect.

import React from 'react';
import { render } from 'react-dom';
import { Text } from '@vx/text';

const App = () => (
  <svg>
    <Text verticalAnchor="start">Hello world</Text>
  </svg>
);

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

Installation

npm install --save @vx/text

Components

API

<Text />

# Text.angle<number>

# Text.capHeight<union(number|string)>

Default'0.71em'

# Text.children<any>

# Text.dx<union(number|string)>

Default0

# Text.dy<union(number|string)>

Default0

# Text.innerRef<union(func|object)>

# Text.lineHeight<union(number|string)>

Default'1em'

# Text.scaleToFit<bool>

Defaultfalse

# Text.style<object>

# Text.textAnchor<enum('start'|'middle'|'end'|'inherit')>

Default'start'

# Text.verticalAnchor<enum('start'|'middle'|'end')>

Default'end'

# Text.width<number>

# Text.x<union(number|string)>

Default0

# Text.y<union(number|string)>

Default0

Keywords

FAQs

Package last updated on 30 Jan 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