The Visual Choice option adds a sophisticated control that presents choices as a grid of visual cards, each containing a custom image, title, and optional description. It’s designed for making selections where a visual preview is more helpful than text or icons alone.
Why would someone use it in a custom widget? #
Use this control when you need users to select between distinct visual styles, layouts, or templates. It’s perfect for choosing card designs, header styles, color scheme presets, or any option where seeing a small thumbnail preview is more intuitive than reading a text label. It creates a premium, user-friendly selection experience.
Where This Option Appears #
- In Widget Builder: You add this control in the Content tab.
- In the Elementor Editor:Â Once saved, it appears as a responsive grid of visual cards. Users click a card to select it, and the selected state is clearly highlighted.
Available Settings #
Here are the configurable settings for the Visual Choice control:
Basic Settings #
- Label:Â The name of the control (e.g., “Card Style”, “Layout Preset”).
- Name:Â The unique machine-readable ID (likeÂ
card_style) for the dynamic shortcode. - Description:Â Optional text to guide the user.
- Options:Â This is the core feature. You add a row for each visual choice, defining three properties:
- Key:Â The internal value passed to the shortcode (e.g.,Â
style-modern). - Title:Â The text label displayed on or below the image in the card.
- Image:Â The thumbnail image that visually represents the choice.
- Key:Â The internal value passed to the shortcode (e.g.,Â
- Columns:Â Defines the number of cards shown per row (from 1 to 6). This controls the layout density.
- Toggle: When enabled, this changes the control’s behavior. Users can click the selected card again to deselect it, returning the field to an empty state. This is useful for optional features.
Advanced Settings #
- Show Label, Label Block, Responsive Control:Â Standard options.
- Dynamic Support:Â Allows the selected value to be populated from a dynamic source.
- Frontend Available:Â When enabled, the selected key is passed to your widget’s JavaScript.
- Separator, Conditions, Control Classes, Selector:Â Standard advanced options.
Generated Shortcode #
When you add a Visual Choice control with the Name layout_preset, Widget Builder generates the shortcode: {{layout_preset}}.
- What it represents: This shortcode outputs the Key of the visually selected option (e.g.,Â
sidebar-left). - Where to use it: Use it in your HTML, CSS, or JS panels, similar to a Select or Choose control.
- HTML/CSS:Â To apply different classes or styles:Â
<div class="layout-{{layout_preset}}"> - JS:Â To trigger different logic:Â
if ('{{layout_preset}}' === 'grid-view') { initGrid(); }
- HTML/CSS:Â To apply different classes or styles:Â
How to Use It: A Practical Example #
Let’s create a “Content Card” widget where the user can select from different pre-designed visual styles.
- In Widget Builder’s Content tab, add a Visual Choice control.
- Set the Label toÂ
Card Design. - In Options, create three choices:
- Key:Â
modern | Title: Modern | Image: [Screenshot of modern card] - Key:Â
classic | Title: Classic | Image: [Screenshot of classic card] - Key:Â
minimal | Title: Minimal | Image: [Screenshot of minimal card]
- Key:Â
- Set Columns toÂ
3 to display them side-by-side. - In your CSS panel, define styles for each class:
.card-design-modern { /* modern styles */ }
.card-design-classic { /* classic styles */ }
.card-design-minimal { /* minimal styles */ } - In your HTML panel, add the dynamic class:
<div class="custom-card card-design-{{card_design}}"> <!-- Card content --> </div>
In the editor, users will see a row of three visual thumbnails and can simply click to choose the design they prefer.
Common Use Cases #
- Template/Layout Selection:Â Choosing between different layout structures for a section or widget.
- Style Preset Pickers:Â Selecting from predefined color schemes or design themes.
- Component Skins:Â Switching between different visual “skins” for a complex component.
- Demo Content Import:Â A sophisticated interface for choosing which pre-built design to import.
Helpful Tips #
- Use Consistent, Clear Images:Â The thumbnails should be small, clear, and consistently styled so the choice is obvious. Screenshots or well-designed icons work best.
- Choose the Right Column Count:Â For 2-4 options, 2-4 columns work well. For more options, consider fewer columns to prevent the interface from becoming too wide.
- Toggle for Optional Features: Use Toggle mode if the visual choice is for an optional feature (e.g., “Add a special badge?”), allowing users to turn it off completely.
- Distinguish from ‘Choose’: Use Visual Choice over the icon-based Choose control when custom images will communicate the option better than a generic icon.
The Visual Choice control elevates the user experience by making selection intuitive, visual, and engaging, perfect for widgets that offer multiple distinct design paths.