APL Styled Properties
Styled properties are component properties that you can set in a style. This means that you can set a value for the property in a style defined in the styles
section of your document, and then assign the style name to the style
property of a component in your document.
Styled properties
Property | Type | Description | Applies to components |
---|---|---|---|
|
Array of actions |
Programmatic equivalents for complex touch interactions | |
|
Alignment |
Alignment of the image within the containing box. |
|
|
One of: |
Alignment for children in the cross-axis. | |
|
Color or gradient to use as a background. | ||
|
Background color. | ||
|
Absolute Dimension |
Radius of the bottom-left corner. Overrides | |
|
Absolute Dimension |
Radius of the bottom-right corner. Overrides | |
|
Color of the border. | ||
|
Absolute Dimension |
Corner radius for rounded-rectangle variant. | |
|
Non-negative Absolute Dimension |
Width of the border stroke around the text box. | |
|
Absolute Dimension |
Radius of the top-left corner. Overrides | |
|
Absolute Dimension |
Radius of the top-right corner. Overrides | |
|
Number |
Width of the border. | |
|
The color of the text. | ||
|
One of: |
Direction in which to display the child components. | |
|
String ( |
Determines whether the component displays on the screen. | |
|
String |
Font family (such as "Amazon Ember Display"). | |
|
Absolute Dimension |
The size of the text. | |
|
|
The font style to display. | |
|
|
The font weight to display. | |
|
Positive Dimension |
The requested height of the component. | |
|
The highlight color to show behind selected text. | ||
|
String |
Hint text to display when no text has been entered. Not shown when the | |
|
The color of the hint text. | ||
|
normal, italic |
The style of the hint font | |
|
normal, bold, 100, 200, 300, 400, 500, 600, 700, 800, 900 |
The weight of the hint font | |
|
One of: |
How to distribute free space when there is room on the main axis. Defaults to | |
|
KeyboardType |
The type of keyboard to display when the user selects the component. | |
|
Absolute Dimension |
Additional space to add between letters. | |
|
Number (percentage) |
Line-height multiplier. | |
|
Positive Dimension |
The maximum allowed height of this component. | |
|
Positive Dimension |
The maximum allowed width of this component. | |
|
Non-negative integer |
The maximum number of characters the user can enter in the edit box. | |
|
Integer |
The maximum number of lines of text to display. When the text can't fit within the provided number of lines, the component truncates the content with an ellipsis. | |
|
Non-negative Dimension |
The minimum allowed height of this component. | |
|
Non-negative Dimension |
The minimum allowed width of this component. | |
|
Number |
Opacity of this component and children. | |
|
If set, a theme-appropriate scrim is overlaid on the image. This ensures text placed on the image is legible. | ||
|
A colored gradient that overlays the image. | ||
|
Array of non-negative Absolute Dimension |
Space to add on the sides of the component | |
|
Non-negative Absolute Dimension |
Space to add to the bottom of this component. | |
|
Non-negative Absolute Dimension |
Space to add to the left of this component. | |
|
Non-negative Absolute Dimension |
Space to add to the right of this component. | |
|
Non-negative Absolute Dimension |
Space to add to the top of this component. | |
|
String |
Role or purpose of the component | |
|
Scale |
Method used to resize the image or vector graphic to fit in the bounding box. |
|
|
Boolean |
Hide characters as they are typed if true. | |
|
Boolean |
When true, select the text when the | |
|
Shadow color | ||
|
Horizontal offset of the shadow | ||
|
Non-negative Absolute Dimension |
Shadow blur radius | |
|
Vertical offset of the shadow | ||
|
Positive integer |
Specifies approximately the number of characters to display. | |
|
One of: |
The alignment that the child components snap to when scrolling stops. |
|
|
SubmitKeyType |
The type of the return key. The specified key sends an | |
|
|
Alignment of text within a paragraph. | |
|
|
Vertical alignment of text. | |
|
String |
Restrict the characters that can be entered | |
|
Positive Dimension |
The requested width of this component. | |
|
One of: |
Determines how to wrap child components to multiple lines. |
Example of setting styled properties
The following example shows a style called captionText
that sets five properties:
color
textAlign
textAlignVertical
fontStyle
fontSize
{
"styles": {
"captionText": {
"values": [
{
"textAlign": "center",
"textAlignVertical": "center",
"color": "red",
"fontStyle": "italic",
"fontSize": "@fontSizeMedium"
}
]
}
}
}
To use the style, assign its name captionText
to the style
property of the component. The following example sets the five properties defined in captionText
for the Text
component. This code creates a red, italic text block with the text centered both horizontally and vertically.
{
"type": "Text",
"paddingLeft": "@spacingSmall",
"paddingRight": "@spacingSmall",
"text": "Image: ${imageCaption}",
"style": "captionText"
}
Related topics
Last updated: Nov 28, 2023