Giter Club home page Giter Club logo

float's Introduction

float Build Status Dependency Status devDependency Status

A library for creating user interfaces.

Installation

$ npm install react-ui --save

Example

const Float = require('float-ui');

Float.createElement('HelloButton', {
  render: function() {
    return '<button>Hello ' + this.props.name + '</button>';
  }
});

console.log(Float.renderElement('<HelloButton name="Phil" />'));
// => <button>Hello Phil</button>

API Documentation

createElement(name, element)

Create a new element.

Parameters:

  • name: String_
  • element: Object
    • getDefaultProps: Function (Returns Object)
    • render: Function (Returns String)
      • this context:
        • props: Object
        • children: String

Returns: undefined

Example:

Float.createElement('AwesomeButton', {
  getDefaultProps: function() {
    return {type: 'primary'};
  },

  render: function() {
    return '<button class="btn btn-' + this.props.type + '">' + this.children + "</button>";
  }
});

extendElements(elements)

Add elements to the current Float instance from other Float instances.

Parameters:

  • elements: Object

Returns: undefined

Example:

const Float = require('float-ui');
const Float_PS = require('float-ps');

console.log(Float.getElements());
// => {HelloButton: {render: function() {...}}}

console.log(FLOAT_PS);
// => {break: {render: function() {...}}, CommandButton: {render: function() {...}}

Float.extendElements(FLOAT_PS);

console.log(Float.getElements());
// => {HelloButton: {render: function() {...}}, break: render: function() {...}, CommandButton: {render: function() {...}}}

getElements()

Parameters: None

Returns: Object

Example:

console.log(Float.getElements());
// => {someElement: {render: function() {...}}, someOtherElement: {getDefaultProps: function() {...}, render: function() {...}}

renderElement(html)

Renders an element.

Parameters:

  • html: String

Returns: String

Examples:

console.log(Float.renderElement('<b>hi</b>'));
// => <b>hi</b>

console.log(Float.renderElement('<AwesomeButton type="Danger">Delete</AwesomeButton>'));
// => <button class="btn btn-primary">Delete</button>

console.log(Float.renderElement('<div><h1>Welcome!</h1><HelloButton name="Phil" /></div>'))
// => <div><h1>Welcome!</h1><button>Hello Phil</button></div>

LICENSE

MIT

float's People

Contributors

creaturephil avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.