liquid-metal-border
यह क्या करती है
यह स्किल एजेंट को metal-fx पैकेज से React तत्व के चारों ओर धात्विक, एनिमेटेड WebGL बॉर्डर जोड़ना सिखाती है। यह उन डेवलपर्स के लिए है जिन्हें चुने हुए या सक्रिय कंट्रोल पर प्रीमियम हाइलाइट चाहिए।
कब इस्तेमाल करें
- ✓जब बटन, कार्ड या टैब चुने जाने या सक्रिय होने पर धात्विक बॉर्डर दिखाए।
- ✓जब प्रीमियम या होवर स्टेट के लिए तरल-धातु किनारा चाहिए।
- ✓जब React प्रोजेक्ट में धात्विक बॉर्डर को ठीक या ट्यून करना हो।
Skill का लिंक
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/liquid-metal-border/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मेरे React ऐप में चुने हुए प्राइसिंग कार्ड पर तरल-धातु बॉर्डर जोड़िए, और सादा बॉर्डर फ़ॉलबैक के रूप में रहे।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट एक असली इंटरैक्टिव तत्व को metal कंपोनेंट में लपेटता है और उसकी एनिमेशन को सक्रिय या चुने हुए स्टेट से जोड़ता है। फ़ॉलबैक के रूप में एक स्थिर बॉर्डर रहता है, और निष्क्रिय आइटम संसाधन बचाने के लिए रोक दिए जाते हैं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Liquid Metal Border
Core Contract
- Use
metal-fxin React 18 or newer. - Wrap exactly one real host element such as a
button,a,div, orarticle. - Keep the host semantic and interactive.
MetalFxis visual framing, not the control. - Reserve the animated border for active, selected, focused, hovered, or primary surfaces. Do not put it around every control.
- Keep a static CSS border or focus outline as the fallback. WebGL decoration must never carry essential state by itself.
- Pause non-active instances and reduced-motion experiences.
- Test light and dark modes independently. Reflections intentionally render only in dark mode.
Inspect Before Editing
- Confirm the project uses React and has
reactandreact-domversion 18 or newer. - Find the real control, its dimensions, radius, background, border, outline, shadow, active-state source, and theme source.
- Decide whether the metal should be always visible or driven by
active,selected, hover, or focus state. - Check whether the project has a manual theme toggle. Use that state instead of
theme="auto"when it does not follow the OS. - Identify nearby elements that genuinely benefit from reflected light. Do not add reflections by default.
- Check the installed
metal-fxversion before relying on the prop surface below.
Install and Import
Install with the project's package manager:
npm install metal-fx
# pnpm add metal-fx
# yarn add metal-fx
# bun add metal-fx
Import the named React component:
import { MetalFx } from "metal-fx";
Do not import a stylesheet. The package injects its component styles. It supports ESM and CommonJS builds, is SSR-safe, and mounts the WebGL pipeline after hydration. In a Next.js App Router project, render it from a Client Component because the component uses client-side React hooks.
Baseline Button
Start with a restrained border before adding reflections or custom shader geometry:
import { MetalFx } from "metal-fx";
export function UpgradeButton() {
return (
<MetalFx
variant="button"
preset="chromatic"
theme="auto"
strength={0.85}
>
<button type="button">Upgrade to Pro</button>
</MetalFx>
);
}
The wrapper measures the child, paints the metal ring on top, and keeps the child interactive. Size the child normally with CSS, Tailwind, or inline styles.
Active-State Pattern
Keep one mounted instance and drive its intensity from real component state. Use aria-pressed, aria-selected, or the native selected-state mechanism so the visual effect is not the only signal.
"use client";
import { useEffect, useState } from "react";
import { MetalFx } from "metal-fx";
function useReducedMotion() {
const [reduced, setReduced] = useState(false);
useEffect(() => {
const query = window.matchMedia("(prefers-reduced-motion: reduce)");
const sync = () => setReduced(query.matches);
sync();
query.addEventListener("change", sync);
return () => query.removeEventListener("change", sync);
}, []);
return reduced;
}
export function LiquidMetalToggle({
selected,
onSelect,
}: {
selected: boolean;
onSelect: () => void;
}) {
const [hovered, setHovered] = useState(false);
const [focused, setFocused] = useState(false);
const reducedMotion = useReducedMotion();
const highlighted = selected || hovered || focused;
return (
<MetalFx
className="liquid-metal-toggle"
variant="button"
preset="chromatic"
strength={highlighted ? 0.9 : 0.14}
paused={reducedMotion || !highlighted}
disableGlow={reducedMotion || !highlighted}
ringCssPx={selected ? 1.5 : 1}
normalizeHostStyles={false}
>
<button
type="button"
className="liquid-metal-toggle__control"
aria-pressed={selected}
onClick={onSelect}
onPointerEnter={() => setHovered(true)}
onPointerLeave={() => setHovered(false)}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
>
Auto
</button>
</MetalFx>
);
}
.liquid-metal-toggle {
background: #18181b;
border-radius: 999px;
}
.liquid-metal-toggle__control {
min-height: 40px;
padding: 0 18px;
color: #fafafa;
background: transparent;
border: 0;
border-radius: 999px;
box-shadow: none;
}
.liquid-metal-toggle__control:focus-visible {
outline: 2px solid #ffffff;
outline-offset: 3px;
}
Use paused t
अक्सर पूछे जाने वाले सवाल
क्या धात्विक बॉर्डर बटन की जगह लेता है?
नहीं। यह सिर्फ़ दृश्य फ़्रेम है, और असली बटन या लिंक ही कंट्रोल रहता है।
हर बटन पर क्यों नहीं लगाया जाता?
स्किल इसे सक्रिय, चुने हुए, फ़ोकस किए गए या मुख्य तत्वों के लिए रखने को कहती है।
क्या यह डार्क और लाइट मोड में काम करता है?
हाँ, लेकिन स्किल कहती है कि दोनों को अलग-अलग जाँचें, क्योंकि परावर्तन सिर्फ़ डार्क मोड में दिखते हैं।
जानकारी
लेखक का मूल विवरण
Add and tune animated liquid-metal WebGL borders with the React `metal-fx` package. Use when buttons, icon controls, chips, tabs, cards, or selected surfaces need a metallic active, selected, hover, focus, or premium border; when implementing the MetalFx component from metal.jakubantalik.com; or when troubleshooting its presets, themes, strength, glow, reflections, sizing, radius, animation, accessibility, SSR, or performance.
repo: MengTo/Skills
लोकप्रियता
- GitHub स्टार
- 7.2k
- रैंकिंग में स्थान
- #13446
- लाइसेंस
- MIT
- अपडेट की गई
- 1/11/2026
कमेंट
- …
इस repository की और skills
3d-cloth-material
7.2kआपके एजेंट को Three.js में असली बुने हुए कपड़े जैसा दिखने वाला मटीरियल बनाने में मदद करती है, जिसमें धागों की बुनाई, हल्की चमक, प्राकृतिक सिलवटें, किनारे और सीवन हों।
3d-falling-leaves
7.2kआपके एजेंट को 3D दृश्य में असली लगने वाली गिरती पत्तियाँ जोड़ने देती है, जो लुढ़कती हैं, हवा के साथ बहती हैं और कैमरा हिलने पर दोबारा इस्तेमाल होती हैं।
3d-four-seasons
7.2kआपके एजेंट को 3D दृश्य में वसंत, गर्मी, शरद और सर्दी के रूप जोड़ने देती है, जिसमें हरियाली, रोशनी, आसमान और बर्फ़ बिना दृश्य दोबारा बनाए बदलते हैं।
3d-high-poly-models
7.2kआपके एजेंट को चिकने आकार और विश्वसनीय किनारों वाले विस्तृत 3D मॉडल बनाने देती है, और फिर वेब पर अच्छे चलने वाले हल्के संस्करण तैयार करती है।
मिलती-जुलती skills
angular-developer
280kआपके एजेंट को Angular code बनाने और प्रोजेक्ट स्ट्रक्चर पर सलाह देने में मदद करता है। नए प्रोजेक्ट शुरू करने, code के हिस्से बनाने, या performance और accessibility सुधारने में उपयोगी है।
frontend-a11y
280kआपके एजेंट को web interfaces को सबके लिए accessible बनाने में मदद करता है। यह सुनिश्चित करता है कि websites और apps screen readers और keyboard navigation के साथ अच्छे से काम करें।
frontend-patterns
280kआपके एजेंट को React और Next.js में frontend development के modern patterns लागू करने में मदद करता है। यह performance optimize करता है, state manage करता है और best practices फॉलो करवाता है।