Designer API
Control the Webflow Designer
element.getTag()
Retrieve the HTML tag of an element.
1element.getTag(): Promise<null | BlockElementTag | HeadingTag | ListTag>
This method also returns the binding metadata for Heading elements:
1// Heading elements only — returns binding metadata when tag is bound to a CMS field2element.getTag(options: { bindings: true }): Promise<HeadingTag | BindingValue | null>
The return type depends on the element type:
Block
Section
VFlex
HFlex
Container
Row
Column
BlockContainer
RichText
Slot
NavbarContainer
TabsContent
BlockElementTag | null
div
header
footer
nav
main
section
article
aside
address
figure
Heading
HeadingTag | null
h1
h2
h3
h4
h5
h6
List
ListTag | null
ul
ol
Returns null if the element is not found or the tag is not set.
null
1const el = await webflow.getSelectedElement();23if (el?.type === 'Block') {4 const tag = await el.getTag(); // BlockElementTag | null5 console.log(tag); // e.g. 'section'6}78if (el?.type === 'Heading') {9 const tag = await el.getTag(); // HeadingTag | null10 console.log(tag); // e.g. 'h2'11}1213if (el?.type === 'List') {14 const tag = await el.getTag(); // ListTag | null15 console.log(tag); // 'ul' or 'ol'16}