Snap to Place
Powered By GitBook
Button
When you tap on the play icon to hear your favourite music, you are using a button.

Video Tutorial

โ€‹
A button is just something you can click on to perform an action. This action can be anything from navigating to a different screen, saving information to a database, or playing a sound.
Changing the text on the button
Navigate to a different screen

Style the Button

You have many options for styling your button, such as changing the background color or text color. Here are the different options for customization:
    Text: Text that appears on the button
    Text Color: Color of the text that appears on the button
    Background Color: Sets the background color of the button
    Font Size: Size of the text that appears on the button
    Background Picture: Upload a picture that appears on the button.
    Background Picture Resize Mode
      Cover: Fills the entire button without changing the height and width ratio of the image
      Contain: The entire image will be scaled down to fit inside the button, without changing the height and width ratio of the image
      Stretch: The image's height will change to fill the button length-wise
      Repeat: Repeat the image to cover the button. The image's height and width ratio will not change
      Center: Positions the image in the middle of the button
    Visible: To see the button in your app, set the switch to true
    Border
      Width: Enter how wide you want the border outline of the button to be
      Color: Pick a color for the border of the button
      Style: Select if you want the border to be a dotted, dashed or solid line
      Radius: Enter how round you want the edges of the border for the button to be
    Font Bold: To make the text on the button bold, set the switch to true
    Font Italic: To make the text on the button italic, set the switch to true
    Raised: To cast a shadow around the button, set the switch to true
    Disabled: To prevent the button from performing an option when it is clicked, set the switch to true

Edit the Button size

You can set how tall the button is using the height property and set how wide the button is using the width property.
Height
    Fill container - The button fills the entire screen vertically
    Fit contents - The buttonโ€™s height changes to be the size of the contents it contains
    Relative size - The button fills the specified percentage of the screen
    Absolute size - Sizes the button to a specified number of pixels
Width
    Fill container - The button fills the entire screen horizontally
    Fit contents - The buttonโ€™s width changes to be the size of the contents it contains
    Relative size - The button fills the specified percentage of the screen
    Absolute - Sizes the button to a specified number of pixels

Add Spacing

You change the spacing and positioning of the button with the Margin and Padding properties. Margin
    You can specify how much space you want between the edges of the button and the screen using either pixel or percent values.
Padding
    You can specify how much space you want between the border and contents of the button using either pixel or percent values.

Events

You can use the following blocks to listen for when a specific event occurs

Click

Performs an action when the user taps the button.

Long Click

Performs an action when the user holds down the button.

Touch Down

Performs an action when a user pressed down on the button

Touch Up

Performs an action after the user releases the button

Properties

Background Color

The get and set background color properties work with the color of the button itself i.e. the region behind the button text. Best practice is to use one of the built color blocks to set this value, but you can use HEX and RGB values too.

Background Picture

โ€‹

Background Picture Resize Mode

The set and get resize mode blocks work with how the background picture is scaled within the button component. Acceptable values are:
    Cover
    Contain
    Stretch
    Repeat
    Center

Disabled

The disabled property is used to set whether or not the button is "clickable". Expected values for this property are:
    True
    False
โ€‹

Font

The font style properties of the button text can be "Bold", "Italic", or Raised. Expected values for each property are:
    True
    False

Font Size

The get and set font size blocks are used to work with the size of the text that is displayed in the button. This value must be a number.

Height

โ€‹
The set and get height blocks work with the Height property of the button component. Acceptable input values are.
    Number of Pixels
    Percentage Height
    "Fit Contents"
    "Fill Container"
The Computed Heightblock returns the on-screen dimensions of the button, after it has been rendered on-screen. The value returned is an integer, representing the size of the button in pixels.

Text

This property corresponds to the text that is displayed in the button component.

Text Color

The get and set text color properties can be used to work with the color of the text displayed on the button. Best practice is to use one of the color blocks to set this value but you can use HEX and RGB values too.

Visible

โ€‹
The set and get visible blocks are used to show or hide the entire button component. Acceptable values are:
    True
    False

Width

The set and get width blocks work with the Width property of the button component. Acceptable input values are.
    Number of Pixels
    Percentage Width
    "Fit Contents"
    "Fill Container"
The Computed Widthblock returns the on-screen dimensions of the button, after it has been rendered on-screen. The value returned is an integer, representing the size of the button in pixels.
โ€‹
Last modified 3mo ago