About widgets
Widgets#
Conversely to scripts, widgets do have some specific requirements in order to work. A widget must:
- Extend BasicWidget or one of it's subclasses.
- Create a new instance and assign it to
module.exports
. - Define a
parentWidget
member to determine where it should be displayed. - Define a
position
(integer) that determines the location via sort order. - Have a
#widget
attribute on the containing note. - Create, render, and return your element in the render function.
- For BasicWidget and NoteContextAwareWidget you should create
this.$widget
and render it indoRender()
. - For RightPanelWidget the
this.$widget
anddoRender()
are already handled and you should instead return the value indoRenderBody()
.
- For BasicWidget and NoteContextAwareWidget you should create
parentWidget#
left-pane
- This renders the widget on the left side of the screen where the note tree lives.center-pane
- This renders the widget in the center of the layout in the same location that notes and splits appear.note-detail-pane
- This renders the widget with the note in the center pane. This means it can appear multiple times with splits.right-pane
- This renders the widget to the right of any opened notes.
Tutorial#
For more information on building widgets, take a look at Widget Basics.