Skip to content

docs: add comprehensive sidebar components guide#1512

Open
rafaumeu wants to merge 3 commits into
mattermost:masterfrom
rafaumeu:docs/sidebar-components
Open

docs: add comprehensive sidebar components guide#1512
rafaumeu wants to merge 3 commits into
mattermost:masterfrom
rafaumeu:docs/sidebar-components

Conversation

@rafaumeu

Copy link
Copy Markdown

What kind of change does this PR introduce?

Documentation enhancement.

Closes #1352

What is the current behavior?

Developers struggle to understand how to register plugins in the Mattermost webapp sidebar. The existing documentation mentions sidebar components in best practices but lacks:

  • Step-by-step implementation instructions
  • Complete code examples
  • Explanation of different sidebar component types
  • Guidance on dynamic badge updates
  • Troubleshooting information

What is the new behavior?

Added a comprehensive new guide at /integrate/plugins/components/webapp/sidebar-components that covers:

Left Sidebar Header Component

  • When to use (team-specific actions like Trello kanban boards, GitHub repos)
  • Step-by-step registration with complete code examples
  • Full working example for GitHub dashboard plugin

Bottom Team Sidebar Component

  • When to use (status badges, quick links, Jira ticket counts)
  • Registration API documentation
  • Dynamic badge update pattern with Redux store integration
  • Complete GitHub PR badge example with polling

App Bar Component (Experimental)

  • Feature availability check pattern
  • When to use (global platform features)
  • Configuration requirements (Apps Bar experimental setting)
  • Complete example from customer plugin

Additional content

  • SiteURL configuration for asset loading
  • Redux store integration patterns
  • Combining multiple sidebar components in one plugin
  • 6 best practices covering UX, performance, and accessibility
  • Troubleshooting guide for common issues
  • Related documentation links
  • 2 real-world plugin examples

Key improvements

  • 459 lines of detailed documentation with 15+ code examples
  • Real-world integration patterns from actual Mattermost plugins
  • Clear "When to use" guidance for each component type
  • Dynamic badge updates with working store subscription pattern
  • TypeScript and JavaScript examples
  • Links to related forum discussions and plugin examples

How to test

  1. Build the documentation site locally
  2. Navigate to the sidebar components guide
  3. Verify all code examples compile correctly
  4. Check that internal links resolve properly
  5. Confirm that external links to GitHub examples work

Additional context

This documentation directly addresses the issue raised by the Parabol integration where clearer guidance was needed for sidebar plugin registration. The guide provides explicit examples and reference links as requested in #1352.

The content follows Mattermost documentation patterns with:

  • Frontmatter for Hugo
  • Shortcodes for notes and warnings
  • Internal link references using {{< ref ... >}}
  • Code syntax highlighting

rafaumeu added 2 commits June 16, 2026 19:08
Closes mattermost#1352

Added comprehensive documentation for registering plugins in the Mattermost
webapp sidebar including:

- Left sidebar header components for team-specific actions
- Bottom team sidebar components for status badges and quick links
- App bar components (experimental) for global access
- Step-by-step code examples with Redux integration
- Dynamic badge update patterns
- Troubleshooting guide and best practices
- Related documentation and example links

Provides clear, actionable guidance with multiple complete examples
for developers integrating their plugins into the Mattermost UI.
@mattermost-build

Copy link
Copy Markdown
Contributor

Hello @rafaumeu,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@rafaumeu, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 7 minutes and 35 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9b7073b4-77c9-43df-a237-594c412e07e8

📥 Commits

Reviewing files that changed from the base of the PR and between 88b3f8e and 3ed50c7.

📒 Files selected for processing (2)
  • site/content/integrate/plugins/components/webapp/sidebar-components.md
  • site/static/js/main.js
📝 Walkthrough

Walkthrough

Adds a new documentation page (sidebar-components.md) covering webapp sidebar plugin integration points — left sidebar header, bottom team sidebar, and experimental app bar — with registration examples, Redux store usage, asset URL helpers, and troubleshooting. Separately, adds a resize event handler to main.js to auto-close the mobile navigation menu when the viewport exceeds 767px.

Changes

Sidebar Plugin Integration Documentation

Layer / File(s) Summary
Page metadata, intro, and left sidebar header component
site/content/integrate/plugins/components/webapp/sidebar-components.md
Defines frontmatter (title, weight, aliases), introduces the three sidebar component types with prerequisites, and documents the left sidebar header registration API with a full code example and team-visibility note.
Bottom team sidebar and experimental app bar components
site/content/integrate/plugins/components/webapp/sidebar-components.md
Adds the bottom team sidebar section with dynamic badge update guidance via store subscriptions, and the experimental app bar section with conditional availability checks, icon URL construction, and a TypeScript example.
Asset URLs, Redux store usage, and multi-component registration
site/content/integrate/plugins/components/webapp/sidebar-components.md
Documents how to build plugin asset URLs using SiteURL, how to dispatch actions and subscribe to store state inside sidebar components, and shows a complete initialize example registering all three component types.
Best practices, troubleshooting, and related links
site/content/integrate/plugins/components/webapp/sidebar-components.md
Adds best practices and per-symptom troubleshooting checklists (missing component, non-updating badge, icon not displaying) followed by related docs links and two example plugin repositories.

Mobile Navigation Resize Fix

Layer / File(s) Summary
Mobile nav resize close handler
site/static/js/main.js
Adds a resize event listener that strips is-active from the hamburger element and removes nav-open/active classes from document.body and #navigation when the viewport width exceeds 767px.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes a viewport resize event handler in site/static/js/main.js that is unrelated to the sidebar components documentation objective specified in issue #1352. Remove the JavaScript changes from this PR or create a separate PR for the responsive navigation improvements, keeping this PR focused solely on sidebar components documentation.
Linked Issues check ❓ Inconclusive The PR adds documentation for sidebar components but also includes unrelated changes to site/static/js/main.js (viewport resize handler) that appear out of scope for the linked issue. Clarify whether the JavaScript viewport resize handler changes are intentional or should be separated into a different PR focused on responsive navigation improvements.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'docs: add comprehensive sidebar components guide' accurately reflects the main change—adding comprehensive documentation for Mattermost sidebar components.
Description check ✅ Passed The description is directly related to the changeset, providing detailed context about the new sidebar components documentation and addressing the gap identified in issue #1352.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
site/content/integrate/plugins/components/webapp/sidebar-components.md (2)

25-25: ⚡ Quick win

Use hyphenated compound adjectives before nouns.

Lines 25 and 108 should use "lower-left corner" instead of "lower left corner" when the phrase appears as a compound adjective modifying the noun. Hyphenation improves readability and follows standard English conventions.

Proposed fix
- 3. **App Bar Component** (experimental) - Appears in the global apps bar at the top of the sidebar (requires [Apps Bar]({{< ref "/integrate/plugins/components/webapp/app-bar" >}}) to be enabled)
+ 3. **App Bar Component** (experimental) - Appears in the global apps bar at the top of the sidebar (requires [Apps Bar]({{< ref "/integrate/plugins/components/webapp/app-bar" >}}) to be enabled)

For line 25:

- 1. **Left Sidebar Header Component** - Appears above the channel list in a team, ideal for team-specific actions
+ 1. **Left Sidebar Header Component** - Appears above the channel list in a team, ideal for team-specific actions

For line 108:

- The bottom team sidebar component adds icons to the lower left corner of the UI. This is ideal for displaying status indicators or providing quick access to key features that users can access from anywhere in the team.
+ The bottom team sidebar component adds icons to the lower-left corner of the UI. This is ideal for displaying status indicators or providing quick access to key features that users can access from anywhere in the team.

Also applies to: 108-108

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@site/content/integrate/plugins/components/webapp/sidebar-components.md` at
line 25, Compound adjectives that appear before nouns should be hyphenated to
follow standard English grammar conventions. In the sidebar-components.md file,
locate the phrase "lower left corner" which appears in the context of describing
the Bottom Team Sidebar Component and change it to "lower-left corner".
Additionally, find and apply the same fix to another instance of this phrase
elsewhere in the file (around line 108), ensuring both occurrences use the
hyphenated form "lower-left corner" instead of "lower left corner".

459-459: 💤 Low value

Ensure consistent hyphenation for compound terms.

Line 459 references "[Mattermost plugin todo]" as link text. In English, "to-do" (meaning task) is typically hyphenated. Consider updating the link text for consistency, although the URL itself (mattermost-plugin-todo) is correct.

Proposed fix
- - [Mattermost plugin todo](https://github.com/mattermost/mattermost-plugin-todo) - Example with sidebar components
+ - [Mattermost plugin to-do](https://github.com/mattermost/mattermost-plugin-todo) - Example with sidebar components
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@site/content/integrate/plugins/components/webapp/sidebar-components.md` at
line 459, Update the link text in the sidebar-components.md file to use proper
hyphenation for the compound term. In the markdown link text that currently
reads "Mattermost plugin todo", change "todo" to "to-do" so the link text
becomes "Mattermost plugin to-do" while keeping the URL itself unchanged as
mattermost-plugin-todo. This ensures consistency with standard English
hyphenation conventions for the word "to-do".
site/static/js/main.js (1)

81-87: ⚡ Quick win

Consider debouncing the resize event handler for better performance.

Resize events fire continuously during window resizing, potentially dozens of times per second. While the current class removal operations are lightweight, debouncing the handler (e.g., waiting 150–200ms after resize stops) would reduce unnecessary DOM manipulations and improve performance, especially on lower-end devices.

⚡ Suggested debounce implementation
+ let resizeTimer;
  window.addEventListener("resize", function () {
+   clearTimeout(resizeTimer);
+   resizeTimer = setTimeout(function() {
      if (window.innerWidth > 767) {
        hamburger.classList.remove("is-active");
        document.body.classList.remove("nav-open");
        document.getElementById("navigation").classList.remove("active");
      }
+   }, 150);
  });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@site/static/js/main.js` around lines 81 - 87, The resize event listener fires
continuously during window resizing, causing unnecessary DOM manipulations that
impact performance. Implement a debouncing mechanism around the resize event
handler to ensure the class removal operations on hamburger, document.body, and
the navigation element only execute after the resize action has stopped
(typically after 150-200ms of inactivity). This can be achieved by creating a
debounce utility function or using a flag-based approach with setTimeout to
delay and cancel repeated executions of the handler logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@site/static/js/main.js`:
- Around line 80-87: The resize event listener has a breakpoint mismatch where
it closes the mobile menu at window.innerWidth > 767, but the CSS hides the
hamburger icon at 992px, causing UX confusion in the 768–991px range. Change the
breakpoint condition from 767 to 991 (or 992) to align with the CSS media query.
Additionally, implement debouncing on the resize event handler by wrapping the
menu-closing logic (hamburger.classList.remove, document.body.classList.remove,
and document.getElementById("navigation").classList.remove calls) inside a
setTimeout within a clearTimeout pattern to prevent excessive firing during
viewport resizing and improve performance.

---

Nitpick comments:
In `@site/content/integrate/plugins/components/webapp/sidebar-components.md`:
- Line 25: Compound adjectives that appear before nouns should be hyphenated to
follow standard English grammar conventions. In the sidebar-components.md file,
locate the phrase "lower left corner" which appears in the context of describing
the Bottom Team Sidebar Component and change it to "lower-left corner".
Additionally, find and apply the same fix to another instance of this phrase
elsewhere in the file (around line 108), ensuring both occurrences use the
hyphenated form "lower-left corner" instead of "lower left corner".
- Line 459: Update the link text in the sidebar-components.md file to use proper
hyphenation for the compound term. In the markdown link text that currently
reads "Mattermost plugin todo", change "todo" to "to-do" so the link text
becomes "Mattermost plugin to-do" while keeping the URL itself unchanged as
mattermost-plugin-todo. This ensures consistency with standard English
hyphenation conventions for the word "to-do".

In `@site/static/js/main.js`:
- Around line 81-87: The resize event listener fires continuously during window
resizing, causing unnecessary DOM manipulations that impact performance.
Implement a debouncing mechanism around the resize event handler to ensure the
class removal operations on hamburger, document.body, and the navigation element
only execute after the resize action has stopped (typically after 150-200ms of
inactivity). This can be achieved by creating a debounce utility function or
using a flag-based approach with setTimeout to delay and cancel repeated
executions of the handler logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7bdd99af-35a4-4085-9042-10969471885d

📥 Commits

Reviewing files that changed from the base of the PR and between 078f70f and 88b3f8e.

📒 Files selected for processing (2)
  • site/content/integrate/plugins/components/webapp/sidebar-components.md
  • site/static/js/main.js

Comment thread site/static/js/main.js
- main.js: fix breakpoint from 767 to 991 to align with CSS media query
  (hamburger hidden at min-width: 992px)
- main.js: add debounce (150ms) to resize event handler
- sidebar-components.md: fix hyphenation 'lower-left corner' (2 occurrences)
- sidebar-components.md: fix hyphenation 'to-do' in link text
@rafaumeu

Copy link
Copy Markdown
Author

All checks passing (CodeRabbit approved, CLA authorized). Ready for merge.

@mattermost-build

Copy link
Copy Markdown
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance Documentation for Registering Plugins on the Mattermost Webapp Sidebar

2 participants