MCPcopy Index your code
hub / github.com/Waishnav/devspace / element

Function element

src/ui/workspace-app.tsx:564–587  ·  view source on GitHub ↗
(
  tag: K,
  options: {
    className?: string;
    text?: string;
    type?: string;
    title?: string;
    ariaHidden?: string;
    ariaExpanded?: string;
    disabled?: boolean;
  } = {},
)

Source from the content-addressed store, hash-verified

562}
563
564function element<K extends keyof HTMLElementTagNameMap>(
565 tag: K,
566 options: {
567 className?: string;
568 text?: string;
569 type?: string;
570 title?: string;
571 ariaHidden?: string;
572 ariaExpanded?: string;
573 disabled?: boolean;
574 } = {},
575): HTMLElementTagNameMap[K] {
576 const node = document.createElement(tag);
577 if (options.className) node.className = options.className;
578 if (options.text !== undefined) node.textContent = options.text;
579 if (options.type !== undefined && "type" in node) node.setAttribute("type", options.type);
580 if (options.title !== undefined) node.title = options.title;
581 if (options.ariaHidden !== undefined) node.setAttribute("aria-hidden", options.ariaHidden);
582 if (options.ariaExpanded !== undefined) node.setAttribute("aria-expanded", options.ariaExpanded);
583 if (options.disabled !== undefined && "disabled" in node) {
584 (node as HTMLButtonElement).disabled = options.disabled;
585 }
586 return node;
587}
588
589function iconSvg(children: string): string {
590 return `<svg aria-hidden="true" class="icon-svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.8">${children}</svg>`;

Callers 7

renderFunction · 0.85
renderEmptyFunction · 0.85
renderStatusFunction · 0.85
renderPrePayloadFunction · 0.85
renderSummaryBadgeFunction · 0.85
renderReviewCardFunction · 0.85
renderChevronFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected