Get a prop (Beta)

component.getProp(propId)

Returns a single prop definition by its ID.

This method returns a prop definition: the schema for the prop including its type, name, group, and default value. Use this method when you already have a prop ID (for example, from a component.createProp() response) and need to look up its current definition without fetching all props. To retrieve all prop definitions on a component, use component.getProps().

Beta

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

Syntax

1component.getProp(propId: string): Promise<Prop>

Parameters

  • propId : string — The unique ID of the prop to retrieve.

Returns

Promise<Prop>

A Promise that resolves to the Prop object for the given ID.

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. */
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

Get a prop by its ID:

1const component = await webflow.getCurrentComponent()
2
3if (component) {
4 const prop = await component.getProp('abc_id123')
5 console.log(prop)
6 /*
7 {
8 id: 'abc_id123',
9 type: 'link',
10 valueType: 'link',
11 bindableTo: ['link'],
12 name: 'CTA Link',
13 group: 'Content',
14 tooltip: null,
15 defaultValue: {
16 mode: 'url',
17 to: 'https://example.com/signup',
18 openInNewTab: true
19 }
20 }
21 */
22}

Create a prop and then look it up by its ID:

1const component = await webflow.getCurrentComponent()
2
3if (component) {
4 const created = await component.createProp({
5 type: 'number',
6 name: 'Max Items',
7 min: 1,
8 max: 100,
9 defaultValue: 10,
10 })
11
12 // Later, fetch the current definition by ID
13 const prop = await component.getProp(created.id)
14 console.log(prop.name) // 'Max Items'
15}

Designer Ability

Checks for authorization only.

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny