react-glass-surface
source link: https://www.npmjs.com/package/react-glass-surface
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
react-glass-surface
Introduction
react-glass-surface is:
- ✨ A container styled like a glass pane (see: glassmorphism)
- 💞 Behaves exactly like a
div
and doesn't add another layer - 🖌 Fully-Customizable and easy-to-use
- 🅾 Coming with zero dependencies
- 🖼 You can pass
style
andclassName
to apply your own styles - ♻ All props are passed to the container (e.g.
onClick
)
Installation
- Using yarn
yarn add react-glass-surface
- Using npm
npm install react-glass-surface
Make sure that your React
version is > 16.8
!
Basic Usage
import Glass from 'react-glass-surface'
const YourComponent = () => {
return (
<Glass>
<p>Content</p>
</Glass>
)
}
PROPS
There are different props available to customize the container. None of these are needed. Keep in mind that the css property backdrop-filter
can only be styled via className
. The default values for these props are actually styled via className
.
background: ?string = 'rgba(255, 255, 255, 0.2)'
border: ?string = 'none'
borderRadius: ?string = '0px'
boxShadow: ?string = 'none'
className: ?string = ''
style: ?Object = {}
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK