
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-reveal-effect
Advanced tools
Reveal Effect of Fluent Design for React
✨
🔗 https://ythinker.github.io/react-reveal-effect
🔗NPM Package https://www.npmjs.com/package/react-reveal-effect
> npm i react-reveal-effect --save
🔨you can choose to use hooks or component
🚩Whether you choose to use hooks or component, you must use the global configuration context on their parent node
🆕Draw directly with RevealEffectConstructor, with no other restrictions
Parent.ts
import { RevealEffectConfig } from 'react-reveal-effect';
const Parent = ({ children }) => {
return (
<RevealEffectConfig
globalRoot={document.querySelector('#root')}
config={{
borderColor: "#fff",
clickEffect: false,
elementGradientSize: 300
}}
>
{children}
</RevealEffectConfig>
)
}
Child.ts
import { useRevealEffect } from "react-reveal-effect";
const Child = () => {
const containerRef = useRef(null);
const buttonRef = useRef(null);
const removeEffect = useRevealEffect(
{
borderSelector: containerRef,
elementSelector: buttonRef
},
{
borderGradientSize: 100,
elementColor: '#f2f2f2'
}
);
return (
<div ref={containerRef}>
<button ref={buttonRef}></button>
</div>
)
}
import { RevealEffect } from "react-reveal-effect";
const Child = () => {
return (
<RevealEffect component="span" config={{
borderEffect: false
}}>
<button>Demo</button>
</RevealEffect>
)
}
<div id='container'>
<span id='children'></span>
</div>
<script type='module'>
import { RevealEffectConstructor } from 'react-reveal-effect'
const instance = new RevealEffectConstructor({
borderSelector: document.getElementById('container'),
elementSelector: document.getElementById('children')
}, {
elementColor: 'rgba(255, 255, 255, 0.6)'
borderColor: 'rgba(255, 255, 255, 0.4)',
root: document.body
})
// change config
instance.config = { clickEffect: true, clickColor: 'rgba(200, 200, 200)' }
// stop draw effect
instance.stop();
// restart draw effect
instance.start();
// remove event listener
instance.removeEffect();
</script>
⚙
| Config Property | Description | Type | Default |
|---|---|---|---|
| borderColor | border effect color | borderColor?: string | rgba(255, 255, 255, 0.25) |
| elementColor | hover effect color | elementColor?: string | rgba(255, 255, 255, 0.25) |
| clickColor | click effect color | clickColor?: string | rgba(255, 255, 255, 0.25) |
| clickEffect | take click effect | clickEffect?: string | false |
| borderGradientSize | border effect size | borderGradientSize?: number | 150 |
| elementGradientSize | hover effect size | elementGradientSize?: number | 150 |
| clickGradientSize | click effect size | clickGradientSize?: number | 80 |
| borderEffect | take border effect | borderEffect?: boolean | true |
| elementEffect | take hover effect | elementEffect?: boolean | true |
| stop | stop drawer effect | stop?: boolean | false |
| effectType | use which css property to draw the light effect | stop?: "border-image"|"background-image" | "background-image" |
Parameter
| Params | Description | Type |
|---|---|---|
| selectors | draw effect on the selector | { borderSelector?: MutableRefObject<HTMLElement>|HTMLElement|HTMLElement[], elementSelector: HTMLElement|HTMLElement[] } |
| config | effect config | EffectConfigType |
Property
| Props | Description | Type | default |
|---|---|---|---|
| config | effect config | ComponentConfig | |
| component | The component used for the root node | elementType | div |
Component Config(extend from EffectConfigType)
| Config Property | Description | Type | Default |
|---|---|---|---|
| ...global config | EffectConfigType | ||
| borderWidth | border effect line width | string | number | |
| border effect radius | string | number | ||
| style | container style | string | |
| borderStyle | border element style | string | |
| className | container className | string | |
| borderClassName | border element className | string | |
| borderRef | border element ref | MutableRefObject<HTMLElement> | |
| effectBoxSizing | effectBoxSizing type "content-box": might break layout "border-box": It works by shrink the child element which may cause the child element to be clipped "safe":border effect might be obscured by "overflow: hidden" and "RevealEffect" component's position property is "relative" | "content-box"|"border-box"|"safe" | "content-box" |
MIT
This plugin is extend from 🔗fluent-reveal-effect
🙆♀️ Thank U
If you have defined borderStyle|borderClassName|borderRef When RevealEffect component's config effectBoxSizing is not "border-box", they will take effect on the container element because in this case border effect will be added on the container element.
https://stackoverflow.com/questions/5706963/possible-to-use-border-radius-together-with-a-border-image-which-has-a-gradient Use clip-path: inset(0 round radius-pixel) or overflow to replace border-radius
Fix: remove side effect style
Break:
It is now easier to customize using the underlying implementation class RevealEffectConstructor
Optimize: narrow type inference
New: support to use CSS "border-image" property to draw the effect
Fix: Compatible with React 18
Optimize: Change the attribute name to make it more uniform and semantic.\
| old name | new name | new type |
|---|---|---|
| lightColor | elementColor | |
| clickEffectColor | clickColor | |
| lightGradientSize | elementGradientSize | |
| effectBorder | borderEffect | |
| effectBackground | elementEffect | |
| clickEffectGradientSize | clickGradientSize | |
| parcel | effectBoxSizing | "content-box"|"border-box"|"safe" |
New: RevealEffectConfig add a new config property "stop", which has lower priority than useRevealEffect's stop property.
New: RevealEffectConfig add a new property "off", which can stop all effect and remove event listener. This property has higher priority.
Optimize project structure
<RevealEffect> component's config borderRadius has been removed, which can be computed automatically. tips: unable to listen for borderRadius style changes, if you has such a need you can use className or style property.
update RevealEffect component type, support type derivation. fix lightColor state change
Update:
useRevealEffect accept MutableRefObject<HTMLElement>
Reveal Effect Config support mountOnBody option
Reveal Effect & Reveal Effect Config support component option
Update Reveal Effect component's options: borderWidth & borderRadius support number type
Fixed some problem of renderer when options have been changed
Added some new options for effect options. (clickEffectGradientSize, clickEffectColor)
Added some new property for RevealEffect component. (style, borderStyle, className, borderClassName, ref, borderRef)
Effect options is reactive.
Some types have been changed.
Added a new option for RevealEffect component(parcel: "shrink").
ClickEffect won't be affected by EffectBackground.
FAQs
Reveal Effect of Fluent Design for React
We found that react-reveal-effect 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.