--- title: Ripple description: "`Ripple`は、要素に波及効果を付与し、ユーザーがクリックしたかどうかを認識させるコンポーネントです。" links: - style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/ripple/ripple.style.ts - source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/ripple --- ```tsx const { onClick, ...rippleProps } = useRipple() return (
Button
) ``` :::warning `Ripple`の親要素のスタイルに`position: relative`と`overflow: hidden`を設定する必要があります。 ::: ## 使い方 ```tsx import { Ripple, useRipple } from "@yamada-ui/react" ``` ```tsx import { Ripple, useRipple } from "@/components/ui" ``` ```tsx import { Ripple, useRipple } from "@workspaces/ui" ``` ```tsx ``` ### カラーを変更する カラーを変更する場合は、`color`に色を設定します。デフォルトでは、`currentColor`が設定されています。 ```tsx const { onClick, ...rippleProps } = useRipple() return (
Button
) ``` ### 無効にする 無効にする場合は、`disabled`を`true`に設定します。 ```tsx const { onClick, ...rippleProps } = useRipple({ disabled: true }) return (
Button
) ``` または、`Ripple`の`disabled`を`true`にすることで無効にできます。 ```tsx const { onClick, ...rippleProps } = useRipple() return (
Button
) ``` ## Props | Prop | Default | Type | Description | | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | | `as` | - | `DOMElement` | The HTML element to render. | | `asChild` | - | `boolean` | Merges its props onto its immediate child. | | `css` | - | `CSSObject \| CSSObject[]` | The CSS object. | | `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. | | `onClear` | - | `(key: Key) => void` | The callback invoked when a ripple is cleared. | | `ripples` | - | `RippleOptions[]` | The ripples to use. | | `disabled` | `false` | `boolean` | If `true`, disable ripple effects when pressing a element. |