Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
boundless-input
Advanced tools
An input control with placeholder emulation for non-supporting platforms.
An input control with placeholder emulation for non-supporting platforms.
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.
When using Input
in your project, you may call the following methods on a rendered instance of the component. Use refs
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
import React from 'react';
import Input from '../index';
export default class InputDemo extends React.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>
);
}
}
Note: only top-level props are in the README, for the full list check out the website.
There are no required props.
*
・ any React-supported attribute
Expects | Default Value
| -
any
| n/a
component
・ overrides the HTML container tag
Expects | Default Value
| -
string
| 'div'
hidePlaceholderOnFocus
・ 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', }
// Bring in Boundless's base Stylus variables
@require "node_modules/boundless-input/variables"
// 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"
If desired, a precompiled plain CSS stylesheet is available for customization at /build/style.css
, based on Boundless's default variables.
FAQs
An input control with placeholder emulation for non-supporting platforms.
The npm package boundless-input receives a total of 11 weekly downloads. As such, boundless-input popularity was classified as not popular.
We found that boundless-input demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.