LogoLogo
HomepageYouTube ChannelInstall from the AppExchange
  • Home
  • Dynamic Components
  • Flow Components
  • Experience Components
  • Projects
  • 👋Welcome
  • Getting Started
    • Product Tour
    • Quickstart Tutorial
    • Avonni Components App
      • Accessing the App
      • Folders
      • Templates
      • Version management
    • Understanding The Essentials
      • Component Builder
      • Component Visibility
      • Target Page Object
      • Using Variables and Component Data
      • Publishing your Dynamic Components
      • Dynamic vs. Flow Components
    • AppExchange Listing Page
    • Installation & Licenses Management
  • Tutorials
    • Projects
    • Components
      • Calendar
        • How to Create Events Quickly by Dragging
        • How to Add an Edit Action to Calendar Events
        • How to Add a New Event Button to the Calendar Header
        • How to Customize the Right-Click Menu
        • How to Reschedule Events with Drag and Drop
      • Columns
        • Creating a Responsive 3-Column Layout
      • Data Table
        • How to customize Data Table style
        • How to make a field editable
        • How to add clickable buttons
        • How to color-code badges
        • How to export data
        • How to configure search
        • How to set columns visibility
      • Kanban
        • Saving Changes on Drag-and-Drop
      • List
      • Metric
      • Record Detail
        • Saving Changes
    • Interactions
      • How to create an interaction to navigate to an object page
      • How to create an interaction to navigate to a record page
      • How to Pass Multiple Selected Records from a Dynamic Component to a Screen Flow
    • Reactive Components
      • Reactive Map and Data Table
      • Master-Detail Relationship with Data Tables
      • Vertical Tabs with Reactive Data Table
    • Style
      • How do you add space or a break between sections or fields?
    • Tips and Tricks
      • Using the Dynamic Component component
  • Component Builder
    • Overview
    • Configuring Components
      • Properties
      • Fields
      • Style
    • Data & Interactions
      • Data Sources
        • Manual
        • Picklist
      • Resources
        • Constant
        • Formula
        • Nested Queries
        • Query
        • Variable
      • Interactions
        • CRUD from Record Variable
        • Download
        • Execute Flow
        • Navigate
        • On Load
        • Open Alert Modal
        • Open Confirm
        • Open Dynamic Component Dialog
        • Open Dynamic Component Panel
        • Open Flow Panel
        • Open Flow Dialog
        • Show Toast
    • Advanced Topics
      • Undo / Redo
      • Copy and Paste
      • Keyboard Shortcut
  • Components
    • Explore All Components
    • Accordion
    • Alert
    • Audio Player
    • Avatar
    • Avatar Group
    • Badge
    • Barcode
    • Blockquote
    • Button
    • Button Group
    • Button Icon
    • Button Menu
    • Button Stateful
    • Calendar
    • Camera 🆕
    • Card
    • Carousel
    • Chart
    • Checkbox
    • Checkbox Button
    • Chip Container
    • Color Picker
    • Columns
    • Combobox
    • Container
    • Counter
    • Data LWC Container
    • Data Table
    • Date Picker
    • Date
    • Date Range
    • Dual Listbox
    • Dynamic Component
    • File Upload
    • Formatted Address
    • Formatted Name
    • Formatted Value
    • Header
    • Icon
    • Icon Picker
    • Illustration
    • Image
    • Input Color
    • Input Date
    • Input Pen (Signature)
    • Input Text
    • Kanban
    • List
    • LWC Container
    • Map
    • Media Object
    • Metric
    • PDF Viewer
    • Pivot Table
    • Progress Bar
    • Progress Circle
    • Progress Indicator
    • Rating
    • Record Detail
    • Relationship Graph
    • Scope Notification
    • Section
    • Separator
    • Slider
    • Status
    • Tabbed Container
    • Tabs
    • Text
    • Text Area
    • Timeline
    • Toggle
    • Tree
    • Vertical Visual Picker
    • Video Player
    • Visual Picker
    • Visual Picker Link
  • Help
    • Contact Support
    • Security
    • Performance Guide
    • Deployment Process
    • Release Notes
    • Report Bugs
Powered by GitBook
LogoLogo

Company

  • About Us
  • Pricing

Policies

  • Privacy Policy
  • Terms of Service
On this page
  • Overview
  • Key Benefits
  • How Dynamic Visibility Works
  • Setting Up Conditional Visibility
  • Examples
  • Conditionally Displaying a Calendar
  • Device-Specific Layout
  • Common Use Cases
  • Tips
  • In Summary

Was this helpful?

  1. Getting Started
  2. Understanding The Essentials

Component Visibility

Last updated 1 month ago

Was this helpful?

Overview

Dynamic visibility is a powerful feature that enables you to create user interfaces that adapt to various situations. Instead of always showing all components, you can define rules determining when a component should be visible.

Key Benefits

  • Improved User Experience: Create cleaner interfaces by showing only relevant information at the right time.

  • Enhanced Performance: Hidden components aren't loaded, reducing page load times and server requests.

  • Responsive Design: Tailor layouts and component display for different devices (Desktop, Tablet, Phone).

  • More Responsive UI: The interface feels dynamic as components appear/disappear based on actions, data, or device.

  • Simplified Logic: Achieve complex conditional displays without intricate interactions or code


How Dynamic Visibility Works

Every Avonni component has a Set Component Visible property (in the Properties Panel) that controls its display. You can set it to:

  • Always Visible (true): The default; the component is always shown.

  • Always Hidden (false): The component is never shown.

  • Conditional Visibility: The component is shown only when specific conditions are met.


Setting Up Conditional Visibility

To make a component's visibility conditional:

  1. Select the Component: Click on the component in the canvas whose visibility you want to control.

  2. Find the "Set Component Visibility" Property: In the Properties Panel (right side), locate the Visible property.

  3. Click the Resource Selector: Click the icon next to the Visible property (usually a variable/tag icon). This opens the resource selection menu. Do not simply type true or false unless you want the component to be always visible or always hidden.

  4. Choose your condition:

  • Component Attribute: Base visibility on the state or value of another component (e.g., show Component B only if @MyCheckbox.checked is true).

  • Variable: Use a Boolean Variable resource you created. The component shows when the variable is true.

  • Formula: Use a Formula resource that evaluates to true (visible) or false (hidden). Allows complex logic.

  • Global Variable: Use system-provided information.

    • New: For Device Type: Select $Component, then choose the FormFactor attribute. This holds the current device type as text: 'Desktop', 'Tablet', or 'Phone'.


Examples

Conditionally Displaying a Calendar

Steps

  1. Add a Button Menu:

    • Drag an Avonni Button Menu component onto the canvas.

    • In its properties, configure the Items:

      • Add an item with Label: Table, Value: table

      • Add an item with Label: Calendar, Value: calendar

    • Give the Button Menu a descriptive API Name (e.g., ViewModeMenu).

  2. Add the Calendar:

    • Drag an Avonni Calendar component onto the canvas.

  3. Set the Calendar's Visibility:

    • Select the Calendar component.

    • In the Properties Panel, find the Visible property.

    • Click the resource selector icon.

    • Select Component Attribute.

    • Select your Button Menu component (e.g., ViewModeMenu).

    • Choose the value attribute.

    • Set the operator to equals

    • Set the value to calendar.

How It Works

The Calendar's Visible property is now directly linked to the value of the ViewModeMenu Button Menu. When the user selects "Calendar" in the Button Menu, the value becomes 'calendar', the condition evaluates to true, and the Calendar component is displayed. If any other option is selected, the condition is false, and the Calendar is not loaded.

Device-Specific Layout

Let's show a detailed Data Table on desktops/tablets but a simpler List component on phones.

  1. Add Data Table: Add your Data Table component (e.g., MyDataTable).

  2. Set Data Table Visibility:

    • Select MyDataTable.

    • In the Visible property, set the condition: Global Variable $Component.FormFactor not equal to 'Phone'.

  3. Add List Component: Add your List component (e.g., MyList) designed for mobile viewing.

  4. Set List Visibility:

    • Select MyList.

    • In the Visible property, set the condition: Global Variable $Component.FormFactor equals 'Phone'.

Result: Users on desktops or tablets will see the Data Table, while users viewing on a phone will see the List component, providing an optimized view for each device form factor.


Common Use Cases

  • Conditional Forms: Show/hide form fields based on previous selections.

  • Personalized Dashboards: Display different components based on user role or profile.

  • Progressive Disclosure: Gradually reveal information as the user interacts.

  • Error Messages: Show error messages only when an error occurs.

  • Loading Indicators: Show a loading indicator while data is being fetched, then hide it and show the data component.

  • Creating Responsive Layouts that adapt to Desktop, Tablet, and Phone screens


Tips

  • Start Simple: Begin with simple conditions and gradually increase complexity.

  • Test Thoroughly: Test your visibility conditions with different data and user interactions.

  • Use Formulas Carefully: While powerful, complex formulas can be more complicated to maintain.

  • Use Boolean Variables: Create boolean variables to make it more readable.


In Summary

Dynamic visibility is a core feature of Avonni Dynamic Components, offering a powerful way to create responsive and efficient user interfaces. By linking the Visible property to data, component attributes, formulas, or the new $Component.FormFactor global variable, you can precisely control when components are displayed, optimizing performance and tailoring the user experience for different conditions and devices.

Let's create an example where an Avonni Calendar component is only visible when the user selects a "Calendar" option from an .

Avonni Button Menu