File tree Expand file tree Collapse file tree 4 files changed +34
-0
lines changed
designer-extension-typings Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,7 @@ export const permissionsMap: PermissionsMap = {
5353 getAllComponents : { permissions : [ 'canAccessCanvas' ] } ,
5454 getComponentByName : { permissions : [ 'canAccessCanvas' ] } ,
5555 getComponentByNameAndGroup : { permissions : [ 'canAccessCanvas' ] } ,
56+ searchComponents : { permissions : [ 'canAccessCanvas' ] } ,
5657 getInstanceCount : { permissions : [ 'canAccessCanvas' ] } ,
5758 getVariants : { permissions : [ 'canAccessCanvas' ] } ,
5859 getSelectedVariant : { permissions : [ 'canAccessCanvas' ] } ,
Original file line number Diff line number Diff line change @@ -185,6 +185,16 @@ interface WebflowApi {
185185 * ```
186186 */
187187 getComponentByName ( a : string , b ?: string ) : Promise < Component > ;
188+ /**
189+ * Searches for Components by name
190+ * @returns A Promise that resolves to an array or objects with information about matching Components, not the `Component` objects themselves.
191+ * @example
192+ * ```ts
193+ * const heroes = await webflow.searchComponents({ q: 'Hero' });
194+ * console.log(heroes);
195+ * ```
196+ */
197+ searchComponents ( options : SearchComponentsOptions ?) : Promise < Array < ComponentSearchResult > >
188198 /**
189199 * Gets the number of instances of a component.
190200 * @returns A Promise that resolves to the number of instances of the component across the entire site.
Original file line number Diff line number Diff line change @@ -80,3 +80,21 @@ interface Variant {
8080 name : string ;
8181 isSelected : boolean ;
8282}
83+
84+ interface SearchComponentsOptions {
85+ /** Fuzzy search query matching Component panel search behavior */
86+ q ?: string ;
87+ }
88+ interface ComponentLibrary {
89+ name : string ;
90+ id : string ;
91+ }
92+ interface ComponentSearchResult {
93+ id : string ;
94+ name : string ;
95+ group : string ;
96+ description : string ;
97+ instances : number ;
98+ canEdit : boolean ;
99+ library : ComponentLibrary | null ;
100+ }
Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ export const Components = {
6464 console . log ( marketingHero . id ) ;
6565 } ,
6666
67+ searchComponents : async ( ) => {
68+ const heroes = await webflow . searchComponents ( { q : 'Hero' } ) ;
69+ console . log ( heroes ) ;
70+ } ,
71+
6772 getInstanceCount : async ( ) => {
6873 // Audit component usage across the site
6974 const components = await webflow . getAllComponents ( ) ;
You can’t perform that action at this time.
0 commit comments