Hi Cris2574,
Thank you for reaching Microsoft Community.
Regarding your question, the Microsoft Surface Slim Pen 2 is designed to work with Surface devices that support pen input. However, it may also work with other devices that support Microsoft Pen Protocol (MPP).
To determine if the HP Spectre x360 14-ef0026nn Laptop 2-in-1 is compatible with the Microsoft Surface Slim Pen 2, go to the website of your device manufacturer to see if it supports MPP. Please note that the Surface Slim Pen 2 has MPP version 2.6. Please see this page for more details: Use a Surface Pen with another Windows PC - Microsoft Support
If your device supports MPP, then the Microsoft Surface Slim Pen 2 should work with your HP Spectre x360 14-ef0026nn Laptop 2-in-1. However, please note that some features of the pen may not be available on non-Surface devices.
Kind regards,
Marrion