UML component diagrams are concerned with the components of a system. Components are defined as independent, encapsulated units of the system. Each component provides an interface for other components to interact with it.

The Component Diagram are used to visualize how a system’s pieces interact and and what relationships they have among them. This is high-level diagram, and shouldn’t considered to have details.
Each component of the diagram has specific relationship to other components through the interface it provides.
Ball Connector: display a provided interface in component diagrams. The purpose of a provided interface is to show that a component offers an interface for others to interact with it. Provided interface means that client and consumer components have a way of communicating with that component.

Socket Connector: displays a required interface which is essential to the component diagram, to show that a component expects a certain interface provided by some other component to be able to achieve its responsibilities.

In a component diagram, an assembly relationship is where one component’s provided interface matches another component’s required interface. The provided interface is depicted by a ball, and the required interface is depicted by a socket.
.png?raw=true)
When you are building a component diagram, the first step is to identify the main objects used in the system. Then, identify all of relevant libraries you’d need for your system. Finally, you would come up with relationships found between these components.
If you use 3rd party library, it must be denoted in the Component diagram.

The component diagram useful not only for the entire system, but for a particular subsystems as well.