createFieldLabelBadge function
Last updated: 2026-03-04T23:21:38.398Z
Location
Metrics
LOC: 35
Complexity: 1
Params: 3
Signature
createFieldLabelBadge(
target: HTMLElement,
label: string,
): : HTMLElement
Source Code
function createFieldLabelBadge(
target: HTMLElement,
label: string,
): HTMLElement {
const rect = target.getBoundingClientRect();
const badge = document.createElement("div");
badge.textContent = label;
const top = rect.top - 20;
const left = rect.left;
badge.style.cssText = `
position: fixed;
top: ${Math.max(2, top)}px;
left: ${left}px;
background: rgba(79, 70, 229, 0.9);
color: #fff;
font-size: 10px;
font-family: system-ui, -apple-system, sans-serif;
font-weight: 600;
padding: 1px 6px;
border-radius: 3px;
z-index: 2147483645;
pointer-events: none;
white-space: nowrap;
max-width: 180px;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.5;
box-shadow: 0 1px 4px rgba(0,0,0,0.25);
letter-spacing: 0.2px;
`;
document.body.appendChild(badge);
return badge;
}
No outgoing dependencies.
Impact (Incoming)
| Source | Type |
|---|---|
| highlightField | calls |