@aswin.dev/media-library

Media library management for Templatical email editor
3,262 528
Install
npm install @aswin.dev/media-library
Latest Version:0.9.5
Vue:3
License:Custom
Last Updated:Oct 26, 2026
Links: GitHub  ·  npm
Maintainer: aswin.dev

@aswin.dev/media-library

Media library for Templatical — composable, Vue components, and a standalone visual SDK.

npm version License

Browse, upload, organize, crop, and replace media assets. Used by @aswin.dev/editor's Cloud build, and available as a standalone SDK for any app that needs a media manager.

Install

npm install @aswin.dev/media-library

Peer deps: vue@^3.5, tailwindcss@^4.

Authentication. The media library connects to Templatical Cloud and authenticates against your backend. Your server exposes a token endpoint (returning a short-lived JWT for the current user/project), and you pass that endpoint URL as auth.url. See the authentication guide for the full setup.

Usage

Standalone visual SDK (mount anywhere)

import { init } from '@aswin.dev/media-library';
import '@aswin.dev/media-library/style.css';

const media = await init({
  container: '#media',
  auth: {
    url: 'https://your-app.com/api/templatical/token',
  },
  onSelect(item) {
    console.log('Picked:', item.url);
  },
});

// Later
media.unmount();

Vue component

Use MediaLibraryModal inside a Vue 3 app. See docs for the full prop reference.

import { MediaLibraryModal } from '@aswin.dev/media-library';
import '@aswin.dev/media-library/style.css';

Composable (build your own UI)

import { AuthManager } from '@aswin.dev/core/cloud';
import { useMediaLibrary } from '@aswin.dev/media-library';

const authManager = new AuthManager({
  url: 'https://your-app.com/api/templatical/token',
});
await authManager.initialize();

const lib = useMediaLibrary({
  projectId: authManager.projectId,
  authManager,
});

API client (low-level)

import { AuthManager } from '@aswin.dev/core/cloud';
import { MediaApiClient } from '@aswin.dev/media-library';

const api = new MediaApiClient(authManager);
const response = await api.browseMedia({ folder_id: null });

Exports

  • Standalone SDK — init(), unmount()
  • Vue components — MediaLibraryModal + 12 sub-components (grid, upload zone, folder tree, preview panel, edit/replace/import modals)
  • Composables — useMediaLibrary, useMediaCategories, useMediaPicker, useI18n
  • API client — MediaApiClient
  • Types — MediaItem, MediaFolder, MediaCategory, MediaConversion, MediaBrowseParams/Response, MediaUsageInfo/Response, MediaConfig, etc.

Documentation

Full reference at docs.templatical.com.

License

FSL-1.1-MIT — free for any non-competing commercial use, automatically converts to MIT after 2 years per release.

Related Packages

@templatical/media-library

Media library management for Templatical email editor

87,203 527
@canopassoftware/vue-file-upload

Show the preview of file and manage files data to upload

9,638 40
@modufolio/media

Media-library UI for Appkit portfolio sites — album sidebar, media grid, inspect...

494 0
@templatical/editor

Vue 3 visual drag-and-drop email editor powered by Templatical

160,149 527

Version History

Version Released Vue License
0.9.5 ^3.5.0 Custom
0.9.4 ^3.5.0 Custom
0.9.3 ^3.5.0 Custom
0.9.1 ^3.5.0 Custom
0.9.0 ^3.5.0 Custom