JSPM

@silky/text

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5
  • Score
    100M100P100Q52897F
  • License MIT

Silky Text

Package Exports

  • @silky/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 (@silky/text) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@silky/text

The <Text /> component is a React implementation of the <text> SVG element which defines a graphics element consisting of text. It's possible to apply a gradient, pattern, clipping path, mask, or filter to , just like any other SVG graphics element.

If text is included within SVG not inside of a element, it is not rendered. This is different from being hidden by default, as setting the display property will not show the text.

Roadmap

  • Vertical alignment
  • Multiline text
  • Dynamic scaling

Install

Yarn

yarn add @silky/text

NPM

npm install --save @silky/text

Import

ES5 Modules

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

CommonJS

const Text = require('@silky/text');

Browser

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

Usage

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

const App = () => (
  <svg>
    <Text>foo</Text>
  </svg>
);

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

Props

className

  className?: string

css

  css?: Object

x

  x?: number | string

y

  y?: number | string

dy

  dy?: number | string

dx

  dx?: number | string

dy

  dy?: number | string

lengthAdjust

  lengthAdjust?: 'spacing' | 'spacingAndGlyphs'

textLength

  textLength?: number | string

transform

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