Get a prop by name (Beta)

component.getPropByName(name)

Returns a single prop definition by its display name, or by its group and display name.

Use this method when you know a prop’s human-readable name but not its ID. To look up a prop by its ID, use component.getProp(). 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

component.getPropByName(name: string): Promise<Prop>
component.getPropByName(groupName: string, name: string): Promise<Prop>

When called with one argument, the method searches all groups, including ungrouped props. When called with two arguments, the method matches props in the specified group only.

Parameters

  • name : string — The display name of the prop to retrieve.
  • groupName : string — (optional) The name of the group the prop belongs to. When provided, the method searches only within that group.

Returns

Promise<Prop>

A Promise that resolves to the matching Prop object.

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

interface Prop {
/** Unique prop ID. */
id: string;
/** The prop type. */
type: PropType;
/** The binding value type, derived from the prop type. */
valueType: BindableValueType;
/** Value types that this prop can bind to. */
bindableTo: readonly BindableValueType[];
/** Display name. */
name: string;
/** Group name, or null if ungrouped. */
group: string | null;
/** Tooltip text, or null if not set. */
tooltip: string | null;
/** Default value, or null if not set. */
defaultValue: unknown | null;
// Type-specific settings, included when applicable:
multiline?: boolean; // textContent
min?: number; // number
max?: number; // number
decimals?: number; // number
trueLabel?: string; // boolean
falseLabel?: string; // boolean
}

Examples

Look up a prop by name across all groups:

const component = await webflow.getCurrentComponent()
if (component) {
const prop = await component.getPropByName('CTA Link')
console.log(prop)
/*
{
id: 'prop_4',
type: 'link',
valueType: 'link',
bindableTo: ['link'],
name: 'CTA Link',
group: 'Content',
tooltip: null,
defaultValue: {
mode: 'url',
to: 'https://example.com/signup',
openInNewTab: true
}
}
*/
}

Look up a prop by group and name:

const component = await webflow.getCurrentComponent()
if (component) {
const prop = await component.getPropByName('Settings', 'Overlay Opacity')
console.log(prop)
/*
{
id: 'prop_5',
type: 'number',
valueType: 'number',
bindableTo: ['number', 'string', 'textContent', 'altText', 'id'],
name: 'Overlay Opacity',
group: 'Settings',
tooltip: null,
defaultValue: 50,
min: 0,
max: 100,
decimals: 0
}
*/
}

Look up an ungrouped prop by name:

const component = await webflow.getCurrentComponent()
if (component) {
const prop = await component.getPropByName('Color Scheme')
console.log(prop.group) // null
}

Designer Ability

Checks for authorization only.

Designer AbilityLocaleBranchWorkflowSitemode
canAccessCanvasAnyAnyAnyAny