vdux-text
Text rendering component
Last updated 5 years ago by ashaffer88 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install vdux-text 
SYNC missed versions from official npm registry.

text

js-standard-style

Text rendering component

Installation

$ npm install vdux-text

Usage

Use this as a convenience for rendering text. It gives you a nice shorthand for common text-rendering style changes.

function render () {
  return (
    <Text bold transform='capitalize'>
      this is some text
    </Text>
  )
}

API - props

  • font - Font family. Checks the fonts key in your base theme, and if it exists, indexes into it. If something is found, it will use that font, otherwise it'll use the literal value.
  • bold - Boolean. Whether or not to bold the text.
  • italic - Set font style to italic.
  • weight - Font weight. Will check for weightScale in your theme and if found, will index into it using this prop. If nothing is found in the theme, the literal value will be used.
  • lh - Line-height. Checks for lineHeightScale in your theme and indexes into it if possible, otherwise uses the literal.

Theming

The <Text/> component can also be themed by setting the following properties in the baseTheme key of your context:

  • fonts - A map of keys to font family names. E.g. {code: 'monospace', ornate: 'serif'}.
  • weightScale - A keyed map of font weights. Can be an object with named keys or a simple array that you index into.
  • lineHeightScale - Same as the others, but with line heights.

License

MIT

Current Tags

  • 1.0.2                                ...           latest (5 years ago)

3 Versions

  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (11)
Dependents (2)

Copyright 2014 - 2016 © taobao.org |