A portable electronic device comprising: a display; and a keyboard provided adjacent the display, the keyboard comprising: a plurality of keycaps moveable relative to a base of the keyboard; a plurality of first magnets disposed on an underside of the keycaps, each first magnet of the plurality of first magnets being associated with a respective one of the keycaps and moveable therewith relative to the base of the keyboard; electromagnets (308, 510) disposed between the base of the keyboard and the first magnets, each electromagnet being associated with a respective one of the first magnets and a respective one of the keycaps; and a controller coupled to the electromagnets and configured to control each electromagnet to maintain a polarity of a magnetic field of the electromagnet so as to repel the first magnet, and, in response to detecting a touch with an external applied force on a keycap that meets a threshold value, reverse the polarity of the magnetic field of the associated electromagnet such that the first magnet is attracted to the electromagnet as long as the touch is detected, wherein in response to the reversing of the polarity of the magnetic field of the electromagnet and the attraction of the first magnet to the electromagnet, the respective keycap moves from a first position, toward the base of the keyboard, to a second position; wherein the keyboard comprises capacitive touch sensors disposed on a flexible display of the keyboard, wherein the flexible display is disposed on an underside of the plurality of keycaps, between the plurality of keycaps and base of the keyboard, and wherein the capacitive touch sensors are configured to detect a touch on a respective one of the keycaps and to identify a location of the external applied force; wherein the value of the external applied force is based on signals received at the controller from one of the electromagnets; and wherein at least a portion of each of the keycaps of the keyboard are transparent such that information displayed on the flexible display is visible through the keycaps. a display; and a keyboard provided adjacent the display, the keyboard comprising: a plurality of keycaps moveable relative to a base of the keyboard; a plurality of first magnets disposed on an underside of the keycaps, each first magnet of the plurality of first magnets being associated with a respective one of the keycaps and moveable therewith relative to the base of the keyboard; electromagnets (308, 510) disposed between the base of the keyboard and the first magnets, each electromagnet being associated with a respective one of the first magnets and a respective one of the keycaps; and a controller coupled to the electromagnets and configured to control each electromagnet to maintain a polarity of a magnetic field of the electromagnet so as to repel the first magnet, and, in response to detecting a touch with an external applied force on a keycap that meets a threshold value, reverse the polarity of the magnetic field of the associated electromagnet such that the first magnet is attracted to the electromagnet as long as the touch is detected, wherein a plurality of keycaps moveable relative to a base of the keyboard; a plurality of first magnets disposed on an underside of the keycaps, each first magnet of the plurality of first magnets being associated with a respective one of the keycaps and moveable therewith relative to the base of the keyboard; electromagnets (308, 510) disposed between the base of the keyboard and the first magnets, each electromagnet being associated with a respective one of the first magnets and a respective one of the keycaps; and a controller coupled to the electromagnets and configured to control each electromagnet to maintain a polarity of a magnetic field of the electromagnet so as to repel the first magnet, and, in response to detecting a touch with an external applied force on a keycap that meets a threshold value, reverse the polarity of the magnetic field of the associated electromagnet such that the first magnet is attracted to the electromagnet as long as the touch is detected, wherein in response to the reversing of the polarity of the magnetic field of the electromagnet and the attraction of the first magnet to the electromagnet, the respective keycap moves from a first position, toward the base of the keyboard, to a second position; wherein the keyboard comprises capacitive touch sensors disposed on a flexible display of the keyboard, wherein the flexible display is disposed on an underside of the plurality of keycaps, between the plurality of keycaps and base of the keyboard, and wherein the capacitive touch sensors are configured to detect a touch on a respective one of the keycaps and to identify a location of the external applied force; wherein the value of the external applied force is based on signals received at the controller from one of the electromagnets; and wherein at least a portion of each of the keycaps of the keyboard are transparent such that information displayed on the flexible display is visible through the keycaps.