Contents

LinkButton

The component for opening a link in a button.

Declaration

object LinkButton

Properties

NameTypeDescription
role Requiredstring

Always link_button for this component.

URL RequiredSupportedURLs

The URL to open when a person interacts with the range of text specified in the addition.

accessibilityLabelstring

A string that’s read to the user when you enable certain accessibility functionalities.

anchorAnchor

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 none value for conditional design elements. Adding it here has no effect.

behavior(Behavior | string("none"))

An object that defines behavior for a component, like Parallax or Springy.

To remove a previously set condition, use none.

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.

hiddenboolean

A Boolean value that determines whether the component is hidden.

identifierstring

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 ComponentLayout object that contains layout information, or a string reference to a ComponentLayout that’s defined at the top level of the document.

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 role of this component.

style(ComponentStyle | string | string("none"))

An inline ComponentStyle object that defines the appearance of this component, or a string reference to a ComponentStyle that’s defined at the top level of the document.

Use the none value for conditional design elements. Adding it here has no effect.

textstring

The text, styled according to the textStyle definition.

textStyle(ComponentTextStyle | string)

An inline ComponentTextStyle object that contains styling information, or a string reference to a ComponentTextStyle object that’s defined at the top level of the document.

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
      }
    }
  ]
}

See Also

Article Structure