Favourites Panel
May 22, 2026 Β· View on GitHub
π This document is in English. δΈζηζ¬: readme_zh.md.
Favourites Panel β Trilium Favourites Management
Overview
Trilium has a built-in bookmark system, but there's no visual panel to browse all bookmarked/favourited notes at a glance. Manually navigating through the note tree to find favourited notes is tedious.
This plugin adds a Favourites Panel to Trilium's frontend showcase page. It collects notes with a configurable label (default #favourite) and displays them as a card grid view, with the following features:
- Card Layout β Each note is shown as a card with title (bold), description (blockquote), and tags (pills)
- Advanced Tag Filter β Two-level tag selection: click tag name to filter by that label (any value), or click tag value for exact match. Selected tags shown in a removable bar
- Text Search β Combined with tag filters, searched on backend with pagination
- Pagination β Page size selector (25/50/100/200), prev/next navigation
- Tags Scoped to Collection β Only tags from notes within the current
#favLabelcollection are shown - Custom Icon β Card title icon uses the note's own
#iconClass(Box Icons), defaults tobx bx-note - Color Accent β Cards with a
#colorlabel use that color for the border and title text - Responsive Grid β Cards auto-arrange and wrap based on page width
- Theme Aware β Styling follows Trilium's theme using CSS variables

Installation
Option 1: Manual File Copy
- Open the note
nlKR1j0QzfmS(Frontend Showcase) in Trilium - Create the following structure under that note:
Favourites Panel (render type)
βββ ~renderNote β html (code, mime: text/html)
βββ js (code, mime: application/javascript;env=frontend)
- Copy the contents of
html樑ζΏ.htmlinto the html note - Copy the contents of
jsι»θΎ.jsinto the js note - Set the
~renderNoterelation on the Favourites Panel note pointing to the html note - (Optional) Add relevant promoted attributes (see Configuration below)
Option 2: Import Archive
Download the latest archive from the Releases page and import it directly into Trilium via the Import function.
Configuration (Promoted Attributes)
The panel reads its configuration from promoted attributes on the render note itself. Edit them in the note's attribute panel (labeled fields will appear automatically).
| Attribute | Description | Default |
|---|---|---|
#favLabel | The label to search for | favourite |
#favDescLines | Number of description lines to show | 3 |
#favInheritColor | Whether to use inherited #color labels | false |
You can clone this panel and give each clone a different #favLabel to create multiple categorised collections (e.g. #bookmark, #readlater, #project).
Development Overview
APIs Used
| API | Purpose |
|---|---|
api.searchForNotes("#favourite") | Search all notes with the configured label |
api.runOnBackend(callback, args) | Execute backend code (config reading, tag loading, paginated search) |
api.sql.getRows(query, params) | SQL query for loading tags scoped to the collection |
note.getAttributes() | Get all labels of a note (on backend) |
note.getContent() | Get note HTML content for description |
api.activateNote(noteId) | Navigate to a note on card click |
api.getNote(noteId) | Get a note by ID (on backend) |
note.getParentNotes() | Traverse up the note tree to find the render note |
getComputedStyle(document.documentElement) | Read Trilium theme CSS variables for theming |
Implementation Details
-
Config Reading: The JS code traverses the note tree from itself upward:
api.currentNote (JS code) β parent (HTML template) β parent (render note). The promoted attributes (favLabel,favDescLines,favInheritColor) are read from the render note usingapi.runOnBackendto ensure reliable access. -
Tag Loading: All tags from notes within the current
#favLabelcollection are loaded via a backend SQL query with a subquery filter. System labels (color,iconClass,archived,docName,customResourceProvider, etc.) and the configuredfavLabelitself are excluded from the tag list. -
Two-Level Tag Filter: Each tag chip has two clickable areas:
- Tag name: Filters by that label name, showing notes with any value for that label
- Tag value (if present): Filters by exact label + value match Both can be combined. Active filters are displayed in a removable bar above the tags.
-
Search Execution: Combines
#favLabel+ text query + selected tag filters into a Trilium search query string, then executes on the backend with pagination. Results include tags, iconClass, color, and description (HTML stripped via regex, no DOM needed on backend). -
Card Icons: Iterates the note's own labels to find
iconClass. If present, renders an<i>element with the Box Icons class; otherwise defaults tobx bx-note. -
Card Colors: By default uses only the note's own
#colorlabel (fromgetAttributes()on backend, filtering by own noteId). SetfavInheritColor = trueto use inherited color viagetLabelValue('color'). -
Pagination: The backend returns sliced results with total count. Page size can be changed via dropdown (25/50/100/200). The
<select>element explicitly reads--main-text-colorand--main-background-colorCSS variables for proper theme integration.
Plugin Structure
This plugin follows the standard Trilium frontend render note pattern:
nlKR1j0QzfmS (Frontend Showcase)
βββ 1Mn93zMdll8N ζΆθε€Ήι’ζΏ (render)
βββ ~renderNote
βββ ZwetGOsxjRRi html (code, mime: text/html)
βββ PaGSIRd20Aup js (code, mime: application/javascript;env=frontend)