Skip to content

Add side panel example#33

Merged
aklinker1 merged 3 commits intowxt-dev:mainfrom
Seismix:side-panel-example
Mar 17, 2026
Merged

Add side panel example#33
aklinker1 merged 3 commits intowxt-dev:mainfrom
Seismix:side-panel-example

Conversation

@Seismix
Copy link
Contributor

@Seismix Seismix commented Mar 10, 2026

Description

This PR adds the side-panel example, demonstrating how to use Firefox's sidebar_action and Chrome's sidePanel APIs in a WXT codebase.

For demo purposes it ports MDN's annotate-page example to WXT.

Screenshot

image

Checklist

  • Updated metadata.json (pnpm -w update-metadata)

Copy link
Member

@aklinker1 aklinker1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make the recommended changes before merging. Thanks for the PR!

Comment on lines +12 to +16
browser_action: {
default_icon: icons,
default_title: "Toggle Side Panel",
},
}),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you just use action here, it will be converted to browser_action when targetting MV2. Icons are also inherited from the extension icon.

Comment on lines +3 to +7
interface BrowserWithSidebar {
sidebarAction?: {
toggle(): Promise<void>;
};
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, you could augment the browser type: https://wxt.dev/guide/essentials/extension-apis.html#augmenting-the-browser-type

Just added the docs for this this morning.

Then we just do:

browser.sidebarAction?.onClicked.addListener(() => ...)

@aklinker1 aklinker1 merged commit 1ee8275 into wxt-dev:main Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants