This article is designed for quick lookups and reminders after you've learned the basics of Action Logic. For step-by-step tutorials, check out our in-depth articles or videos.
TABLE OF CONTENTS
- Switching Layouts Based on Dropdown Menu Selection
- Showing or Hiding Variables Based on Layout
- Changing Text Color with a Dropdown
Switching Layouts Based on Dropdown Menu Selection
Problem to solve: Enable stakeholders to select different layouts from a dropdown menu.
Steps:
- Create your Alternate Layouts and name them (ex: Vertical, Horizontal).
- Add a List variable for your layout selector (ex: "Design Option ").
- Add Action Logic to set the selected layout based on the variable’s value.
Sample Action Logic:
If variable [Design Option] displayValue is string "Vertical"
→ set alternate layout [Default] selected = true
else if variable [Design Option] displayValue is string "Horizontal"
→ set alternate layout [Horizontal] selected = true
Showing or Hiding Variables Based on Layout
Problem to solve: Show only relevant variables based on the selected layout.
Steps:
- Set visibility of all layout-specific variables to false by default.
- Add Action Logic to show variables for the selected layout.
Sample Action Logic:
set variable [Email Image] visible = false
set variable [Image] visible = false
If variable [Design Option] displayValue is string "Email"
→ set variable [Email Image] visible = false
set variable [Image] visible = false
Changing Text Color with a Dropdown
Problem to solve: Allow stakeholders to change text color while maintaining consistent fonts and styles.
Steps:
- Set up Paragraph Styles and Color Swatches.
- Create a "List" variable for your color options (ex: "Choose Text Color").
- Add Action Logic to change the text color based on selection.
Sample Action Logic:
If variable [Choose Sub-Headline Color] displayValue is string "Blue"
→ set paragraphStyle [Subhead] color = color [R=29 G172 B211 2] id
Else if variable [Choose Sub-Headline Color] displayValue is string "Teal"
→ set paragraphStyle [Subhead] color = color [R=71 G=215 B=172]
Lytho Pro Tip: Action Logic shines when used to create personalized, on-brand experiences without overwhelming stakeholders with options they don’t need. Keep your logic clean, and your variables well-named — future-you will thank you.