# boundless-input

> An input control with placeholder emulation for non-supporting platforms.

Latest version **1.1.0** (published 2017-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install boundless-input
pnpm add boundless-input
yarn add boundless-input
bun add boundless-input
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2017-06-06 |
| First published | 2017-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 239 |
| Maintainers | probablyup |
| Keywords | react, input, placeholder, boundless |

## Links

- npm: https://www.npmjs.com/package/boundless-input
- Repository: https://github.com/enigma-io/boundless
- Homepage: https://boundless.js.org/Input
- Issues: https://github.com/enigma-io/boundless/issues
- npm.io page: https://npm.io/package/boundless-input

## Dependencies (2)

- [classnames](https://npm.io/package/classnames.md) ^2.1.5
- [boundless-utils-omit-keys](https://npm.io/package/boundless-utils-omit-keys.md) ^1.1.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-06-06
- 1.0.4 — 2017-03-14
- 1.0.3 — 2017-02-20
- 1.0.2 — 2017-02-09
- 1.0.1 — 2017-02-07
- 1.0.0 — 2017-02-07
- 1.0.0-beta.7 — 2017-02-04
- 1.0.0-beta.6 — 2017-01-26
- 1.0.0-beta.5 — 2017-01-26
- 1.0.0-beta.4 — 2017-01-25
- 1.0.0-beta.3 — 2017-01-25

## README

<!---
THIS IS AN AUTOGENERATED FILE. EDIT PACKAGES/BOUNDLESS-INPUT/INDEX.JS INSTEAD.
-->
# Input

Input abstracts away the cross-platform differences of placeholder styling and behaviors, for example: Internet Explorer dismisses native placeholders on input focus and other platforms do not. This component ensures that text input controls will feel and behave similarly on more devices.

## Component Instance Methods

When using `Input` in your project, you may call the following methods on a rendered instance of the component. Use [`refs`](https://facebook.github.io/react/docs/refs-and-the-dom.html) to get the instance.

- __getValue()__
  returns the current value of the input field

- __setValue(string)__
  programmatically set the input value; useful for clearing out the input in "uncontrolled" mode -- note that digging into the internals and setting the `refs.field.value = ''` directly will not trigger events and messes up the internal state of the component

## Installation

```bash
npm i boundless-input --save
```

Then use it like:


```jsx
/** @jsx createElement */

import { createElement, PureComponent } from 'react';
import Input from 'boundless-input';

export default class InputDemo extends PureComponent {
    state = {
        input: '',
    }

    handleChange = (e) => this.setState({ input: e.target.value })

    render() {
        return (
            <div className='spread'>
                <div>
                    <h5>hidePlaceholderOnFocus="false"</h5>
                    <Input
                        hidePlaceholderOnFocus={false}
                        inputProps={{
                            placeholder: 'Start typing and I disappear!',
                        }} />
                </div>

                <div style={{ marginLeft: '1em' }}>
                    <h5>hidePlaceholderOnFocus="true"</h5>
                    <Input
                        hidePlaceholderOnFocus={true}
                        inputProps={{
                            placeholder: 'Focus on me and I disappear!',
                        }} />
                </div>

                <div style={{ marginLeft: '1em' }}>
                    <h5>"controlled" input</h5>
                    <Input
                        hidePlaceholderOnFocus={true}
                        inputProps={{
                            placeholder: 'Focus on me and I disappear!',
                            onChange: this.handleChange,
                            value: this.state.input,
                        }} />
                </div>
            </div>
        );
    }
}
```



Input can also just be directly used from the main [Boundless library](https://www.npmjs.com/package/boundless). This is recommended when you're getting started to avoid maintaining the package versions of several components:

```bash
npm i boundless --save
```

the ES6 `import` statement then becomes like:

```js
import { Input } from 'boundless';
```



## Props

> Note: only top-level props are in the README, for the full list check out the [website](https://boundless.js.org/Input).

### Required Props

There are no required props.


### Optional Props

- __`*`__ &middot; any [React-supported attribute](https://facebook.github.io/react/docs/tags-and-attributes.html#html-attributes)

  Expects | Default Value
  ---     | ---
  `any` | `n/a`

- __`component`__ &middot; overrides the HTML container tag

  Expects | Default Value
  ---     | ---
  `string` | `'div'`

- __`hidePlaceholderOnFocus`__ &middot; triggers the placeholder to disappear when the input field is focused, reappears when the user has tabbed away or focus is moved

  Expects | Default Value
  ---     | ---
  `bool` | `true`

- __`inputProps`__

  Expects | Default Value
  ---     | ---
  `object` | `{ type: 'text' }`


## Reference Styles
### Stylus
You can see what variables are available to override in [variables.styl](https://github.com/enigma-io/boundless/blob/master/variables.styl).

```stylus
// Redefine any variables as desired, e.g:
color-accent = royalblue

// Bring in the component styles; they will be autoconfigured based on the above
@require "node_modules/boundless-input/style"
```

### CSS
If desired, a precompiled plain CSS stylesheet is available for customization at `/build/style.css`, based on Boundless's [default variables](https://github.com/enigma-io/boundless/blob/master/variables.styl).

---
_Source: https://npm.io/package/boundless-input · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
