Type Function Library display.* Return value Numbers Revision Release 2026.3728 Keywords safe area, insets See also display.safeScreenOriginX display.safeScreenOriginY display.safeActualContentWidth display.safeActualContentHeight
Returns four numbers corresponding to the top, left, bottom, and right “safe area” insets. The “safe area” is the rectangular region where it’s safe to place important UI elements, ensuring that they are not obscured by status bars, device aspects like a sensor bar or rounded corners, software buttons, TV overscan areas, etc.
Essentially, these inset values represent the distance, in content units, between the corresponding screen edge and the imaginary boundary line where such elements will not interfere with or obscure screen content.
display.getSafeAreaInsets() display.getSafeAreaInsets( options )
Table. A table that accepts the following key:
cornerAdaptation — String, either "vertical" or "horizontal". Returns a safe area for content placed in a corner of the screen. One axis grows just enough to clear a rounded display corner or the iPad window controls: "vertical" brings the top and bottom insets in, and "horizontal" brings the left and right insets in. Use this for a small corner element, such as a pause button. Leave it out for the main layout, so you don’t lose a strip along every edge.cornerAdaptation requires iOS 26, iPadOS 26, or tvOS 26 or later. On other platforms and older versions, it returns the same values as calling the function without options.
For the exact position of a camera cutout or a fold, see display.getReservedRegions().
-- Gather insets (function returns these in the order of top, left, bottom, right)
local topInset, leftInset, bottomInset, rightInset = display.getSafeAreaInsets()
-- Create a vector rectangle sized exactly to the "safe area"
local safeArea = display.newRect(
display.screenOriginX + leftInset,
display.screenOriginY + topInset,
display.actualContentWidth - ( leftInset + rightInset ),
display.actualContentHeight - ( topInset + bottomInset )
)
safeArea:translate( safeArea.width*0.5, safeArea.height*0.5 )
-- Place a pause button in the top-left corner, clear of a rounded display corner
local cTop, cLeft = display.getSafeAreaInsets( { cornerAdaptation = "vertical" } )
local pauseButton = display.newRect( display.screenOriginX + cLeft + 20, display.screenOriginY + cTop + 20, 40, 40 )