Variant
Add a Variant property to your component for designers to choose from a predefined list of options.
Syntax
Prop Definition
Define the Variant prop in your Webflow code component with a name and list of options. Optionally, you can add a group, tooltip text, and a default value that matches one of the pre-defined options.
Properties
name
: The name for the property.group
: The group for this property. (optional)tooltip
: The tooltip for the property. (optional)options
: Array of available variant options.defaultValue
: Default selected option. (optional)
Example
MyComponent.webflow.tsx
Prop Value
The Variant prop provides a string value representing the selected option to your React component.
Properties
n/a
Webflow properties panel

Example
MyComponent.tsx
When to use
Use a Variant prop when you want designers to:
- Choose from predefined visual styles
- Switch between component variations / themes
- Control component appearance
Best practices
- Use clear, descriptive option names
- Provide a sensible default value
- Keep options list manageable