Layout Component

Overview

Thunkable’s layout component allows for more precise positioning of UI components on an app screen, by allowing you to position UI components dependent on other UI components on the screen. For example, in a typical sign-in screen, if a user inputs an incorrect email address or password, a screen built with a layout component allows you to shift the UI components on the screen to display the error messaging to the user.

Add a Layout to a Screen

To add a layout component to a screen:

  1. Drag and drop the layout UI component onto a screen. You’ll notice it is composed of two containers, one on top of the other.

  2. Click and drag the sizing handles in the corners to resize the layout UI component.

  3. Click and drag to reposition it.

Insert Additional Containers

By default, a newly added layout has two horizontal containers arranged vertically, one on top of the other. To insert additional containers to a layout:

  1. Click to select the layout UI component in the component tree or within the screen.

  2. At the top of the layout's properties panel, select whether you want to insert a horizontal or vertical Container. ∙ Horizontal Container - UI components within the container are aligned horizontally, side by side ∙ Vertical Container - UI components within the container are aligned vertically, on top of each other

  3. Identify into which layout or container you want to insert the new container.

  4. Click Add.

Add UI Components

To add UI components to a layout:

  1. Drag and drop UI components into a container on a screen.

  2. Once UI components are in a container, rearrange their order by dragging and dropping their component names in the component tree.

Layout Properties

The following properties are configured on the right in the layout's properties panel.

Alignment

PropertyValueDescription

Direction

vertical

The elements directly within the layout (could be a UI component or a container) are aligned vertically, on top of each other.

Direction

horizontal

The elements directly within the layout (could be a UI component or a container) are aligned horizontally, side by side.

Vertical / Horizontal Alignment

top

The elements directly within the layout (could be a UI component or a container) are positioned at the top of the layout.

Vertical / Horizontal Alignment

bottom

The elements directly within the layout (could be a UI component or a container) are positioned at the bottom of the layout.

Vertical / Horizontal Alignment

left

The elements directly within the layout (could be a UI component or a container) are positioned at the left of the layout.

Vertical / Horizontal Alignment

right

The elements directly within the layout (could be a UI component or a container) are positioned at the right of the layout.

Vertical / Horizontal Alignment

center

The elements directly within the layout (could be a UI component or a container) are positioned in the center of the layout (either top to bottom or left to right, depending on the selected direction).

Vertical / Horizontal Alignment

space-between

The elements directly within the layout (could be a UI component or a container) are positioned with an equal amount of space between them.

Vertical / Horizontal Alignment

space-around

The elements directly within the layout (could be a UI component or a container) are positioned with an equal amount of space between them, including at the top and bottom for a vertical direction layout or left and right for a horizontal direction layout.

Scrollable

true/on

The user can scroll within the layout.

Scrollable

false/off

The user cannot scroll within the layout.

Scroll Bar Visible

true/on

The scroll bar is visible to the user.

Scroll Bar Visible

false/off

The scroll bar is not visible to the user.

Horizontal Alignment Examples

Vertical Alignment Examples

Layout

PropertyValueDescription

X

coordinate value

Position of the upper left corner of the layout on the X-axis, where the left side of the screen is X=0.

Y

coordinate value

Position of the upper left corner of the layout on the Y-axis, where the top of the screen is Y=0.

Height

number in pixels

The layout’s height is defined by a custom number of pixels.

Width

number in pixels

The layout’s width is defined by a custom number of pixels.

Resize Mode

Stretch

Stretches the layout to fit the dimensions of the device's screen.

Resize Mode

Float in Place

Renders the layout in the same aspect ratio as the design, regardless of the device size.

Image

PropertyValueDescription

Background Picture

Upload files

Click to upload an image file.

Background Picture

Type in URL

Type in an image URL.

Background Picture Resize Mode

cover

Fills the entire layout without changing the height and width ratio of the image.

Background Picture Resize Mode

contain

The entire image is scaled down to fit inside the layout, without changing the height and width ratio of the image.

Background Picture Resize Mode

stretch

The image's height will change to fill the layout length-wise.

Background Picture Resize Mode

repeat

The image repeats to cover the layout. The image's height and width ratio do not change.

Background Picture Resize Mode

center

The image is positioned in the middle of the layout.

Style

PropertyValueDescription

Visible

visible

Users can see the layout.

Visible

invisible

Users cannot see the layout.

Background Color

color

The background color of the layout.

Border: Style

solid

The layout’s border is a solid line.

Border: Style

dotted

The layoutt’s border is a dotted line.

Border: Style

dashed

The layout’s border is a dashed line.

Border: Color

color

The layout’s border is the color selected.

Border: Width

number in pixels

The width of the layout’s border is defined by a custom number of pixels.

Border: Radius

number in pixels

The radius of the layout border’s corners is defined by a custom number of pixels.

Shadow: Color

color

The layout’s shadow is the color selected.

Shadow: Opacity

number between 0 and 100

The opacity of the layout’s shadow.

Shadow: Radius

number in pixels

The radius of the layout shadow’s corners is defined by a custom number of pixels.

Shadow: Offset

number in pixels

How far the layout’s shadow should be offset, in height and width, is defined by a custom number of pixels.

Spacing

PropertyValueDescription

Margin

top

The margin between the layout’s top border and the next UI component as defined by a custom number of pixels.

Margin

bottom

The margin between the layout’s bottom border and the next UI component as defined by a custom number of pixels.

Margin

left

The margin between the layout’s left border and the next UI component as defined by a custom number of pixels.

Margin

right

The margin between the layout’s right border and the next UI component as defined by a custom number of pixels.

Padding

top

The padding between the layout and its top border as defined by a custom number of pixels.

Padding

bottom

The padding between the layout and its bottom border as defined by a custom number of pixels.

Padding

left

The padding between the layout and its left border as defined by a custom number of pixels.

Padding

right

The padding between the layout and its right border as defined by a custom number of pixels.

Container Properties

The following properties are configured on the right in the container's properties panel.

Alignment

PropertyValueDescription

Direction

vertical

UI components within the container are aligned vertically, on top of each other.

Direction

horizontal

UI components within the containerntainer are aligned horizontally, side by side.

Vertical / Horizontal Alignment

top

UI components are positioned at the top of the container.

Vertical / Horizontal Alignment

bottom

UI components are positioned at the bottom of the container.

Vertical / Horizontal Alignment

left

UI components are positioned at the left of the container.

Vertical / Horizontal Alignment

right

UI components are positioned at the right of the container.

Vertical / Horizontal Alignment

center

UI components are positioned in the center of the container (either top to bottom or left to right depending on the selected direction).

Vertical / Horizontal Alignment

space-between

UI components are positioned with an equal amount of space between them

Vertical / Horizontal Alignment

space-around

UI components are positioned with an equal amount of space between them, including at the top and bottom for vertical direction containers or left and right for horizontal direction containers.

Scrollable

true/on

The user can scroll within the container.

Note: When setting a container as scrollable, we recommend the size of the UI components within it be set to an absolute pixel value or Fit Contents.

Scrollable

false/off

The user cannot scroll within the container.

Scroll Bar Visible

true/on

The scroll bar is visible to the user.

Scroll Bar Visible

false/off

The scroll bar is not visible to the user.

Layout

PropertyValueDescription

Height

Fit contents

The container’s height is the same as the tallest UI component or container within it (horizontal direction) or the stacked UI components or containers within it (vertical direction).

Height

Fill container

The elements directly within the container (could be a UI component or another container) fill the container vertically.

Height

Size (e.g. 50px or 50%)

The container’s height is defined by a custom number of pixels or percentage of the screen.

Width

Fit contents

The container’s width is the same as the widest UI component or container within it (vertical direction) or the side-by-side UI components or containers within it (horizontal direction).

Width

Fill container

The elements directly within the container (could be a UI component or another container) fill the container horizontally.

Width

Size (e.g. 50px or 50%)

The container’s width is defined by a custom number of pixels or percentage of the screen.

Image

PropertyValueDescription

Background Picture

Upload files

Click to upload an image file.

Background Picture

Type in URL

Type in an image URL.

Background Picture Resize Mode

cover

Fills the entire screen without changing the height and width ratio of the image.

Background Picture Resize Mode

contain

The entire image is scaled down to fit inside the screen, without changing the height and width ratio of the image.

Background Picture Resize Mode

stretch

The image's height will change to fill the screen length-wise.

Background Picture Resize Mode

repeat

The image repeats to cover the screen. The image's height and width ratio do not change.

Background Picture Resize Mode

center

The image is positioned in the middle of the frame.

Style

PropertyValueDescription

Visible

visible

Users can see the container.

Visible

invisible

Users cannot see the container.

Background Color

color

The background color of the container.

Visible

solid

The container’s border is a solid line.

Visible

dotted

The container’s border is a dotted line.

Visible

dashed

The container’s border is a dashed line.

Border: Color

color

The container’s border is the color selected.

Border: Width

number in pixels

The width of the container’s border is defined by a custom number of pixels.

Border: Radius

number in pixels

The radius of the container border’s corners is defined by a custom number of pixels.

Shadow: Color

color

The container’s shadow is the color selected.

Shadow: Opacity

number between 0 and 100

The opacity of the container’s shadow.

Shadow: Radius

number in pixels

The radius of the container shadow’s corners is defined by a custom number of pixels.

Shadow: Offset

number in pixels

How far the container’s shadow should be offset, in height and width, is defined by a custom number of pixels.

Spacing

PropertyValueDescription

Margin

top

The margin between the container’s top border and the next container as defined by a custom number of pixels.

Margin

bottom

The margin between the container’s bottom border and the next container as defined by a custom number of pixels.

Margin

left

The margin between the container’s left border and the next container as defined by a custom number of pixels.

Margin

right

The margin between the container’s right border and the next container as defined by a custom number of pixels.

Padding

top

The padding between the container and its top border as defined by a custom number of pixels.

Padding

bottom

The padding between the container and its bottom border as defined by a custom number of pixels.

Padding

left

The padding between the container and its left border as defined by a custom number of pixels.

Padding

right

The padding between the container and its right border as defined by a custom number of pixels.

Layout Blocks

To access the blocks specific to the layout component:

  1. Navigate to the Blocks tab.

  2. In the component tree on the left, click the Layout component.

  3. A drawer of layout-specific blocks opens.

Block ImageDescription

If the layout is scrollable, you can use this block to scroll the user to the end of the layout. For example, a user clicks a button in a chat app, and the layout scrolls to the end of the chat history to see the most recent messages.

If the layout is scrollable, you can use this block to scroll the user to the start of the layout.

Sets the layout’s height to a custom number of pixels.

Gets the layout’s height in pixels.

Gets the layout’s computed height, the on-screen dimensions of the layout, after it has been rendered on-screen. The value returned is an integer, representing the layout's height in pixels.

Sets the layout’s width to a custom number of pixels.

Gets the layout’s width in pixels.

Gets the layout’s computed width, the on-screen dimensions of the layout, after it has been rendered on-screen. The value returned is an integer, representing the layout's width in pixels.

When set to true, it sets the layout to visible, meaning the layout is visible to users.

When set to false, it sets the layout to invisible, meaning the layout is not visible to users.

Gets the layout’s visibility status. Returns true (visible) or false (invisible).

Set the position of the upper left corner of the layout on the X-axis, where the left side of the screen is X=0.

Get the position of the upper left corner of the layout on the X-axis, where the left side of the screen is X=0.

Set the position of the upper left corner of the layout on the Y-axis, where the top of the screen is Y=0.

Get the position of the upper left corner of the layout on the Y-axis, where the top of the screen is Y=0.

Set the layout’s background color.

Get the layout’s background color.

Set the layout's background picture. Click the dropdown menu to select an image from your computer.

Get the layout's background picture.

Set the layout’s background picture resize mode. See the layout Properties section for definitions of the acceptable values.

Get the layout’s background picture resize mode.

When set to true, it sets the layout to scrollable for users.

When set to false, it sets the layout to scrollable for users.

Gets the Layout’s scrollable status. Returns true (scrollable) or false (not scrollable).

When set to true, it sets the layout’s scroll bar to be visible to users.

When set to false, it sets the layout’s scroll bar to invisible for users.

Gets the layout’s scroll bar visibility status. Returns true (visible) or false (invisible).

Container Blocks

To access the blocks specific to the container component:

  1. Navigate to the Blocks tab.

  2. In the component tree on the left, click the Container component that is nested under the layout component.

  3. A drawer of container-specific blocks opens.

  4. The blocks are the same as the ones above in the Layout Blocks section, but specific to the container instead of the layout.

Custom Data Viewer

The layout component is the foundation of custom data viewers, which allows for more precise positioning of UI components on an app screen.

Custom Data Viewer

Have feedback on this doc? Please take a moment to share your feedback here: Thunkable Docs Feedback. Your valuable insights will help us improve and better serve you in the future.

Last updated