DxFormLayoutItem.CaptionId Property
Specifies a unique identifier of the layout item’s caption.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v26.1.dll
Declaration
[DefaultValue(null)]
[Parameter]
public string CaptionId { get; set; }
Property Value
| Type | Default | Description |
|---|---|---|
| String | null | A unique identifier. |
Remarks
Use the CaptionId property to specify a unique identifier (HTML id attribute) for the layout item’s caption.
Screen readers can access caption information if you define a relationship between the layout item and the child component:
- Specify the Caption property.
- Set the
CaptionIdproperty to a value that is unique across the entire page. This value is case-sensitive and should not contain whitespaces. - Set the child component’s
aria-labelledbyattribute to the same value as the item’sCaptionId.
<DxFormLayout>
<DxFormLayoutItem Caption="Select your city:"
CaptionId="list-label">
<DxListBox Data="@Cities"
aria-labelledby="list-label"
TData="string"
TValue="string" />
</DxFormLayoutItem>
</DxFormLayout>
@code {
List<string> Cities = new List<string> { "London", "Berlin", "Paris" };
}
Combination with the CaptionFor Property
- If the DxFormLayoutItem contains an HTML
<input>or<textarea>element, use the CaptionFor property instead. - When you specify
CaptionIdwithout CaptionFor, the caption is rendered as an HTML span element with anidattribute. - When you specify both
CaptionIdand CaptionFor, the caption is rendered as an HTML label element with bothforandidattributes.
See Also