Beautiful, visual selection fields using images. Perfect for product pickers, style selectors, travel options, and any scenario where pictures speak louder than words.
optionSize and per-option sizeisDisabledallowDeselectImage Choice uses Image Assets, a PRO feature. Upload your images in account settings.
This tutorial uses sample travel images available for everyone to try!
Every code snippet is fully editable! Modify the code, experiment with options, and see changes instantly in the live preview.
Start with addImageChoice() and selectionMode: 'single' for radio button-like behavior with images. Users can select exactly one option.
id (the value stored), an assetId (the uploaded image), and optionally a label. Set selectionMode: 'multiple' to allow users to select multiple images. Use min and max to constrain how many can be selected.
['budget', 'luxury']). The columns layout arranges options in a grid. Use columnsCount to specify 2, 3, 4, or 'auto' columns.
columnsCount: 'auto' for responsive layouts that adapt to the container width. Options will wrap to new rows as needed. The carousel layout shows a fixed number of options with navigation arrows. Configure visibleItems, showArrows, showDots, and loop.
loop: true for infinite scrolling. Use showDots: true for pagination indicators at the bottom. The card variant (default) shows the image with label and description below. Great for detailed product selections.
description to options for additional context. Descriptions appear below the label in card variant. The thumbnail variant is minimal and image-focused. The border appears directly on the image, perfect for compact selections.
optionSize values. Labels appear below the image without the card border. The overlay variant places the label on top of the image with a gradient background. Creates a dramatic, immersive look.
Fine-tune appearance with three styling options: customStyles (container), optionStyles (each option), and selectedOptionStyles (selected state).
selectedOptionStyles for subtle animations like transform: scale(1.02) to make selections feel responsive. Control image dimensions with optionSize for all options, or override per-option using size in individual options.
width OR height to preserve aspect ratio. Setting both forces exact dimensions. Each option can have its own isDisabled, customStyles, and size. Great for sold-out items or featured products.
isDisabled: true to gray out unavailable options. Use per-option customStyles to highlight special items. Control whether users can click a selected option to deselect it. Default is true. Set allowDeselect: false to force a selection once made.
allowDeselect: false when you require a choice and don't want users to accidentally clear their selection. Make options dynamic using form.state() and form.computedValue(). Options can filter or change based on other field values.
Let's put it all together! A complete travel planning form using multiple ImageChoice fields with different configurations.
form.imageChoice('id')?.value(). For multiple selection, the value is an array. ImageChoiceOption objects{ type: 'columns', columnsCount } or { type: 'carousel', visibleItems, showArrows, showDots, loop }{ width?, height? } - base size for all options{ width?, height? } - override global optionSize for this optionGreat job! You've mastered image-based selection fields. Ready to explore more?
Continue to Conditional VisibilityRelated tutorials: