For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Resources
Get started
ReferenceGuidesExamplesChangelog
ReferenceGuidesExamplesChangelog
  • Designer API
    • Introduction
    • Getting Started
    • Webflow CLI
    • Error Handling
    • App Modes
  • Elements
    • Creating & Retrieving Elements
    • Element Properties & Methods
    • Element Types & Methods
  • Styles
    • Managing Style Properties
    • Managing Variable Modes
  • Components
      • Get all components
      • Get component by name
      • Get component by ID
      • Search for components
      • Get the selected component
      • Get all variants of a component
      • Get selected variant
      • Get a variant by ID
      • Create a variant
      • Set variant settings
      • Reorder variants
      • Delete a variant
      • Get component instance count
      • Create a component
      • Delete a component
  • Variables & Collections
    • Variable Collections
    • Variables
    • Variable Modes
  • Assets
  • Pages & Folders
  • Utilities
    • User Events & Notifications
    • App Intents & Connections
  • Additional Resources
    • API Playground
    • FAQs
LogoLogo
Resources
Get started
On this page
  • component.deleteVariant(options)
  • Syntax
  • Parameters
  • Returns
  • Example
  • Designer Ability
ComponentsCreating & Retrieving Components

Delete a variant (Beta)

Was this page helpful?
Previous

Get component instance count

Next
Built with

component.deleteVariant(options)

Deletes a variant from a component by ID.

You cannot delete the base variant.

Beta

These methods are in public beta and may change with future releases.

Syntax

1component.deleteVariant(options: DeleteVariantOptions): Promise<void>

Related interfaces:

1interface DeleteVariantById {
2 id: string;
3}
4
5type DeleteVariantOptions = DeleteVariantById;

Parameters

  • options: DeleteVariantOptions — An object specifying the variant to delete:

    • id: string — The ID of the variant to delete.

Returns

Promise<void>

A Promise that resolves when the variant is deleted.

Example

1const component = await webflow.getCurrentComponent()
2
3if (component) {
4 await component.deleteVariant({ id: 'variant-456' })
5}

Try this example

Designer Ability

Designer AbilityPermissionLocaleBranchWorkflowSitemode
canModifyComponentsanyanyanyCanvasDesign