The Trailblazer Community in Slack is now in Open Beta—join and connect in real time. [Join us in Slack]
Make your custom component react to changes in a standard Flow component.
To create and add the colorName custom component into the Flow Builder:
colorName and provide the labels for each.Text component as a source for the Name of Color field.Any changes made to the Text input are automatically reflected in the color public field inside of the custom Lightning web component, colorName. For example, entering magenta into the Text input results in the LWC displaying the color name styled with the same color, magenta.
1<!-- colorName.html -->
2<template>
3 <p>
4 Color name has the same color :
5 <span style={colorStyle}>{color}</span>
6 </p>
7</template>1// colorName.js
2import { LightningElement, api } from "lwc";
3
4export default class colorName extends LightningElement {
5 @api color;
6
7 get colorStyle() {
8 return "color:" + this.color;
9 }
10}1// colorName.js-meta.xml
2<?xml version="1.0" encoding="UTF-8"?>
3<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
4 <apiVersion>52.0</apiVersion>
5 <isExposed>true</isExposed>
6 <masterLabel>Color Name</masterLabel>
7 <description>Reactive Color Name</description>
8 <targets>
9 <target>lightning__FlowScreen</target>
10 </targets>
11<targetConfigs>
12 <targetConfig targets="lightning__FlowScreen">
13 <property name="color" label="Name of Color" type="String" />
14 </targetConfig>
15</targetConfigs>
16</LightningComponentBundle>