Skip to content

How to add custom widget in apostrophecms page ? #3803

Answered by boutell
sarathcm asked this question in Q&A
Discussion options

You must be logged in to vote

It is true that there is not a specific example of using the new widget on this page:

https://v3.docs.apostrophecms.org/guide/custom-widgets.html

But it works like adding any other widget:

add: {
  body: {
    type: 'area',
    label: 'Body',
    options: {
      widgets: {
        'two-column': {}
      }
    }
  }
}

This would add the two-column-widget module defined in the documentation you mention to an area, for instance an area in the home page or default page, or a piece type, or even another widget.

The rule is that you take -widget off the module name when adding a widget to the widgets section of an area field.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sarathcm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants