CreateUiDefinition 元素CreateUiDefinition elements

本文介绍了 CreateUiDefinition 的所有受支持元素的架构和属性。This article describes the schema and properties for all supported elements of a CreateUiDefinition.


大多数元素的架构如下所示:The schema for most elements is as follows:

  "name": "element1",
  "type": "Microsoft.Common.TextBox",
  "label": "Some text box",
  "defaultValue": "my value",
  "toolTip": "Provide a descriptive name.",
  "constraints": {},
  "options": {},
  "visible": true
propertiesProperty 必选Required 说明Description
namename Yes 一个内部标识符,用于引用元素的特定实例。An internal identifier to reference a specific instance of an element. 元素名称最常用于 outputs 中,其中指定元素的输出值映射到模板的参数。The most common usage of the element name is in outputs, where the output values of the specified elements are mapped to the parameters of the template. 还可以使用它将元素的输出值绑定到其他元素的 defaultValueYou can also use it to bind the output value of an element to the defaultValue of another element.
typetype Yes 要为元素呈现的 UI 控件。The UI control to render for the element. 有关支持的类型的列表,请参阅元素For a list of supported types, see Elements.
labellabel Yes 元素的显示文本。The display text of the element. 某些元素类型包含多个标签,因此,值可能是包含多个字符串的对象。Some element types contain multiple labels, so the value could be an object containing multiple strings.
defaultValuedefaultValue No 元素的默认值。The default value of the element. 某些元素类型支持复杂的默认值,因此,值可能是对象。Some element types support complex default values, so the value could be an object.
toolTiptoolTip No 要在元素的工具提示中显示的文本。The text to display in the tool tip of the element. label 类似,某些元素支持多个工具提示字符串。Similar to label, some elements support multiple tool tip strings. 可以使用 Markdown 语法嵌入内联链接。Inline links can be embedded using Markdown syntax.
constraintsconstraints No 用来自定义元素的验证行为的一个或多个属性。One or more properties that are used to customize the validation behavior of the element. constraints 支持的属性因元素类型而异。The supported properties for constraints vary by element type. 某些元素类型不支持自定义验证行为,因此没有 constraints 属性。Some element types do not support customization of the validation behavior, and thus have no constraints property.
选项options No 用于自定义元素行为的其他属性。Additional properties that customize the behavior of the element. constraints 类似,支持的属性因元素类型而异。Similar to constraints, the supported properties vary by element type.
visiblevisible No 指示是否显示此元素。Indicates whether the element is displayed. 如果为 true,则会显示此元素及其相应的子元素。If true, the element and applicable child elements are displayed. 默认值是 trueThe default value is true. 可使用逻辑函数动态控制此属性的值。Use logical functions to dynamically control this property's value.


每个元素的文档都包含此元素的 UI 示例、架构、行为备注(通常涉及验证和支持的自定义)以及示例输出。The documentation for each element contains a UI sample, schema, remarks on the behavior of the element (usually concerning validation and supported customization), and sample output.

后续步骤Next steps

有关创建 UI 定义的简介,请参阅 CreateUiDefinition 入门For an introduction to creating UI definitions, see Getting started with CreateUiDefinition.