Conditional formatting and Icon Sets offer a great way to highlight important information or visually alert you when something needs attention. This article outlines how to add conditional formatting rules to a diagram so you can highlight shapes with stylistic elements and icons.
Plan availability: Free, Individual, Team, and Enterprise.
- Available on FedRAMP accounts.
- Read the Lucid Plans article for more information about what is available on your account or the Upgrade your Lucid account article for instructions to upgrade.
Create a new rule
When you create a new conditional formatting rule, it will automatically evaluate all of the shapes in your diagram to see if they match your conditional formatting criteria.
If you want the conditional formatting to only apply to certain shapes, start by selecting the shapes you would like Lucidchart to include in your conditional formatting.
To create a conditional formatting rule:
- Click
the Conditional Formatting icon from the Primary Toolbar at the far left-hand side of the canvas.
-
Click + Add rule at the bottom of the panel.
- If this is your first time opening the conditional formatting panel, click Or create manually, or type a prompt for Lucid AI.
- If you have cloud data attached to your document, you need to choose a shape type (All shapes or Cloud data shapes) before creating a rule.
-
Type a name for the rule at the top of the panel.
- Select "If" conditions.
- Select "Then" formatting.
- Click Save.
After you create your first rule, you can add additional rules by clicking Add rule or Or create manually from the bottom of the panel.
For more detail on "If" and "Then" conditions, read the sections below.
Tip: Save time by creating your conditional formatting rules with AI. Learn more in our Boost productivity with Lucid AI in Lucidchart article.
Add conditions to a rule (If)
To create an “If” condition, choose one of the following options from the dropdown menu under "If":
- Shape type: Format based on object type using "Is" or "Is not" and selecting shapes from the dropdown.
- Connected shapes: Format based on the number of connected shapes using conditions like "Is greater than," "Is less than," or "Is equal to" with a specified value.
- Text: Format based on shape text using conditions ("Contains," "Does not contain," "Is empty," "Is not empty") and a specified value.
- Shape data: Format based on shape metadata by selecting a column from your dataset, an operator (such as "Is greater than," "Is empty"), and a specified value.
- Shape location: Format based on whether a shape is inside a specific container or swimlane on the canvas.
- Formulas: Format using custom Lucidchart formulas typed directly into the formula field.
Learn more: To see an example of each type of "If" condition, check out this post from the Lucid Community.
Add an AND or an OR condition
Optionally, you can add an AND or OR condition to your rule by following these steps:
- Click Add condition under the “If” dropdown.
-
Select one of the following options:
- OR Condition: Only one of the conditions must be met for the formatting to be triggered.
- AND Condition: All conditions must be met for the formatting to trigger.
Add formatting to a rule (Then)
In the “Then” section, you can select from the following options:
- Shape style: Apply preset themes or
- Custom shape style: Set custom styling options such as fill color, line color and style, text color, and line width.
- Icons: Add Lucidchart library icons with options to customize style, hover text, and positioning.
- Text badge: Add a small text badge with options to customize style, hover text, and positioning.
- Custom icon: Add an uploaded image to be used as an icon with options to customize style, hover text, and positioning.
- Dynamic Shapes: Set fill and background colors, define min/max parameters using shape data or formulas, and specify the progress value (such as 70% completion) using custom numbers, shape data, or formulas.
Add ELSE or ELSE IF formatting
Optionally, add an ELSE or ELSE IF condition if you want to apply formatting to the shapes in your selection that do not meet the conditions that you specified.
Show or hide conditional formatting rules
Once your rules have been created, hover your cursor over a rule in the conditional formatting panel and select the hide icon or
the show icon to toggle whether a rule is active.
To hide or show all rules at once, follow these steps:
- Click the three-dot icon from the top-right of the conditional formatting panel.
- Select Hide all rules or Show all rules.
Manage conditional formatting rules
Once your rule has been created and saved, it appears in a list in the conditional formatting menu. Click the three-dot menu to the right of a rule to access the following options:
- Rename to change the title of a rule.
- Edit to update the conditions for formatting options.
- Duplicate to duplicate the rule and add it to the current document.
- Apply to selection, Apply to all, or Unapply to select whether a rule is applied to a selection of shapes in a document, all shapes in a document, or no shapes in a document.
- Delete to remove the rule from the document.
- Copy to copy the rule to your clipboard. You can then use it in a different document by clicking the three-dot menu at the top of the conditional formatting panel in another Lucidchart document and selecting Paste rule(s).
In addition to using the menus to edit rules, you can drag and drop rules in this list to apply or unapply a rule to different selections in your diagram. To see which shapes a rule is applied to, you can hover over a rule, and the shapes the rule applies to will be highlighted.
Add or remove an icon from a shape
Using Icon Sets, you can add an icon to one or more shapes on the canvas without setting up a conditional formatting rule. To add an icon, follow these steps:
- Select one or more objects on the canvas.
- Click
the Icon Sets icon from the Formatting bar at the top of the workspace.
- Select an icon from the "Icon" dropdown menu.
- From this panel, you can also change the color of the icon and the position of the icon relative to the object or objects you selected.
To remove an icon:
- Select one or more objects on the canvas that contain an icon.
- Click
the Icon Sets icon from the Formatting bar at the top of the workspace.
- Select the "Icon" dropdown menu.
- Click Remove Icon.
Conditional formatting for cloud data shapes
Note: Lucidscale functionality is being moved to Lucidchart. This article reflects the new experience. For legacy Lucidscale documentation, check out this post from the Lucid Community.
When diagramming cloud infrastructure in Lucidchart, conditional formatting includes unique functionality specifically for evaluating cloud resource data and provider tags.
To access conditional formatting for cloud data shapes, follow these steps:
- Click
the Conditional Formatting icon from the Primary Toolbar at the far left-hand side of the canvas.
- Select the Cloud data shapes tab at the top of the panel.
Add a rule for cloud data shapes
Setting up a rule for a cloud data shape is similar to adding a rule for standard shapes on the canvas with a few key differences:
- For: Instead of selecting individual shapes on the canvas, select a specific resource class from the “For” dropdown to apply the rule automatically to all instances of that resource.
-
Search by: Determine what cloud data is evaluated.
- Resource Data: Evaluates imported cloud configuration properties and metadata fields.
- Labels: Evaluates key-value label or tag pairs defined in your cloud provider console.
- Apply to all views: Use this toggle to apply the rule to every view in your document.
Manage conditional formatting rules for cloud data shapes
Clicking the three-dot menu to the right of a cloud data shape rule opens some of the same options as standard shapes such as Rename, Edit, Duplicate, Delete, and Copy.
However, applying or unapplying rules works differently for cloud data shapes. Instead of targeting specific shapes directly, rules in the conditional formatting panel are grouped into the following categories:
- Applied to all cloud data shapes
- Applied to all view
- Applied to this view
- Applied to other views
Drag and drop rules between these categories to update where they apply.
FAQ
Can I use Actions to toggle my conditional formatting rules?
Yes. You can set up an action to toggle conditional formatting rules on and off. This action can be assigned to a specific shape of your choice. Once the action is set up, the shape will function as a button with which you can use the hotkey (Command + Shift + Click for Mac, and Ctrl + Shift + Click for PC) to toggle the rules on and off. For instructions on setting up this action, refer to our Actions article.
How can I add a legend?
To create a color-coded legend, use the Diagram Key shape. Here’s how:
- Locate the Standard shape library in the Shape menu.
-
Drag
the Diagram Key shape onto the canvas.
For more information about how to Add a diagram key in Lucidchart, check out our article.
What kind of syntax is used for inputting rules?
Conditional formatting uses IF → THEN (optional: → ELSE) syntax for inputting rules.
How can I tell which shapes my rule applies to?
To the right of every rule name, there is a gray indicator that shows how many out of the total number of shapes a rule applies to (30/30 in the example below). When you hover over the rule in the list view, the shapes that the rule is applied to will also light up on the canvas.
Why do all of my shapes have an icon that I am unable to remove?
You or a collaborator may have added icons using the Icon Sets feature. To remove them, follow the steps listed in the Add or remove an icon from a shape section above. If this doesn't work, you can also check to see if you have any conditional formatting rules that are being applied to the shape or shapes.
Resources
To learn more about this feature, explore the additional resources below. These resources are available in English only.
Give feedback on this article
Have feedback about this article? Tell us about your experience here.