How to get list of all knockout components from the pages in Magento?

You can get a list of all the used knockout components on the current page using uiRegistry.

Knockout Components will be defined using the custom module and Magento native code contains a lot of predefined knockout components like minicart, authentication, customer, etc…

You can also fetch a custom component by its name in the get() method of the uiRegistry object.

require('uiRegistry').get('COMPONENT_NAME')

Where COMPONENT_NAME refers your custom or magento component name.

If you want to get all the components used in the current page, you can get it using the syntax in the Console tab of Inspect Element from browser,

require('uiRegistry').get(function(arg) { console.log(arg.name)})

The output of the above syntax is

knockout components
magento knockout component-list for the homepage

You can see lot of component will be displayed in the console tab.

Most common components are the customer, minicart, messages that will be used in all the pages in frontend.