Search for Components (Beta)

webflow.searchComponents(options)

Searches for Components in a way similar to the search box in the Components panel in the Webflow Designer.

This command returns Components in the same order as a search in the Components panel and uses the same search logic. It searches fields including the name and description.

Beta

This feature is released as part of a Beta program and may change in future releases.

Syntax

1interface SearchComponentsOptions {
2 /** Fuzzy search query matching Component panel search behavior */
3 q?: string;
4}
5interface ComponentLibrary {
6 name: string;
7 id: string;
8}
9interface ComponentSearchResult {
10 id: string;
11 name: string;
12 group: string;
13 description: string;
14 instances: number;
15 canEdit: boolean;
16 library: ComponentLibrary | null;
17}
18
19webflow.searchComponents(options: SearchComponentsOptions?): Promise<Array<ComponentSearchResult>>

Returns

Promise<Array<ComponentSearchResult>>

A Promise that resolves to an array or objects with information about matching Components, not the Component objects themselves.

Example

1// Get all Components
2const allComponents = await webflow.searchComponents();
3/*
4[
5 {
6 id: 'xxxx',
7 name: 'Hero section',
8 group: 'Sections',
9 description: 'Lorem ipsum',
10 instances: 3,
11 canEdit: true,
12 library: null,
13 },
14 {
15 id: 'yyyy',
16 name: 'Nav Bar',
17 group: 'Navigation',
18 description: '',
19 instances: 5,
20 canEdit: false,
21 library: { name: 'Core Library', id: 'lib_123' },
22 },
23]
24*/
25
26// Search for Components by query
27const heroes = await webflow.searchComponents({ q: 'Hero' });
28/*
29[
30 {
31 id: 'xxxx',
32 name: 'Hero section',
33 group: 'Sections',
34 description: 'Lorem ipsum',
35 instances: 3,
36 canEdit: true,
37 library: null,
38 },
39]
40*/

Designer Ability

Checks for authorization only

Designer AbilityPermissionLocaleBranchWorkflowSitemode
canAccessCanvasanyanyanyanyany