FlexibleSpacer
The component for redistributing empty space inside a horizontal stack collection.
Declaration
object FlexibleSpacerProperties
| Name | Type | Description |
|---|---|---|
role Required | string | Always |
anchor | Anchor | An object that defines vertical alignment with another component. |
animation | (ComponentAnimation | string("none")) | An object that defines an animation you apply to the component. Use the |
behavior | (Behavior | string("none")) | An object that defines behavior for a component, like Parallax or Springy. The |
conditional | (ConditionalComponent | [ConditionalComponent]) | An instance or array of component properties that can be applied conditionally, and the conditions that cause Apple News Format to apply them. |
hidden | boolean | A Boolean value that determines whether the component is hidden. |
identifier | string | An optional unique identifier for this component. If used, this identifier must be unique across the entire document. You will need an identifier for your component if you want to anchor other components to it. |
layout | (ComponentLayout | string) | An inline The width of the spacer is determined automatically based on any remaining horizontal space, and the height is that of the parent container. Any top or bottom margins specified on a spacer component’s layout decreases the height of the layout within the parent container. All properties of |
style | (ComponentStyle | string | string("none")) | An inline The |
Mentioned in
Discussion
Use the FlexibleSpacer object to redistribute the extra space between child components in a HorizontalStackDisplay. Otherwise, if you have two child components in a horizontal stack that don’t use up all of the space, the extra space is always on the right side. The FlexibleSpacer object does not have an intrinsic size, but is sized to fit any remaining width, and to fit the height of the parent container. The object is ignored when used outside of the HorizontalStackDisplay context.
Example
{
"components": [
{
"role": "container",
"components": [
{
"role": "image",
"URL": "bundle://summer.jpg",
"layout": {
"minimumWidth": "60cw",
"maximumWidth": "60cw"
}
},
{
"role": "spacer"
},
{
"role": "image",
"URL": "bundle://winter.jpg",
"layout": {
"minimumWidth": "35cw",
"maximumWidth": "35cw"
}
}
],
"contentDisplay": {
"type": "horizontal_stack"
}
}
]
}