Skip to content

Files

Latest commit

a359c53 · Jul 18, 2016

History

History
48 lines (40 loc) · 1.62 KB

text-input.md

File metadata and controls

48 lines (40 loc) · 1.62 KB

TextInput

Properties

Property Type Description
background string, bool Sets the background color of a component, if bool, the color will be used as the background color.
color string Sets the main color of a component and it's children.
defaultValue string Sets the default value of the input.
hidden bool Sets the visibility of a component.
label string Adds a label to the input.
margin string Sets the outer margin of a component.
E.G. "30px 20px"
onChange function Callback function when the input changes.
placeholder function Adds a placeholder to the input.
theme string Sets the UI theme that is used by this component and its children elements.
Property value "light", "dark"
value string Sets the value of the input.
width number Sets the width of a component.

Examples

import React, { Component } from 'react';
import { TextInput } from 'react-desktop/windows';

export default class extends Component {
  static defaultProps = {
    color: '#cc7f29',
    theme: 'light'
  };

  handleChange = e => console.log(e.target.value);

  render() {
    return (
      <TextInput
        ref="input"
        theme={this.props.theme}
        color={this.props.color}
        background
        label="My Input"
        placeholder="My Input"
        onChange={this.handleChange}
      />
    );
  }
}