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
| Name | Description | Default values |
|---|---|---|
| featureData | the feature name/context and the screen ID in which the component appears. | |
| label | title of prompt input. | |
| isLoading | whether the prompt is showing a loading state instead of results. | .constant(false) |
| accessibilityLabel | the accessibility label for the prompt. | |
| helperText | the helper text for the prompt. | |
| context | the SemanticContext. | SemanticContext.default |
| searchHelper | optional 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 |
| isEditable | whether the prompt is editable (interactable). | |
| shouldBoldSearchResults | whether or not matching search results will be bolded based on the input search text. | false |
| content | binding to the ListItem array for this prompt. See usage guidelines below for UX suggestions. | nil |
| selections | binding to selected items. | nil |
| isMultiSelect | whether we support multiple selection or single select and dismiss. | |
| localizer | provider of localized strings, conforming to LocalizationAdapting. | |
| contextMap | each 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. | |
| promptID | optional parameter to specify which prompt this is on the page. | UUID().uuidString |
Accessibility Guidelines
Coming soon!
Usage Guidance
Coming soon!
API Guidelines
Methods
fun PromptUiComponent(modifier: Modifier = Modifier,searchListViewModel: SearchListViewModel,label: String,initialSelection: String? = null,helperText: String,hasDivider: Boolean = false,selectionListLoading: Boolean = false,semanticState: SemanticState = SemanticState(),searchEnabled: Boolean = true,onPromptDismissed: @DisallowComposableCalls () -> Unit = {},onClick: () -> Unit = {},onItemSelected: (ListItemUiModel) -> Unit = {},)
Parameters
| Name | Description | Default values |
|---|---|---|
| modifier | The modifier to be applied to the component. | Modifier |
| searchListViewModel | The header [ConclusionHeader] for the conclusion page specifying title, subtitle and status icon[IconType]. | |
| label | Optional. Container for any errors or warnings [AlertContainer]. | |
| initialSelection | Optional. Button to perform an action [ActionButton]. | null |
| helperText | Optional. Values for up next card [UpNextCard]. | |
| hasDivider | Optional. Avatar [Painter] to show inside up next card. | false |
| selectionListLoading | Optional. UpNextCard Avatar's backgroundColor. | false |
| semanticState | onClick listener for view Details button. | SemanticState() |
| searchEnabled | onClick listener for close button. See [BpConclusionFragment] for usage. | true |
| onPromptDismissed | onClick listener for close button. See [BpConclusionFragment] for usage. | {} |
| onClick | onClick listener for close button. See [BpConclusionFragment] for usage. | {} |
| onItemSelected | onClick listener for close button. See [BpConclusionFragment] for usage. | {} |
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