Example: Custom Lightning Web Component to Standard Flow Component
Make your custom text component react to a standard Flow component.
- Create a public field with the
@api
decorator as referenced incustomText.js
example. - Add the target configuration in the
.js-meta.xml
file with the appropriate type as referenced in thecustomText.js-meta.xml
example. - Add an input field attached with an event handler to store the user input.
- In the event handler, fire a
FlowAttributeChange
event defined in theflow-support
component. TheFlowAttributeChange
event name must match the name of the public field in order for reactivity to work. Due to the nature of the Flow Runtime, the setter method is called after theFlowAttributeChange
event is fired and it is invoked when reactivity leads to a change to the public field. - After you create the custom component, add the component to the Flow builder with a label.
- To make the Text component react to the custom component, configure the default value’s source on the Text component to the custom component’s public property.