Manage folders without leaving the page
Folder colors (organize by color)
What it is: Each folder can have an icon color so you can tell folders apart at a glance (e.g. "blue = client assets", "rose = urgent").
Presets: Six colors: Amber, Blue, Emerald, Violet, Rose, Slate. Choose from the folder's context menu (right-click the folder in the sidebar or in the grid) → "Icon color" → click a color dot to apply, or "Clear color" to remove.
Where it appears: The folder icon uses the selected color in both the sidebar (FolderTreeItem) and the grid (FolderCard). When no color is set, the icon uses the default muted style.
Persistence: The choice is stored in localStorage per folder ID (fleekdash_media_folder_color_<id>). A custom event (fleekdash:folder-color-changed) updates all folder instances on the page so the icon refreshes immediately. no page reload. Colors are local to your browser and device.
Benefit: Visually group or prioritize folders without changing names; instant feedback with zero page load.
Create
From sidebar: "Create folder" (or "New folder") opens CreateFolderDialog. Enter name and optionally select a parent folder. Confirm → API creates the folder and the tree refetches.
From grid/context menu: Right-click empty space (or use a context option) and choose "Create folder". The dialog can open with the current folder as parent so the new folder appears inside it.
API: wordpressMediaAPI.createFolder(name, parent) (parent 0 = root).
Rename
From the sidebar (FolderTreeItem) or from a folder card in the grid, use the rename action (e.g. pencil icon or context menu). Enter the new name; on save, wordpressMediaAPI.updateFolder(id, { name }) is called and the tree/grid refresh.
Benefit: Keep folder names clear without leaving the Media page.
Delete
Sidebar or grid: Delete action (or context menu "Delete folder"). API: wordpressMediaAPI.deleteFolder(id). The folder is removed from the tree; media that was in it may move to "unsorted" or stay associated depending on backend behavior.
Benefit: Remove empty or obsolete folders in one click.
Move (reparent)
Drag a folder in the sidebar and drop it on "All Media" to move it to root (parent 0). Drop it on another folder to make it a subfolder of that folder. API: wordpressMediaAPI.updateFolder(id, { parent: targetParentId }).
Context menu: "Move to root" (or similar) moves the folder to root without dragging.
Benefit: Reorganize the tree by drag-and-drop or a single action.