LinkButton
The component for opening a link in a button.
Declaration
object LinkButtonProperties
| Name | Type | Description |
|---|---|---|
role Required | string | Always |
URL Required | SupportedURLs | The URL to open when a person interacts with the range of text specified in the addition. |
accessibilityLabel | string | A string that’s read to the user when you enable certain accessibility functionalities. |
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. To remove a previously set condition, use |
conditional | (ConditionalButton | [ConditionalButton]) | An instance or array of button properties that you can apply 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 | A unique identifier for this component. If you use an identifier, it must be unique across the entire document. An identifier is required if you want to anchor other components to this component. |
layout | (ComponentLayout | string) | An inline If you don’t define layout, Apple News bases the size and position on various factors, such as the device type, the length of the content, and the |
style | (ComponentStyle | string | string("none")) | An inline Use the |
text | string | The text, styled according to the |
textStyle | (ComponentTextStyle | string) | An inline |
Discussion
Use the LinkButton component to display a button with a link. The link opens when someone interacts with the button. You can place the LinkButton anywhere in the document and style it using ComponentStyle and ComponentTextStyle properties.
Example
{
"components": [
{
"role": "link_button",
"URL": "http://apple.com",
"text": "Read More",
"style": {
"backgroundColor": "#DDD",
"mask": {
"type": "corners",
"radius": 25
}
},
"layout": {
"padding": 10
}
}
]
}