Set prop settings (Beta)

component.setProp(propId, updates)

Updates one or more settings on an existing prop.

Only the settings that you pass to this method change. This method returns the full updated Prop object, not only properties that changed.

To clear a setting, pass undefined as its new value.

This action is undoable in the Webflow Designer.

A prop’s type cannot be changed after creation. Passing a type field returns an error.

Beta

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

Syntax

1component.setProp(propId: string, updates: SetPropOptions): Promise<Prop>
2component.setProp(updates: SetPropOptionsWithId): Promise<Prop>

Parameters

The method accepts two call signatures: an ID string plus an updates object or a single object that includes the id field.

SetPropOptions — all fields are optional:

1interface SetPropOptions {
2 /** Update the display name. */
3 name?: string;
4 /** Move to a different group, or null to ungroup. */
5 group?: string | null;
6 /** Update the tooltip, or null to remove it. */
7 tooltip?: string | null;
8 /**
9 * Update the default value. Shape must match the prop's type.
10 * Pass null to clear the default value.
11 */
12 defaultValue?: PropDefaultValue;
13
14 // Type-specific settings (only valid for the matching prop type):
15 multiline?: boolean; // textContent only
16 min?: number | null; // number only
17 max?: number | null; // number only
18 decimals?: number | null; // number only
19 trueLabel?: string | null; // boolean only
20 falseLabel?: string | null; // boolean only
21}
22
23interface SetPropOptionsWithId extends SetPropOptions {
24 /** The ID of the prop to update. */
25 id: string;
26}
  • propId : string — The unique ID of the prop to update (first-argument signature only).
  • updates.name : string — (optional) The new display name. If a prop with the same name already exists in the same group, the name is automatically incremented (for example, Heading becomes Heading 2).
  • updates.group : string | null — (optional) Move the prop to a different group, or pass null to remove it from its group.
  • updates.tooltip : string | null — (optional) New tooltip text, or null to remove the tooltip.
  • updates.defaultValue : varies by type — (optional) New default value. The shape must match the prop’s type. Pass null to clear the default value.
  • updates.multiline : boolean — ('textContent' only, optional) Whether the text input supports multiple lines.
  • updates.min : number | null — ('number' only, optional) Minimum allowed value. Pass null to remove the constraint.
  • updates.max : number | null — ('number' only, optional) Maximum allowed value. Pass null to remove the constraint.
  • updates.decimals : number | null — ('number' only, optional) Number of decimal places allowed. Pass null to remove the constraint.
  • updates.trueLabel : string | null — ('boolean' only, optional) Label shown when the value is true. Pass null to remove the label.
  • updates.falseLabel : string | null — ('boolean' only, optional) Label shown when the value is false. Pass null to remove the label.

Returns

Promise<Prop>

A Promise that resolves to the full updated Prop object after the update is applied.

The Prop interface uses the same shape as the return value of component.createProp():

1interface Prop {
2 /** Unique prop ID. */
3 id: string;
4 /** The prop type. */
5 type: PropType;
6 /** The binding value type, derived from the prop type. */
7 valueType: BindableValueType;
8 /** Value types that this prop can bind to. */
9 bindableTo: readonly BindableValueType[];
10 /** Display name (may be auto-incremented if there was a name conflict). */
11 name: string;
12 /** Group name, or null if ungrouped. */
13 group: string | null;
14 /** Tooltip text, or null if not set. */
15 tooltip: string | null;
16 /** Default value, or null if not set. */
17 defaultValue: unknown | null;
18 // Type-specific settings, included when applicable:
19 multiline?: boolean; // textContent
20 min?: number; // number
21 max?: number; // number
22 decimals?: number; // number
23 trueLabel?: string; // boolean
24 falseLabel?: string; // boolean
25}

Examples

Update the default value of a link prop:

1const component = await webflow.getCurrentComponent()
2
3if (component) {
4 const prop = await component.getProp('prop_123')
5
6 const updated = await component.setProp(prop.id, {
7 defaultValue: {
8 ...prop.defaultValue,
9 rel: 'preload',
10 },
11 })
12 console.log(updated.defaultValue)
13 /*
14 {
15 mode: 'url',
16 to: 'https://example.com/signup',
17 openInNewTab: true,
18 rel: 'preload'
19 }
20 */
21}

Update a prop name and tooltip using the object-with-ID signature:

1const component = await webflow.getCurrentComponent()
2
3if (component) {
4 const updated = await component.setProp({
5 id: 'prop_456',
6 name: 'Hero Heading',
7 tooltip: 'The main headline for the hero section',
8 })
9 console.log(updated.name) // 'Hero Heading'
10 console.log(updated.tooltip) // 'The main headline for the hero section'
11}

Update number constraints:

1const component = await webflow.getCurrentComponent()
2
3if (component) {
4 const updated = await component.setProp('prop_789', {
5 min: 0,
6 max: 200,
7 decimals: 2,
8 defaultValue: 75.5,
9 })
10 console.log(updated)
11 /*
12 {
13 id: 'prop_789',
14 type: 'number',
15 valueType: 'number',
16 bindableTo: ['number', 'string', 'textContent', 'altText', 'id'],
17 name: 'Overlay Opacity',
18 group: 'Settings',
19 tooltip: null,
20 defaultValue: 75.5,
21 min: 0,
22 max: 200,
23 decimals: 2
24 }
25 */
26}

Move a prop to a different group:

1const component = await webflow.getCurrentComponent()
2
3if (component) {
4 const updated = await component.setProp('prop_456', { group: 'Layout' })
5 console.log(updated.group) // 'Layout'
6}

Remove a prop from its group:

1const component = await webflow.getCurrentComponent()
2
3if (component) {
4 const updated = await component.setProp('prop_456', { group: null })
5 console.log(updated.group) // null
6}

Remove a tooltip:

1const component = await webflow.getCurrentComponent()
2
3if (component) {
4 const updated = await component.setProp('prop_456', { tooltip: null })
5 console.log(updated.tooltip) // null
6}

Designer Ability

Designer AbilityPermissionLocaleBranchWorkflowSitemode
canModifyComponentsanyanyanyCanvasDesign