Get a style's selector

style.getSelector()

Retrieve the CSS selector this style produces, as shown in the Designer’s Styles panel. The returned string is the canonical query selector for the style in the rendered stylesheet.

Unlike the style’s name (for example, Button or Body), the selector is lowercased and CSS-sanitized through the same pipeline the renderer uses.

Pseudo-state and component-variant selectors aren’t included. Those live on a style’s variants, not as separate Style objects.

Syntax

1style.getSelector(): Promise<string>

Returns

Promise<string>

A Promise that resolves to the style’s canonical CSS selector. The exact shape depends on the style’s type:

Style typeExample selector
Global class.button
Combo class.button.is-primary
Descendant.parent .child
Tagbody, h1 (always lowercased)
Shared library.acme--button (userland-prefixed)

Example

1// Get a style and read the selector it renders as
2const style = await webflow.getStyleByName("button");
3
4if (style) {
5 const selector = await style.getSelector();
6 console.log("Selector:", selector); // ".button"
7}

Designer ability

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny