With Universal Control, you can use a single keyboard and mouse, or trackpad to control multiple devices. When you move the pointer to the edge of your iMac screen, the pointer moves to your iPad or another Mac, so you can work across up to three devices.
Note: To use Universal Control, you must have macOS version 12.3 or later on your Mac and iPadOS 15.4 or later on your iPad.