Interactive Demo

How to use: Hover over a folder to reveal more tabs beneath β†’ Click a folder to open it β†’ Drag items between "Selected" and "All Items" panels to organise content

Component Features

πŸ—‚οΈ 3D Filing Cabinet

Folders stacked with subtle 3D transforms and depth effects, like a physical filing cabinet drawer.

🎨 Colour-Coded Folders

Each folder has a vibrant colour with visible body and protruding tab for easy identification.

πŸ“‘ Staggered Tabs

Folder tabs positioned in left-center-right pattern for easy access, like real filing folders.

πŸ‘οΈ Hover Animation

Hovering over a folder drops folders beneath to reveal more tabs with smooth animation.

πŸ”„ Drag & Drop

Native HTML5 drag-and-drop between two panels for organising content items.

πŸ’¬ Smart Tooltips

Tooltips appear below tabs in the revealed space, showing folder name and item count.

πŸ’Ύ Database Integration

Neon PostgreSQL with graceful fallback to constants when DB unavailable.

β™Ώ Accessible

ARIA labels, keyboard navigation, focus management, reduced motion support.

πŸ“± Responsive

Mobile-friendly layout adapts to all screen sizes automatically.

πŸ”’ Secure

HTML sanitization with DOMPurify prevents XSS attacks.

πŸ“¦ Self-Contained

Copy-paste ready with all styles scoped. Zero external dependencies.

Usage Example

<script>
  import FolderFiles from '$lib/components/FolderFiles.svelte';

  let { data } = $props();
</script>

<FolderFiles
  folders={data.folders}
  files={data.files}
/>

Props

PropTypeDefaultDescription
foldersFolder[][]Array of folder objects with id, label, color
filesFileItem[][]Array of file items with title, subtitle, previewText

Data Structure

Folder Interface

interface Folder {
  id: number;
  label: string;              // Display name
  color: string;              // Tailwind class (e.g., 'bg-blue-500')
  textColor?: string;         // Tailwind class (e.g., 'text-white')
  icon?: string;              // Emoji or character
  description?: string;       // For tooltip
  category?: string;          // For filtering
}

FileItem Interface

interface FileItem {
  id: number;
  folderId: number;           // Parent folder ID
  title: string;
  subtitle?: string;
  previewText: string;        // Brief description
}

Implementation Tips

🎨 Folder Colours

Use hex colour codes for folders (e.g., #a855f7). The component applies these colours to both the folder tab and body with automatic depth shading.

πŸ“‘ Tab Positioning

Tabs automatically stagger left-center-right using modulo pattern. First folder left, second center-left, third center-right, then repeats.

πŸ—ƒοΈ Database Schema

Run database/schema_folderfiles.sql in Neon to create tables. Simple structure with folders and files tables linked by folderId.

πŸ”„ Fallback Data

Component works without database using FALLBACK_FOLDERS and FALLBACK_FILES from constants.ts.