It looks like the Teensy designer uses the standard Arduino mouse and keyboard library:
https://www.pjrc.com/teensy/td_keyboard.html
On another note, I'm sure Teensy is a fine product, but I prefer other open hardware solutions like Pro Micro which can be had on AliExpress.com for under $4 ea.