A foldable device , comprising: a first body supporting a first display region ; a second body supporting a second display region ; a sensor configured to sense a folding angle between the first body and the second body ; an actuator unit configured to change the folding angle, wherein the actuator unit comprises magnetic elements provided to the first body and to the second body ; and a controller configured to: control the actuator unit to increase the folding angle between the first body and the second body until the foldable device is in an opened state in which the folding angle between the first body and the second body exceeds a first angle, without user physical pressure in response to a first predetermined input, and control the actuator unit to decrease the folding angle between the first body and the second body until the foldable device is in a closed state in which the folding angle between the first body and the second body is equal to or smaller than the first angle, without user physical pressure in response to a second predetermined input, wherein when the foldable device is switched to the closed state, and if a stylus pen is located within the foldable device , the controller is further configured to control the actuator unit to generate magnetism of the same polarity of the magnetism of the stylus pen to generate a repulsive force between the stylus pen and the foldable device . a first body supporting a first display region ; a second body supporting a second display region ; a sensor configured to sense a folding angle between the first body and the second body ; an actuator unit configured to change the folding angle, wherein the actuator unit comprises magnetic elements provided to the first body and to the second body ; and a controller configured to: control the actuator unit to increase the folding angle between the first body and the second body until the foldable device is in an opened state in which the folding angle between the first body and the second body exceeds a first angle, without user physical pressure in response to a first predetermined input, and control the actuator unit to decrease the folding angle between the first body and the second body until the foldable device is in a closed state in which the folding angle between the first body and the second body is equal to or smaller than the first angle, without user physical pressure in response to a second predetermined input, wherein when the foldable device is switched to the closed state, and if a stylus pen is located within the foldable device , the controller is further configured to control the actuator unit to generate magnetism of the same polarity of the magnetism of the stylus pen to generate a repulsive force between the stylus pen and the foldable device . control the actuator unit to increase the folding angle between the first body and the second body until the foldable device is in an opened state in which the folding angle between the first body and the second body exceeds a first angle, without user physical pressure in response to a first predetermined input, and control the actuator unit to decrease the folding angle between the first body and the second body until the foldable device is in a closed state in which the folding angle between the first body and the second body is equal to or smaller than the first angle, without user physical pressure in response to a second predetermined input, wherein when the foldable device is switched to the closed state, and if a stylus pen is located within the foldable device , the controller is further configured to control the actuator unit to generate magnetism of the same polarity of the magnetism of the stylus pen to generate a repulsive force between the stylus pen and the foldable device . <EOS>