Skip to main content

register

Used to register your widget. This is the main entry point to widgets.

This function expects a widget function that describes the widget and returns a Figma element (eg. one of the components AutoLayout, Frame, Text etc).

Signature

register(component: FunctionalWidget<any>): void

Remarks

The provided function will be called any time a widget is inserted and anytime the widget’s state is updated.

caution

The widget.register function should only be called once when the manifest.main file runs.

Usage Example

First widget
const { widget } = figma
const { Text } = widget

function MyFirstWidget() {
return <Text>Hello Widget</Text>
}

widget.register(MyFirstWidget)