diff --git a/docs/api/component.md b/docs/api/component.md index 7cab4de84..9b6e4086c 100644 --- a/docs/api/component.md +++ b/docs/api/component.md @@ -177,16 +177,16 @@ also before rendering the component ### Parameters -* `query` **([String][1] | [Function][4])** Component type or matcher function -* `opts` **[Object][2]** Search options (optional, default `{}`) - - * `opts.max` **[Number][9]?** Maximum number of matches before exiting +* `query` **([String][1] | Function)** Component type or matcher function +* `opts` **[Object][2]?** Search options +* `opts.max` **[Number][12]?** Maximum number of matches before exiting ### Examples ```javascript const allImages = component.findType('image'); console.log(allImages[0]) // prints the first found component + const someComponents = component.findType((cmp) => cmp.getType() === 'something', { max: 2 }); ``` @@ -199,7 +199,7 @@ If no component is found, it returns `undefined`. ### Parameters -* `query` **([String][1] | [Function][4])** Component type or matcher function +* `query` **([String][1] | Function)** Component type or matcher function ### Examples @@ -208,6 +208,7 @@ const image = component.findFirstType('image'); if (image) { console.log(image); } + const firstImage = component.findFirstType((cmp) => cmp.is('image')); ``` @@ -239,13 +240,14 @@ also before rendering the component ### Parameters -* `query` **([String][1] | [Function][4])** Component type or matcher function +* `query` **([String][1] | Function)** Component type or matcher function ### Examples ```javascript const Section = component.closestType('section'); console.log(Section); + const namedSection = component.closestType((cmp) => cmp.getName() === 'Section'); ```