Package Exports
- @vx/text
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vx/text) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@vx/text
The @vx/text provides a better SVG <Text> component with the following features
- Word-wrapping (when
widthprop is defined) - Vertical alignment (
verticalAnchorprop) - Rotation (
angleprop) - Scale-to-fit text (
scaleToFitprop)
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