Prompt

Prompts are a way to choose one or multiple items from a large or unknown number of options.

Usage Guidance

Coming soon!

API Guidelines

Methods

Class name: LabelledPromptWithLogging Module name: UIComponentsPlugin

public init(
featureData: FeatureMetricsData,
label: String,
isLoading: Binding<Bool> = .constant(false),
accessibilityLabel: String,
helperText: String?,
context: Binding<SemanticContext>,
searchHelper: Searchability.SearchHelper? = nil,
isEditable: Bool,
shouldBoldSearchResults: Bool = false,
content: [ListItem],
selections: Binding<Set<SelectableListItem>>,
isMultiSelect: Bool,
localizer: LocalizationAdapting,
contextMap: Binding<[String: SemanticContext]>,
promptId: String = UUID().uuidString
)

Parameters

NameDescriptionDefault values
featureDatathe feature name/context and the screen ID in which the component appears.
labeltitle of prompt input.
isLoadingwhether the prompt is showing a loading state instead of results..constant(false)
accessibilityLabelthe accessibility label for the prompt.
helperTextthe helper text for the prompt.
contextthe SemanticContext.SemanticContext.default
searchHelperoptional Searchability.SearchHelper; if non-nil and the InstanceSet.DisplayIntention is a searchable list, then a search field will be provided bound to the options of this passed-in helper.nil
isEditablewhether the prompt is editable (interactable).
shouldBoldSearchResultswhether or not matching search results will be bolded based on the input search text.false
contentbinding to the ListItem array for this prompt. See usage guidelines below for UX suggestions.nil
selectionsbinding to selected items.nil
isMultiSelectwhether we support multiple selection or single select and dismiss.
localizerprovider of localized strings, conforming to LocalizationAdapting.
contextMapeach row in the list is bound to a SemanticContext in this dictionary by its ID (which is a String). This allows gesture recognizers on the rows to update whether they are inactive (deselected) or pressed, etc., and to maintain single selection logic.
promptIDoptional parameter to specify which prompt this is on the page.UUID().uuidString

Accessibility Guidelines

Coming soon!

Can't Find What You Need?

Check out our FAQ section which may help you find the information you're looking for. For further information, contact the #canvas or #canvas-kitchannels on Slack.

FAQ Section