UI components
@synopackageland/ui is a Vue 3 component library that follows DSM 7 styling. The default native-go project uses it for a sidebar shell, a status page and a page per capability; those pages come from @synopackageland/sdk/vue in the SDK.
Set it up
Section titled “Set it up”synopkgland init -t native-go --ui plain my-plain-appThe default --ui vue project needs no flag. For an existing project, install both packages in frontend/ and commit the lockfile:
pnpm add --save-exact @synopackageland/ui @synopackageland/sdk --registry=https://registry.npmjs.orgpnpm install --frozen-lockfile then installs exactly that; the NAS never downloads npm packages (build bundles everything).
| Vue (default) | Plain (--ui plain) | |
|---|---|---|
| Source | frontend/src/ (Vue 3, Vite, TypeScript) | ui/app.js, ui/app.css |
| Build | pnpm run build in frontend/, started by synopkgland build | none |
| Files, jobs, delegate screens | included | not included |
Standalone login (--with login) | supported | refused by check and init |
| Components | @synopackageland/ui, @synopackageland/sdk/vue | write your own |
A window built with @synopackageland/ui opens in a DSM window; other frontends declare ui.launch themselves (see launch mode).
A plain app.js registers the window with window.DsmPackageApps[<package>].mount(root, ctx) and reads its package name from document.currentScript.
Mount inside a DSM window
Section titled “Mount inside a DSM window”Every DSM window shares one page with the desktop. Import the embedded theme instead of theme.css, wrap the app in AppRoot, and give each mounted app a unique idPrefix.
import { createApp } from 'vue'import App from './App.vue'import '@synopackageland/ui/themes/dsm7-embedded.css'
export function mount(root: HTMLElement, ctx: unknown) { const app = createApp(App, { ctx }) app.config.idPrefix = `my-package-${crypto.getRandomValues(new Uint32Array(4)).join('-')}` app.mount(root) return { unmount: () => app.unmount() }}Keep the generated mount registration in frontend/src/main.ts for the DSM window loader.
<script setup lang="ts">import { AppRoot, ConfigProvider } from '@synopackageland/ui'</script>
<template> <AppRoot modal-scope="app" style="height: 100%"> <ConfigProvider locale="en"> <!-- your pages --> </ConfigProvider> </AppRoot></template>AppRoot scopes the theme and sends dialogs, menus and toasts into itself, so they stay inside the window. modal-scope="app" (the default) blocks only your app; a full-page app may use modal-scope="document", never inside a DSM window. Give the root a bounded size such as height: 100%; do not import theme.css.
Layout
Section titled “Layout”<script setup lang="ts">import { AppLayout, AppSidebar, PageContent, PageHeader } from '@synopackageland/ui'</script>
<template> <AppLayout min-height="0" wide-layout="window"> <template #sidebar> <AppSidebar v-model="page" :groups="groups" /> </template> <PageContent> <PageHeader title="Status" description="MyApp" /> </PageContent> </AppLayout></template>AppLayout has sidebar, toolbar, default and footer slots. Keep wide-layout="window" in a DSM window, so a maximized window keeps its layout; wide-layout="web" is only for a full-page Portal app (see Application Portal). Below 600 px, navigation becomes a slide-out. The generated shell keeps every page mounted with v-show, so polling continues on hidden pages. PageContent surface="none" gives full-bleed content; PageContent and AppToolbar use 16 px page spacing in full-page layouts.
Page notes and header controls
Section titled “Page notes and header controls”PageInfo from @synopackageland/sdk/vue puts an information button beside the page title, before custom #meta content. Non-empty notes appear as a list; empty ones are omitted, and an empty list hides the button unless the default slot replaces it. The button uses the shell’s language and note count, and opens on click or keyboard focus; Escape closes it.
inline keeps the button at its declared position, also without AppShell; label overrides the accessible name. side and align pass through to InfoTip and default to bottom and start; a standalone page can provide PageInfoTarget and point it at its header.
PageHeader keeps its title and meta on one row; actions that do not fit move below it and align right, and a long title truncates with a title attribute holding the full text.
Components
Section titled “Components”Import from @synopackageland/ui only, never by file path.
| Component | Use |
|---|---|
AppRoot, ConfigProvider | App root, language |
AppLayout, AppSidebar, PageContent, PageHeader | Window layout |
Button, Input, Textarea, Select, Checkbox, Switch | Controls |
Form, FormItem, FormActions | Forms; labels stack below 520 px |
SettingsSection, Callout, EmptyState, LoadingArea, Progress | Settings, messages, states |
Dialog, ToastProvider, useToast | Dialogs and toasts; useToast needs a ToastProvider parent |
TreeView | Hierarchy with nodes, v-model, v-model:expanded, loadChildren |
DataGrid | Table with columns, rows, row-key, sorting, selectable, page-size and typed columns; truncated cells tooltip their text |
FilePicker | Files from the user’s computer |
Use library controls instead of native <select>, <input>, <label> or <a>. Icons come from @lucide/vue, which the project lists itself.
To discover props, slots and events, run from frontend/:
pnpm exec syno-pkg-land-ui catalogpnpm exec syno-pkg-land-ui describe ButtonPick NAS files
Section titled “Pick NAS files”NasPicker and FileBrowser come from @synopackageland/sdk/vue, not @synopackageland/ui. FileBrowser combines TreeView and DataGrid over the user’s File Station view; NasPicker puts it in a dialog.
<NasPicker v-model:open="open" :provider="provider" :locale="ctx.locale" mode="file" @selected="path = $event" />NasPicker prop or event | Meaning |
|---|---|
open (v-model:open) | Dialog visibility |
provider | From createNasProvider(ctx) in @synopackageland/sdk |
locale | ctx.locale |
mode | 'file' or 'folder' |
selected event | Emits the chosen path |
Picking a path grants nothing; the backend checks the session and permissions again. See Files.
Upload from the user’s computer
Section titled “Upload from the user’s computer”FilePicker returns browser File objects and does not know the NAS; the generated file browser limits uploads to one file of at most 16 GiB:
<FilePicker v-model="uploads" variant="compact" :max-files="1" :max-size="16 * 1024 ** 3" @rejected="onRejected" />FilePicker prop | Meaning |
|---|---|
v-model | Selected File[] |
accept, multiple, directory | What can be chosen |
maxFiles, maxSize | Count and size limits in bytes; a rejected file raises rejected with a reason of type, size, count or duplicate |
variant | 'dropzone' or 'compact' |
Theme and density
Section titled “Theme and density”Override tokens on your own app root, after the library stylesheet, with a selector that cannot match other apps. Set data-package on AppRoot.
[data-ui-app][data-package='my-package'] { --ui-primary: #0086e5;}Put data-ui-density="compact" on an element to tighten controls and spacing inside it. Keep your CSS out of cascade layers; for bare-element base rules, load dsm7-embedded-reset.css, then your CSS, then dsm7-embedded-theme.css (together they equal dsm7-embedded.css).
Languages
Section titled “Languages”The library translates its own text (file picker, dialog buttons, link annotations) in the nine app languages: en, zh-TW, zh-CN, ja, ko, de, fr, es and it. Set ConfigProvider locale from ctx.locale; uiLocale maps DSM codes such as cht. Your own text lives in frontend/src/i18n/<locale>.json, see Native apps.
Limits
Section titled “Limits”| Item | Limit |
|---|---|
| Browser upload through the file browser | 1 file, 16 GiB |
| Smallest DSM window | 700 px wide, set by the generated window |
| Overlays in a DSM window | App-local only; do not mix app-local and document-wide overlays |
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
| Dialog or menu appears outside the window | App is not inside AppRoot | Wrap the app in AppRoot |
| Margins and fonts look wrong | theme.css loaded instead of the embedded theme | Import themes/dsm7-embedded.css |
Build says node_modules is missing | build does not install packages | Run pnpm install in frontend/ |
Startup loading
Section titled “Startup loading”Render AppShell as soon as the entry gate passes and bind :loading="!ready". The sidebar and title appear while startup reads run; the page shows its loading area and actions wait.