Ui5 Best Practices Smart Controls

by UI5a99b882ce364No licenseListed Oct 8, 2026Updated Oct 8, 2026

UI5 smart controls (sap.ui.comp) best practices for OData V2 annotation-driven controls. Use when creating/troubleshooting SmartField, SmartForm, SmartFilterBar, SmartChart, SmartLink, SmartMultiInput, or SmartTable. Covers control selection, annotations (ValueList, FieldControl, SemanticObject, UI.LineItem, UI.Chart), mandatory rules, common errors, and per-control API reference. Triggers: "SmartField", "SmartForm", "SmartFilterBar", "SmartChart", "SmartLink", "SmartMultiInput", "sap.ui.comp", "smart control annotations", "OData V2 metadata-driven", "value help annotations", "ValueList annotation", "field control annotation", "semantic object navigation". Keywords: sap.ui.comp, SmartField, SmartForm, SmartFilterBar, SmartChart, SmartLink, SmartMultiInput, SmartTable, ValueHelpDialog, OData V2, annotations, ValueList, FieldControl, SemanticObject, entitySet, ControlConfiguration, GroupConfiguration, textArrangement, FilterProvider, initialise, beforeRebindChart, navigationTargetsObtained

Instructions onlySoftware Development
AI-generated overview

Guidance for building and troubleshooting SAPUI5 smart controls (sap.ui.comp) with OData V2 annotations.

What it does
This skill provides best-practice guidance for SAPUI5 smart controls in the sap.ui.comp library, covering control selection, annotation usage, mandatory rules, common errors, and per-control API references. It includes reference documents for SmartField, SmartForm, SmartFilterBar, SmartChart, SmartLink, SmartMultiInput, FilterBar, and ValueHelpDialog. It is instruction-only and produces no files or scripts.
When to use it
Use it when generating, reviewing, or troubleshooting UI5 smart control code in freestyle applications backed by OData V2 services. It is relevant when working with annotation-driven controls such as SmartField, SmartForm, SmartFilterBar, SmartChart, SmartLink, or SmartMultiInput.
Requirements
No scripts or runtime dependencies; it relies on the agent's ability to read the bundled reference markdown files. It assumes familiarity with SAPUI5 1.136+ LTS and OData V2 metadata annotations.

UI5 Smart Controls Best Practices

Apply these guidelines whenever generating, reviewing, or troubleshooting UI5 smart control code in freestyle applications using OData V2 services.

UI5 version baseline: SAPUI5 1.136+ LTS. All features mentioned are available from this version unless noted.

When to load each reference

TriggerLoad
Working on or planning a sap.ui.comp.smartfield.SmartFieldreferences/smart-field.md [blocked]
Working on or planning a sap.ui.comp.smartform.SmartFormreferences/smart-form.md [blocked]
Working on or planning a sap.ui.comp.smartfilterbar.SmartFilterBarreferences/smart-filter-bar.md [blocked]
Working on or planning a sap.ui.comp.smartchart.SmartChartreferences/smart-chart.md [blocked]
Working on or planning a sap.ui.comp.navpopover.SmartLinkreferences/smart-link.md [blocked]
Working on or planning a sap.ui.comp.smartmultiinput.SmartMultiInputreferences/smart-multi-input.md [blocked]
Working on or planning a sap.ui.comp.filterbar.FilterBarreferences/filter-bar.md [blocked]
Working on or planning a sap.ui.comp.valuehelpdialog.ValueHelpDialogreferences/value-help-dialog.md [blocked]

Load before producing any output. Do not work from memory.


Core Rules

Mandatory

  • Always specify entitySet on Smart controls or ensure the control inherits a binding context that resolves the entity type.
  • Use ControlConfiguration in XML for SmartFilterBar field overrides (control type, filter type, index). Only visible, label, and visibleInAdvancedArea can be changed at runtime.
  • Use the correct hierarchy: SmartForm > Group > GroupElement > SmartField. Never place SmartFields directly in a SmartForm.
  • Wait for the initialise event before programmatically accessing inner controls (e.g., getInnerControl(), getChart()).
  • Use sap.ui.model.odata.type.* types in bindings alongside OData V2 models. Never use sap.ui.model.type.* with OData V2.
  • Set ariaLabelledBy on SmartFilterBar and SmartChart referencing a visible title for accessibility.
  • Use check() on SmartForm for client-side mandatory field validation before submitting data.
  • Use get_api_reference MCP tool to verify control APIs. Use run_ui5_linter to validate code.

Prohibitions

  • Do not use Smart controls with OData V4 services. Use MDC controls (sap.ui.mdc) instead.
  • Do not set custom formatters on SmartField value property. SmartField manages its own rendering based on metadata. Use annotations to influence behavior.
  • Do not use composite binding syntax (parts: [...]) on SmartField. It manages its own composite bindings for unit/currency fields.
  • Do not call getChart() synchronously during initialization. Use the initialise event or getChartAsync().
  • Do not directly modify inner controls of SmartChart or SmartTable (e.g., the inner sap.chart.Chart). Use the smart control's public API.
  • Do not hardcode field labels. Use sap:label or @Common.Label annotations in OData metadata.
  • Do not use inline styles or scripts in HTML (CSP compliance).
  • Do not use global access (sap.ui.comp.smartfield.SmartField). Use sap.ui.define or ES6 imports.

Selection Matrix

ControlUse whenDo not use when
SmartFieldOData V2, single property display/edit, auto-rendering by Edm type and annotationsOData V4, JSON models, custom rendering required, composite/multi-property fields
SmartFormOData V2, entity editing with multiple SmartFields, auto-labels from annotationsOData V4, complex custom layouts, non-OData data
SmartFilterBarOData V2, annotation-driven filter UI, integration with SmartTable/SmartChartOData V4 (use MDC FilterBar), JSON-only, purely custom filter logic
SmartChartOData V2, annotation-driven chart visualization, drill-down, variant managementOData V4 (use MDC Chart), non-analytical data, custom chart JS
SmartLinkOData V2, semantic object navigation, cross-app navigation via FLPOData V4 (use MDC Link), simple static links, no FLP available
SmartMultiInputOData V2, multi-value entry with tokens, value help with rangesOData V4, simple single-value input, JSON-only
FilterBarManual filter UI without OData annotations, inside ValueHelpDialog, custom filtersOData V2 with annotations (use SmartFilterBar), OData V4 (use MDC FilterBar)
ValueHelpDialogComplex value selection with table + conditions tabs, token-based multi-selectSimple dropdowns, single-value selection, OData V4 (use MDC ValueHelp)

Common Errors

SymptomCauseFix
SmartField renders as plain text in edit modeMissing binding context or wrong entitySetVerify value="{PropertyName}" and entity context resolution.
SmartField shows Input instead of DatePickerMissing sap:display-format="Date" on propertyAdd annotation or use controlType in ControlConfiguration.
SmartForm labels missingsap:label annotation not set in OData metadataAdd sap:label to property or set label on GroupElement.
SmartFilterBar type-ahead not workingMissing ValueList annotation with correct target pathVerify target: {Namespace}.{EntityName}/{FieldName}.
SmartFilterBar default values ignoredSetting ControlConfiguration dynamically after initialiseSet values statically in XML or use setFilterData() API.
SmartChart height is 0 / not visibleContainer does not provide explicit heightSet height on parent container (e.g., height="50vh").
SmartChart missing dimensions/measuresWrong or missing UI.Chart annotationVerify MeasureAttributes and DimensionAttributes in annotation.
SmartLink popover shows "No content available"No navigation targets for semantic object in FLPVerify FLP configuration and user authorizations.
SmartLink rendered as text (not clickable)No SemanticObject annotation on propertyAdd @Common.SemanticObject annotation to OData property.
SmartMultiInput tokens not persistingMissing ValueList or incorrect bindingVerify ValueList annotation and navigation property binding.

Performance & Accessibility

Anti-patterns to avoid

  • Requesting all value lists eagerly (use lazy loading; value lists load on-demand by default).
  • Using liveMode="true" on SmartFilterBar with expensive backend queries (causes rapid re-fetching).
  • Deep nesting of SmartForm groups (keep hierarchy flat: Form > Group > GroupElement).
  • Bypassing SmartChart API to modify inner chart directly (breaks personalization and variant management).
  • Not setting ignoredChartTypes when certain chart types are irrelevant (unnecessary UI options).

Accessibility checklist

  • Set ariaLabelledBy on SmartFilterBar referencing a visible title.
  • Set ariaLabelledBy on SmartChart referencing a visible title.
  • SmartForm automatically propagates labels to SmartFields via annotations.
  • Verify keyboard navigation works for SmartFilterBar "Adapt Filters" dialog.
  • Test SmartLink popover with screen reader (navigation targets must be announced).

Source and attribution

Source:UI5/plugins-coding-agentsinplugins/ui5/skills/ui5-best-practices-smart-controlsat commita99b882

License: No license

Content belongs to its original authors. SourceWeft indexes it from a public repository.

Report or request removal