Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

react-tile

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tile

A tile ui component to display text and other media.

Source
npmnpm
Version
0.0.1-beta.1
Version published
Weekly downloads
9
-40%
Maintainers
1
Weekly downloads
 
Created
Source

react-tile

Build Status Dependency Status devDependency Status

Disclaimer: This component is work in progress. Dreamcode can be found in DREAMCODE.md. Unit tests are coming.

Usage

Installation: npm install -S react-tile.

Consume using ES6 modules (and browserify):

const React = require('react')
import {Tile} from 'react-tile'

React.render(
  <Tile background="url(path/to/img.png)" bar="subtext">Main content</Tile>
)

API

This module exports three components:

Most likely you only want to use Tile - buy hey, modularity!

Tile

The Tile component is very flexible and allows you to manipulate its rendering using these props:

  • width: define the width of the tile
  • background: provide the background for SquareBox
  • backgroundSize: provide the backgroundSize for SquareBox
  • bar: provide content for the bottom bar or disable it
  • barBackground: provides background styles as a string

width

The width of the Tile component also defines the length of a side of SquareBox. It can be any CSS value as string. Default is "100%".

background

The background prop is a string. It will used as value for the css background property of SquareBox.Default is "black".

bar

The bar prop can be a string (shorthand) or a React component used as content for TextCell.

barBackground

The barBackground prop provides the css background styles for the TextCell.

Examples

This is somewhat pseudo-code, but provided the used React components, exist you should be able to do this.

Using a imaginary TimeRelative component, that formats dates:

  <Tile 
  background="foo/bar/baz.png"
  content="Text inside square" 
  bar=<TimeRelative date={this.props.date}> />

SquareBox

The SquareBox component has the same width and height. It supports these props:

  • size: Specifies the size of one side; default is "100%"
  • background: value for css background property or React component to be used as background; see above for details
  • backgroundSize: value for css backgroundSize property; Default is "cover"

TextCell

The TextCell component does not wrap text, hides overflowing elements and - if provided a string - will automatically cut off strings that are too long for the width of the tile, using an ellipsis. It supports these props:

  • truncating: Truncate long text when if overflows; default is true

License

MIT License 2015 © David Pfahler and contributors

Keywords

react

FAQs

Package last updated on 21 Feb 2015

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