Schema File

The optional schema.json file defines the widget’s attribute contract. It specifies the attributes and their associated Lightning types that the widget accepts, including display metadata (such as title and description for attribute). The Lightning types determine validation rules and data types for each attribute.

To use attribute mapping to connect your widget to a Lightning type’s dynamic data, include a schema.json file. Without it, the widget can only display static, hardcoded values.

The schema file enables:

  • Design-time validation of data bindings between Lightning types and Widgets
  • Runtime binding of attributes to enable dynamic widget behavior

This table lists the keywords that you can specify for individual widget attributes.

KeywordDescription
titleThe display name for the attribute.
descriptionA brief explanation of the attribute’s purpose.
lightning:typeThe Lightning type reference for the attribute, such as lightning__textType, lightning__numberType, or lightning__urlType.

This template shows the standard structural composition for defining a widget schema file.

This example shows a schema.json configuration file for a hotel card widget, establishing the expected data types and display metadata for the widget attributes.