> This page is for Designer API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.webflow.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.webflow.com/_mcp/server.

# Get a style's selector

> Get the CSS selector a style renders as in the Designer's Styles panel.

## `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`](/designer/reference/styles-overview#style-properties) (for example, `Button` or `Body`), the selector is lowercased and CSS-sanitized through the same pipeline the renderer uses.

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

#

### Syntax

```typescript
style.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](/designer/reference/style/get-type):

| Style type     | Example selector                    |
| :------------- | :---------------------------------- |
| Global class   | `.button`                           |
| Combo class    | `.button.is-primary`                |
| Descendant     | `.parent .child`                    |
| Tag            | `body`, `h1` (always lowercased)    |
| Shared library | `.acme--button` (userland-prefixed) |

#

### Example

```typescript
// Get a style and read the selector it renders as
const style = await webflow.getStyleByName("button");

if (style) {
  const selector = await style.getSelector();
  console.log("Selector:", selector); // ".button"
}
```

[Try this example](https://webflow.com/oauth/authorize?response_type=code\&client_id=19511de1ec410f9228d8dcbc9420e67916dea80d86d18f0c9a533eb475ea0f62)

### Designer ability

| Designer Ability    | Locale | Branch | Workflow | Sitemode |
| :------------------ | :----- | :----- | :------- | :------- |
| **canAccessCanvas** | Any    | Any    | Any      | Any      |