> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Presets ## Article: Presets ## Article Link: https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/editor-react-components/manifest-reference/editor-element/presets.md ## Article Content: import { Property, PropertyList, ExpandableSection } from "@wix/docs-ui/content"; # Presets
__Alpha:__ Editor React Components are currently in alpha. This feature is subject to change and may have bugs, issues, and limitations. We're actively improving it based on your feedback.
The `presets` property lets you define named visual variations of your component. Each key in the `presets` map is the preset's unique identifier, which is referred to as the preset key throughout this documentation. Each value configures the preset's display name, thumbnail, sizing, default values, and optional style overrides. ## Where to define You can define `presets` in [`editorElement`](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/editor-react-components/manifest-reference/editor-element/editor-element.md).
**Important:** For presets to work, your component must wrap its root element in a container and spread `wix.presetsWrapperProps` onto it.
## Preset defaults vs. style overrides Each preset item has 2 fields that control its appearance: `presetDefaults` and `styleOverrides`. Both are optional, and they serve different purposes: - Use `presetDefaults` to define the initial values that apply when a Wix user switches to a preset. This includes layout behavior, CSS properties, CSS custom properties, display filters, and nested element defaults. These values replace the component's base configuration for that preset. - Use `styleOverrides` when you need breakpoint-aware or state-aware value overrides. For example, you might use `styleOverrides` to set a different hover color on mobile, or to adjust font sizes across breakpoints. Overrides in the `default` breakpoint cascade to all other breakpoints, while `small` overrides apply only to the mobile breakpoint. ## Preset item properties Each item in the `presets` map accepts the following properties: Sets default values for nested elements in a preset. This schema is recursive, so each inner element can contain its own nested `elements`. EditorElementLayout}.md description="Layout behaviors to apply when this preset is selected." /> DisplayFilters}.md description="Controls visibility of elements, properties, and actions for this preset." /> ## Installation presets The `installation.presets` object maps breakpoints to preset keys, controlling which preset the component starts with when first added to the page. ## Examples ### Basic presets The following defines 2 presets for a line component, 1 horizontal and 1 vertical, each with different initial sizes and layout defaults. ```typescript editorElement: { presets: { horizontal: { displayName: 'Horizontal', initialSize: { width: { sizingType: 'pixels', pixels: 280, }, height: { sizingType: 'content', }, }, presetDefaults: { layout: { resizeDirection: 'horizontal', contentResizeDirection: 'vertical', disableStretching: false, disablePositioning: false, }, }, }, vertical: { displayName: 'Vertical', initialSize: { width: { sizingType: 'content', }, height: { sizingType: 'pixels', pixels: 280, }, }, presetDefaults: { layout: { resizeDirection: 'vertical', contentResizeDirection: 'horizontal', disableStretching: false, disablePositioning: false, }, }, }, }, } ``` ### Preset element defaults The following configures layout, CSS property defaults, and display filters for a menu preset. The `displayFilters` object controls which elements, actions, and properties appear in the editor for this preset. In this case, it shows the `navbar` element and hides the `manageMenu` action. ```typescript editorElement: { presets: { menuPreset: { presetDefaults: { layout: { resizeDirection: 'horizontal', contentResizeDirection: 'horizontal', disableStretching: false, disablePositioning: false, disableRotation: true, }, cssProperties: { writingMode: { defaultValue: 'horizontal-tb', }, }, displayFilters: { elements: { show: ['navbar'], }, actions: { hide: ['manageMenu'], }, }, }, }, }, } ``` ### Inner element defaults The following configures CSS custom property defaults for a nested `line` element. ```typescript editorElement: { presets: { myPreset: { presetDefaults: { elements: { line: { cssCustomProperties: { type: { defaultValue: 'solid', }, lineColor: { defaultValue: '#000000', }, lineSize: { defaultValue: '1px', }, }, }, }, }, }, }, } ``` ### Component initial size The following sets the initial width to 120 pixels and the height to fit the content. ```typescript editorElement: { presets: { myPreset: { initialSize: { width: { sizingType: 'pixels', pixels: 120, }, height: { sizingType: 'content', }, }, }, }, } ``` ### Installation presets The following sets the horizontal preset for both breakpoints and defines a default initial width of 280 pixels. ```typescript installation: { presets: { default: 'horizontal', small: 'horizontal', }, initialSize: { width: { sizingType: 'pixels', pixels: 280, }, height: { sizingType: 'content', }, }, } ``` ### Style overrides The following overrides background color with state-specific hover values at the default breakpoint, and adjusts font size for mobile. ```typescript editorElement: { presets: { myPreset: { styleOverrides: { default: { style: { backgroundColor: { value: '#ffffff', statesValues: { hover: '#f0f0f0', }, }, fontSize: { value: '16px', }, }, elements: { menuItem: { style: { padding: { value: '12px 16px', }, }, }, }, }, small: { style: { fontSize: { value: '14px', }, }, elements: { menuItem: { style: { padding: { value: '8px 12px', }, }, }, }, }, }, }, }, } ```