Views
File browser view modes — alternate presentations of the same directory listing (grid, details, tree, …). Each provider supplies a Svelte component that receives FileBrowserViewProps (including pane context — see sdk/pane-context.stub.d.ts for the type-only stub authors use, and sdk/plugin-types.generated.d.ts for full props).
Types: FileBrowserViewProvider
Related: Command · Plugin API
Shape
| Field | Role |
|---|---|
id | Stable mode id stored as the pane’s viewMode. |
name | Human-readable label. |
icon | Iconify id for menus and view switcher. |
component | Svelte component with FileBrowserViewProps. |
columns? | Optional ViewColumnDefinition[] for custom sortable columns. |
collectionOnly? | When true, hide this view outside collection (vial) contexts. |
Host behavior
On plugin activation, the host registers FileBrowserViewProvider entries with the view registry and refreshes view-related commands so the view switcher stays in sync. Prefer declaring the view icon on PhialsPlugin.icons if you rely on icon preload.
Minimal snippet
import MyView from "./MyView.svelte";
const myView: FileBrowserViewProvider = {
type: "view",
id: "my-view",
name: "My view",
icon: "mdi:view-dashboard",
component: MyView,
};
export default function createPlugin(): PhialsPlugin {
return {
id: "vendor.view.my-view",
name: "My View",
version: "1.0.0",
icons: [myView.icon],
providers: [myView],
};
}Pitfalls
- Late registration: If you add views dynamically after startup, ensure your target Phials build refreshes view commands (or ship a companion
CommandProvider) so UI lists stay consistent. - Fallback mode: If the saved
viewModeis unavailable, the host picks another available mode (often a simple list/details style).