Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
The material-ripple hook for React that actually works
Because every ripple hook/component I've tried to use in the past either didn't work, or was missing basic features.
Also available for Vue: v-wave
Here's what you can expect from this hook:
pointerdown
instead of pointerup
width
and height
.display: flex
).currentColor
).border-radius: 5px 20px 15px 30px
) perfectly fine.If you have a feature request or you found a bug, please open an issue!
Source code for the demo page can be found on the example branch.
npm
$ npm i use-wave
or
CDN
<script src="https://unpkg.com/use-wave"></script>
import useWave from 'use-wave'
function MyComponent() {
const wave = useWave()
return <button ref={wave}>Click me!</button>
}
It is possible to reuse a single wave
for multiple elements
import useWave from 'use-wave'
function List() {
const wave = useWave()
const items = ['item 1', 'item 2', 'item 2']
return (
<>
<a ref={wave} href="/">Home</a>
<ul>
{items.map(item => <li ref={wave}>{item}</li>)}
</ul>
</>
)
}
useWave({
color: 'red',
startingOpacity: 0.5,
easing: 'ease-in',
})
// your/hooks/directory/use-custom-wave.js
export const useCustomWave = (overrides = {}) => {
const defaults = {color: 'red'} // your custom global options
return useWave({...defaults, ...overrides})
}
Name | Type | Default |
---|---|---|
color | string | "currentColor" |
initialOpacity | number | 0.2 |
finialOpacity | number | 0.1 |
duration | number | 0.4 |
easing | string | ease-out |
cancellationPeriod | number | 75 |
type: string
default: "currentColor"
The background-color
of the wave.
type: number
default: 0.2
The opacity of the wave when it first appears.
type: number
default: 0.1
The opacity the wave should be when it has stopped moving.
type: number
default: 0.4
The duration of the wave animation in seconds.
type: string
default: "ease-out"
Any valid CSS <timing-function>
type: number
default: 75
The delay, in milliseconds, during which the animation will be canceled by the user moving their figure/pointer (e.g. while scrolling on a mobile phone).
Note:
The wave will not appear until after the delay, meaning a delay greater than 100ms can make the site feel sluggish.
This project is distributed under the MIT License.
Copyright (c) 2021 Justin Taddei
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
The material-ripple hook for React that actually works
The npm package use-wave receives a total of 86 weekly downloads. As such, use-wave popularity was classified as not popular.
We found that use-wave 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
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.