Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
closure-react-floating-label
Advanced tools
A React version of an MDC Floating Label.
npm install @material/react-floating-label
with Sass:
import '@material/react-floating-label/index.scss';
with CSS:
import '@material/react-floating-label/dist/floating-label.css';
React Floating Label is meant to be used with other Components, specifically input type elements. Floating label is positioned absolute, which requires the parent element to be position relative.
To shake the label you'll need to add a ref to the <FloatingLabel />
element. Using the ref, you can then call shake()
to start the shake animation. Ex:
import FloatingLabel from '@material/react-floating-label';
class MyComponent extends React.Component {
constructor(props) {
super(props);
// createRef was introduce in React v16.3
// https://reactjs.org/docs/refs-and-the-dom.html#creating-refs
this.floatingLabelElement = React.createRef();
}
render() {
return (
<FloatingLabel ref={this.floatingLabelElement}/>
My Label
</FloatingLabel>
);
}
// ... later in code ...
this.floatingLabelElement.current.shake();
}
Label width is set during mount, and is calculated from the offsetWidth
property. The Component will call handleWidthChange()
when mounted. handleWidthChange()
will execute with a new width value if this.props.children
changes.
<FloatingLabel
handleWidthChange={(width) => this.setState({width})}
>
My Label
</FloatingLabel>
Prop Name | Type | Description |
---|---|---|
className | String | Classes to be applied to the root element. |
handleWidthChange | Function | Callback method to pass the width to a parent Component. |
float | Boolean | Floats label depending on value passed. |
Sass mixins may be available to customize various aspects of the components. Please refer to the MDC Web repository for more information on what mixins are available, and how to use them.
FAQs
Material Components React Floating Label
The npm package closure-react-floating-label receives a total of 1 weekly downloads. As such, closure-react-floating-label popularity was classified as not popular.
We found that closure-react-floating-label 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.