Konsta UI 的 Material 主題帶有 Material Design 觸摸漣漪效果的實作。
在 Material 主題中,它預設為啟用。
使用這些額外的工具類別,我們可以控制觸摸漣漪的「波浪」顏色
類別 | CSS | |
---|---|---|
.touch-ripple-current | --k-touch-ripple-color: rgba(0, 0, 0, 0.1) | 從父元素的文字顏色繼承觸摸漣漪顏色 |
.touch-ripple-black | --k-touch-ripple-color: rgba(255, 255, 255, 0.15) | 使觸摸漣漪為黑色 |
.touch-ripple-white | --k-touch-ripple-color: currentColor | 使觸摸漣漪為白色 |
.touch-ripple-[color] | --k-touch-ripple-color: rgba([color], 0.25) | 使觸摸漣漪為指定的顏色 |
例如
import { Button } from 'konsta/react';
export default function () {
return (
...
{/* Makes button with red touch ripple */}
<Button className="touch-ripple-red-500">Click me</Button>
...
)
}