### Performance Tuning Props Examples Source: https://context7.com/molefrog/spoiled/llms.txt Illustrates how to use performance tuning props like `fps`, `density`, and `gap` to adjust animation smoothness and appearance. ```APIDOC ## Performance Tuning Props ### Low-Power Mode ```tsx Battery-friendly spoiler ``` ### High-Density Effect ```tsx Very opaque noise ``` ### Disable Gap ```tsx No edge gap ``` ### Custom Gap ```tsx 12px clear border around noise ``` ### Disable Word-Gap Mimicry ```tsx Rendered as solid line boxes, no word spacing simulation ``` **Note:** `prefers-reduced-motion` is respected automatically, setting `fps` to 0 internally to freeze the animation. ``` -------------------------------- ### Install Spoiler Component Source: https://context7.com/molefrog/spoiled/llms.txt Install the spoiled package using yarn. ```bash yarn add spoiled ``` -------------------------------- ### Theming and Accent Color Examples Source: https://context7.com/molefrog/spoiled/llms.txt Demonstrates how to customize the theme and accent color of the Spoiler component for different visual appearances. ```APIDOC ## Theming and Accent Color ### System Theme (Default) ```tsx System-aware spoiler ``` ### Force Dark Noise ```tsx Always dark ``` ### Force Light Noise ```tsx Always light ``` ### Single Accent Color ```tsx Red noise ``` ### Separate Colors for Light and Dark Themes ```tsx Blue — darker in light mode, lighter in dark mode ``` ``` -------------------------------- ### Install Spoiled React Component Source: https://github.com/molefrog/spoiled/blob/main/README.md Install the package using npm, pnpm, or yarn. Requires React 18. ```jsx npm i spoiled ``` ```jsx pnpm add spoiled ``` ```jsx yarn add spoiled ``` -------------------------------- ### Spoiler Performance Tuning Examples Source: https://context7.com/molefrog/spoiled/llms.txt Illustrates how to tune the performance of the Spoiler component using props like 'fps', 'density', and 'gap'. These props control animation smoothness, particle density, and edge padding, with 'mimicWords' affecting word-shape simulation. ```tsx import { Spoiler } from "spoiled"; // Low-power mode: fewer fps, lower density Battery-friendly spoiler // High-density dramatic effect Very opaque noise // Disable gap (particles fill all the way to the edge) No edge gap // Custom gap in pixels 12px clear border around noise // Disable word-gap mimicry (Houdini path only) Rendered as solid line boxes, no word spacing simulation // prefers-reduced-motion is respected automatically: // fps is set to 0 internally, freezing the animation ``` -------------------------------- ### Basic Spoiler Usage (Uncontrolled, Hover Reveal) Source: https://context7.com/molefrog/spoiled/llms.txt Use this for a simple, self-managed spoiler that reveals its content on hover. No additional setup is required beyond importing the component. ```tsx import { Spoiler } from "spoiled"; // or, without auto-injected CSS: // import { Spoiler } from "spoiled/no-css"; // import "spoiled/style.css"; // load separately in your bundler // --- Minimal usage (uncontrolled, reveals on hover) --- The butler did it. ``` -------------------------------- ### Spoiler Theming and Accent Color Examples Source: https://context7.com/molefrog/spoiled/llms.txt Demonstrates how to control the visual theme and accent color of the Spoiler component. The 'theme' prop accepts 'system', 'light', or 'dark', while 'accentColor' can be a single color or a tuple for light/dark themes. ```tsx import { Spoiler } from "spoiled"; // System theme (default) System-aware spoiler // Force dark noise Always dark // Force light noise Always light // Single accent color (same in both themes) Red noise // Separate colors for light and dark themes Blue — darker in light mode, lighter in dark mode ``` -------------------------------- ### Spoiler Component Full Prop Reference Source: https://context7.com/molefrog/spoiled/llms.txt This snippet shows the complete set of props for the Spoiler component, including visibility control, element customization, transition effects, noise appearance, performance tuning, and fallback options. It also includes an example of a controlled state with theming and performance adjustments. ```tsx import { Spoiler, type SpoilerProps } from "spoiled"; const props: SpoilerProps = { // ── Visibility control ────────────────────────────────────────────────── hidden: true, // controlled: true = hidden, false = revealed defaultHidden: true, // uncontrolled initial state (default: true) revealOn: "hover", // "click" | "hover" | false (default: "hover" when uncontrolled) onHiddenChange: (v) => {}, // fires whenever hidden state changes // ── Element ───────────────────────────────────────────────────────────── tagName: "span", // any intrinsic HTML tag (default: "span") asChild: false, // merge onto single child element instead of wrapping // ── Content reveal transition ──────────────────────────────────────────── transition: "iris", // "iris" | "fade" | "none" | false (default: "iris") // false / "none" = no transition wrapper injected // ── Noise appearance ───────────────────────────────────────────────────── theme: "system", // "system" | "light" | "dark" (default: "system") accentColor: "#3b82f6", // primary noise color; or [lightColor, darkColor] tuple // accentColor: ["#1e3a5f", "#93c5fd"], // ── Performance ────────────────────────────────────────────────────────── fps: 24, // animation frames-per-second (default: 24) density: 0.12, // particle density 0–1 (default: 0.12) gap: 6, // particle-free border in px, or false to disable (default: 6) mimicWords: true, // Houdini only: fake inter-word gaps (default: true) noiseFadeDuration: 1.5, // seconds for the noise to fade in/out (default: 1.5) // ── Fallback (non-Houdini browsers) ───────────────────────────────────── fallback: "repeat top left / 16px 16px url(/pattern.png)", // CSS background value for static fallback; false = none forceFallback: false, // always use canvas fallback even in Houdini browsers }; // Full example combining performance + theming + controlled state function MyComponent() { const [hidden, setHidden] = useState(true); return ( ); } ``` -------------------------------- ### CSS-Only Import Source: https://context7.com/molefrog/spoiled/llms.txt Instructions on how to import the Spoiler component's CSS separately using the unstyled entry point and a bundler. ```APIDOC ## CSS-Only Import (`spoiled/no-css` + `spoiled/style.css`) By default `spoiled` injects a `