Components/Form
Interactive docs page: https://wix-pages.com/design-system-documentation/#/component/fillpreview
A clickable preview for colors, gradients, images and vector graphics. Mainly used as a building part for <Swatches/> component, but can be used as a standalone item too.
<Thumbnail/> instead.Render preview content with fill prop. It accepts:
Display up to four selected colors in the fill preview. Use the fill prop to pass definitions for up to four colors, including those with opacity. This feature is useful for visualizing selections that involve semi-transparent colors.
Note: Each color segment is not individually interactive, the entire element is a single clickable area to ensure a sufficient hit target.
Control the component size with the size prop. The component supports five sizes:
extraTiny, use in very dense layouts for display purposes only. Keep in mind that this size does not provide a sufficient clickable area, so use it sparingly.tiny, use in tight layouts where space is limited.small, use to display rows of color selections. This size is also used in other components, such as <ColorPicker/>.medium, use in design settings panels.large, use in spacious layouts, especially when only a few <FillPreview/> components are present.Control preview ratio with the aspectRatio prop. By default, the component maintains a 1
Control the component state with:
selected - use to highlight active selection.disabled - use to highlight unavailable option.Render the preview as another component or DOM tag.
When fill is an image, imageFit controls how it is sized inside the preview:
cover fills the preview and crops the overflow, keeping the image proportions.contain fits the whole image inside the preview, keeping its proportions.With imageFit unset the image is stretched to the preview shape, which distorts it whenever the two ratios differ. The example below puts a wide image in a square preview, so each value is easy to tell apart.
Use fill preview to show the options of gradient fill types in forms.
Use <FillPreview/> to let users select a color for different items.
| Name | Type | Default | Description |
|---|---|---|---|
as | string | ComponentClass<any, any> | FunctionComponent<any> | 'button' | Renders the component as a given HTML tag or React component. |
aspectRatio | string | number | — | Control elements aspect ratio value. |
children | ReactNode | — | |
contentClassName | string | — | Specifies a CSS class name to be appended to the content span element. |
contentRef | RefObject | — | React ref to be attached to the content span. |
dataHook | string | — | Applies a data-hook HTML attribute that can be used in the tests. |
disabled | boolean | — | Specify whether preview should be disabled or not. |
fill | ReactNode | — | Specify a color, gradient, image URL, SVG or a list of colors to be rendered as a preview content. |
href | string | — | URL of the page that link goes to. |
imageFit | "contain" | "cover" | — | Controls how an image fill is sized within the preview. When not set, the image stretches to fill the preview, which can distort its aspect ratio. |
onBlur | FocusEventHandler<unknown> & ((event: FocusEvent, triggers: Triggers) => void) | — | |
onFocus | FocusEventHandler<unknown> & ((event: FocusEvent, triggers: Triggers) => void) | — | |
prefixIcon | ReactElement | — | Accepts an icon or a component to display before the content. |
ref | null | string | (instance: HTMLDivElement | null) => void | RefObject<HTMLDivElement> | — | Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref). |
selected | boolean | — | Specifies whether preview is selected or not. Selected item receives an outline border style. |
size | "small" | "tiny" | "medium" | "large" | "extraTiny" | — | Controls the size of the element. |
suffixIcon | ReactElement | — | Accepts an icon or a component to display after the content. |
Import the driver matching your test environment:
| Method | Description |
|---|---|
click | clicks on button |
isSelected | returns true if item is selected |
getButtonStyle | returns the style attribute string of the button element |
exists | Checks whether the component found with the given data hook. |
element | Gets the component root element. |
base | Returns UniDriver for the base element. |
imageFit prop ('cover' | 'contain', defaults to 'cover') to control how an image fill is sized within the preview. (#16983) — has visual changesLast updated: 22 October 2026