SqlMonacoBlock() — supabase Function Reference
Architecture documentation for the SqlMonacoBlock() function in SqlMonacoBlock.tsx from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/studio/components/interfaces/QueryPerformance/SqlMonacoBlock.tsx lines 18–88
export const SqlMonacoBlock = ({
value,
className,
wrapperClassName,
height = 310,
lineNumbers = 'off',
hideCopy = false,
}: SqlMonacoBlockProps) => {
const [copied, setCopied] = useState(false)
const content = useMemo(() => value ?? '', [value])
const handleCopy = (value: string) => {
setCopied(true)
copyToClipboard(value)
setTimeout(() => setCopied(false), 1000)
}
return (
<div
className={cn('group relative border rounded-md overflow-hidden w-full', wrapperClassName)}
>
<Editor
theme="supabase"
language="pgsql"
value={content}
height={height}
className={className}
wrapperProps={{
className:
'[&_.monaco-editor]:!bg-transparent [&_.monaco-editor-background]:!bg-transparent [&_.monaco-editor]:!outline-transparent [&_.cursor]:!hidden',
}}
options={{
readOnly: true,
domReadOnly: true,
fontSize: 13,
minimap: { enabled: false },
lineNumbers,
renderLineHighlight: 'none',
scrollbar: { vertical: 'auto', horizontal: 'auto' },
overviewRulerLanes: 0,
overviewRulerBorder: false,
glyphMargin: false,
folding: false,
lineDecorationsWidth: 0,
lineNumbersMinChars: lineNumbers === 'off' ? 0 : 3,
wordWrap: 'on',
scrollBeyondLastLine: false,
selectionHighlight: false,
occurrencesHighlight: 'off',
fixedOverflowWidgets: true,
padding: { top: 12, bottom: 12 },
tabIndex: -1,
}}
/>
{!hideCopy && (
<div className="absolute right-2 top-2 opacity-0 group-hover:opacity-100 transition-opacity">
<Button
type="default"
className="px-1.5"
icon={copied ? <Check /> : <Copy />}
onClick={() => handleCopy(content)}
>
{copied ? 'Copied' : ''}
</Button>
</div>
)}
</div>
)
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free