### Install m3ripple-vue Package Source: https://github.com/swuerpy/m3ripple-vue/blob/main/README.md These commands show how to install the m3ripple-vue package using various package managers like npm, pnpm, yarn, and bun. It's the first step before using the component in your Vue project. ```bash # npm npm install m3ripple-vue # pnpm pnpm add m3ripple-vue # yarn yarn add m3ripple-vue # bun bun add m3ripple-vue ``` -------------------------------- ### Vue: Global Plugin Installation Source: https://context7.com/swuerpy/m3ripple-vue/llms.txt Explains how to install the m3ripple-vue component globally in a Vue application using `app.use()`. This allows the `Ripple` component to be used in any child component without needing individual imports, simplifying development. ```typescript // main.ts import { createApp } from "vue"; import App from "./App.vue"; import m3ripple from "m3ripple-vue"; import "m3ripple-vue/style.css"; const app = createApp(App); // Install globally app.use(m3ripple); app.mount("#app"); ``` ```vue ``` -------------------------------- ### Vue Card with Interactive Ripple Effect Source: https://github.com/swuerpy/m3ripple-vue/blob/main/README.md This Vue example demonstrates how to apply the `` component to a `
` element to create an interactive card with a ripple effect. It emphasizes that the parent `div` must have `position: relative` and shows how to add content within the card. ```vue

Interactive Card

Click anywhere on this card.

``` -------------------------------- ### Vue Button with Ripple Effect Source: https://github.com/swuerpy/m3ripple-vue/blob/main/README.md A simple Vue example showcasing the `` component applied to a basic button. This snippet focuses on the integration of the ripple effect within a standard button element, requiring the button to have `position: relative`. ```vue ``` -------------------------------- ### Basic Vue Usage of Ripple Component Source: https://github.com/swuerpy/m3ripple-vue/blob/main/README.md This Vue component example demonstrates how to import and use the `` component within a button. It highlights the necessity of importing the component and its associated styles, as well as setting the parent element's CSS `position` property to `relative` for correct ripple effect positioning. ```vue ``` -------------------------------- ### Vue with TypeScript: Using Ripple Component Props Source: https://context7.com/swuerpy/m3ripple-vue/llms.txt Illustrates how to use the `Ripple` component in a Vue application with TypeScript, demonstrating the use of various props like `isMaterial3`, `rippleColor`, and custom callback functions (`beforeRippleFn`). This example showcases type safety when passing props and handling events. ```vue ``` -------------------------------- ### Vue: Basic Ripple Component Integration Source: https://context7.com/swuerpy/m3ripple-vue/llms.txt Integrates the basic Ripple component from m3ripple-vue into a Vue 3 application. Ensure the parent element has a `position` CSS property set to `relative`, `absolute`, `fixed`, or `sticky`. This example demonstrates a standard button with a ripple effect. ```vue ``` -------------------------------- ### Vue Ripple Component Style Variants Source: https://github.com/swuerpy/m3ripple-vue/blob/main/README.md This Vue snippet illustrates how to customize the ripple effect using props on the `` component. It shows examples for enabling Material 2 ripple behavior (`isMaterial3='false'`), changing the ripple color (`rippleColor`), and modifying the sparkles color (`sparklesColorRGB`). ```vue ``` -------------------------------- ### Vue: Execute Logic Before Ripple Animation Source: https://context7.com/swuerpy/m3ripple-vue/llms.txt Demonstrates how to use the `beforeRippleFn` callback in Vue to execute custom logic, such as updating component state or logging event details, just before the ripple animation begins. This is useful for synchronizing animations or state changes with user interactions. ```vue ``` -------------------------------- ### TypeScript: Ripple Component Props Interface Source: https://context7.com/swuerpy/m3ripple-vue/llms.txt Provides the TypeScript interface `RippleProps` which defines all available props for the `Ripple` component. This includes detailed type definitions and default values for properties like `isMaterial3`, `rippleColor`, `sparklesColorRGB`, and more, facilitating type-safe usage in TypeScript projects. ```typescript interface RippleProps { // Enable Material 3 style (with sparkles) or Material 2 style (simple ripple) isMaterial3?: boolean; // default: true // Callback executed before ripple animation starts beforeRippleFn?: (event: MouseEvent | TouchEvent) => void; // default: () => {} // Color of the ripple circle (use rgba/hsla for transparency) rippleColor?: string; // default: "#ffffff35" // RGB color for sparkles (space-separated, e.g., "255 128 0") sparklesColorRGB?: string; // default: "255 255 255" // Opacity level 1 for sparkles before they disappear opacity_level1?: string; // default: "0.2" // Opacity level 2 for sparkles just before they disappear opacity_level2?: string; // default: "0.1" // Maximum number of sparkle particles to render sparklesMaxCount?: number; // default: 2048 } ``` -------------------------------- ### Vue: Advanced Sparkle Customization Source: https://context7.com/swuerpy/m3ripple-vue/llms.txt Fine-tunes the appearance and performance of Material 3 sparkles using advanced props. `sparklesMaxCount` limits the number of sparkles, `sparklesColorRGB` sets their color, and `opacity_level1`/`opacity_level2` control transparency for different ripple stages, enabling optimized visual effects. ```vue ``` -------------------------------- ### Vue: Custom Ripple and Sparkle Colors Source: https://context7.com/swuerpy/m3ripple-vue/llms.txt Demonstrates how to customize the ripple and sparkle colors using various color formats like `rgba`, `hsla`, or RGB values. The `rippleColor` prop controls the main ripple, while `sparklesColorRGB` customizes the sparkle color, allowing for distinct visual themes. ```vue ``` -------------------------------- ### Vue: Material 2 Style Ripple Effect Source: https://context7.com/swuerpy/m3ripple-vue/llms.txt Applies a classic Material 2 ripple effect without the animated sparkles by setting the `isMaterial3` prop to `false` on the `Ripple` component. This provides a simpler ripple animation suitable for older Material Design implementations. ```vue ``` -------------------------------- ### Vue: Ripple Effect on Non-Button Elements (Cards) Source: https://context7.com/swuerpy/m3ripple-vue/llms.txt Applies the ripple effect to a non-button HTML element, such as a `div` representing a card. This showcases the flexibility of the `Ripple` component, allowing interactive feedback on various UI elements beyond standard buttons. ```vue ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.