Blazor AutoComplete Example - Disabled Items
This example showcases the AutoComplete component’s disabled items feature, which visually indicates non-selectable options within the suggestion list. Disabled entries remain visible for context but are excluded from selection and value binding, enabling developers to present unavailable choices without removing them from the dataset.
Disabled items behavior:
- Disabled items appear visually distinct (typically greyed out) in the suggestion list to signal non-interactivity.
- Disabled entries cannot be selected; clicks or selection attempts do not update the component value or bound model.
- Configure disabled items using the AutoCompleteFieldSettings.Disabled property; the linked API page includes usage examples.
When disabled items are present, the component preserves them in filtered and paginated results so users can understand why certain options are unavailable. This preserves list context and ordering while supporting scenarios such as deprecating choices or indicating temporary unavailability. Disabled entries are ignored by selection logic but remain visible to provide consistent grouping and navigation within the result set.
Implementers should ensure styling and semantic indicators clearly convey the disabled state. Include appropriate contrast and aria attributes where needed; the API reference linked above shows how to map a boolean disabled flag in your item model. In data-bound scenarios, supply a Disabled field on items or compute the disabled state server-side so AutoCompleteFieldSettings can reference it reliably.
Refer to the linked documentation for property details and code samples demonstrating how to mark items disabled and observe component behavior in both local and remote data scenarios.