@silky/text

0.1.0 • Public • Published

@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]
  }

Dependencies (0)

    Dev Dependencies (19)

    Package Sidebar

    Install

    npm i @silky/text

    Weekly Downloads

    3

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    24.3 kB

    Total Files

    15

    Last publish

    Collaborators

    • davegomez