Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

buildo/react-input-children

Repository files navigation

React Input Children

InputChildren is a replacement for the base input react component capable of rendering a child (link, button...) inside the input itself. It supports the same props of react input.

import InputChildren from 'react-input-children';

React.renderComponent(
  <div>
    <InputChildren {...inputProps}>
      <a href="/forgot-password">Forgot?</a>
    </InputChildren>
  </div>,
  document.body);

Screenshot

Live Examples

Install

npm install --save react-input-children

Under the hood

The JSX is structured as follows:

<div>
  <input/>
  <div>
    {children}
  </div>
</div>

Inside componentDidMount InputChildren gets height and width of the child div wrapper and uses them to position it correctly inside the input and to give the correct right padding to the input itself.

About

InputChildren is a replacement for the base input react component capable of rendering a child (link, button ..) inside the input itself.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published