Hiyve Components - v1.0.0
    Preparing search index...

    Props for the FileManager component.

    Requirement: Must be used inside a <FileCacheProvider> component (which itself must be inside a <HiyveProvider>) for automatic state management.

    When used inside FileCacheProvider:

    • Files, folders, loading states, and callbacks are handled automatically
    • Only onFileOpen is required to handle file selection
    • Override props (files, folders, etc.) can be provided to customize behavior

    When used standalone (without FileCacheProvider):

    • All data props (files, folders, currentPath, isLoading, userId) are required
    • All callbacks (onNavigate, onFileOpen, onRefresh) are required
    // Context-connected usage (recommended)
    import { HiyveProvider } from '@hiyve/react';
    import { FileManager, FileCacheProvider } from '@hiyve/react-collaboration';

    function App() {
    return (
    <HiyveProvider generateRoomToken={getToken}>
    <FileCacheProvider>
    <FileManager
    onFileOpen={(file) => console.log('Opened:', file.fileName)}
    showToolbar
    showBreadcrumbs
    />
    </FileCacheProvider>
    </HiyveProvider>
    );
    }
    // Filtered view (only shows specific types, flat view)
    <FileManager
    filterFileTypes={['whiteboard']}
    onFileOpen={handleOpenWhiteboard}
    onSwitchToTab={handleTabSwitch}
    />
    // Standalone usage with explicit state management
    <FileManager
    files={files}
    folders={folders}
    currentPath={currentPath}
    isLoading={isLoading}
    userId={userId}
    onNavigate={handleNavigate}
    onFileOpen={handleFileOpen}
    onRefresh={handleRefresh}
    />
    interface FileManagerProps {
        availableTabs?: string[];
        colors?: Partial<FileManagerColors>;
        columns?: FileListColumn[];
        currentPath?: string;
        currentUserId?: string;
        customAction?: CustomToolbarAction | null;
        customContextActions?: CustomContextAction[];
        customFilters?: CustomToolbarFilter[];
        customViewers?: Partial<Record<string, CustomViewerRenderer>>;
        defaultFilterChip?: string;
        defaultViewMode?: FileManagerViewMode;
        enableDragDrop?: boolean;
        enableMarkers?: boolean;
        enableMultiSelect?: boolean;
        enableRegions?: boolean;
        enableSmartOpening?: boolean;
        fieldFormatters?: Partial<
            Record<FileListColumn, (file: FileEntry) => string>,
        >;
        fileNameFormatter?: (file: FileEntry) => string;
        files?: FileEntry[];
        filterChipPriority?: ResourceType[];
        filterChips?: { label: string; types?: ResourceType[] }[];
        filterFileTypes?: ResourceType[];
        folders?: FolderEntry[];
        getCommentCount?: (file: FileEntry) => number;
        icons?: Partial<FileManagerIcons>;
        isDownloading?: boolean;
        isLoading?: boolean;
        isRefreshing?: boolean;
        isRoomOwner?: boolean;
        isUploading?: boolean;
        isVisible?: boolean;
        labels?: Partial<FileManagerLabels>;
        onAddComment?: (fileId: string, content: string) => Promise<void>;
        onCreateFolder?: (name: string, parentPath: string) => Promise<void>;
        onDelete?: (files: FileEntry[]) => Promise<void>;
        onDeleteComment?: (fileId: string, commentId: string) => Promise<void>;
        onDeleteFolder?: (folder: FolderEntry) => Promise<void>;
        onDownload?: (files: FileEntry[]) => Promise<void>;
        onEditComment?: (
            fileId: string,
            commentId: string,
            content: string,
        ) => Promise<void>;
        onFetchFileTypes?: () => Promise<string[]>;
        onFileCountChange?: (count: number) => void;
        onFileEdit?: (file: FileEntry) => void;
        onFileOpen?: (file: FileEntry) => void;
        onGetAttendees?: () => Promise<{ userId: string; userName?: string }[]>;
        onGetComments?: (fileId: string) => Promise<FileComment[]>;
        onGetFileUrl?: (file: FileEntry) => Promise<string>;
        onGetMarkers?: (
            fileId: string,
        ) => {
            authorId?: string;
            authorName?: string;
            color?: string;
            content: string;
            createdAt?: string;
            editedAt?: string;
            id: string;
            time: number;
        }[];
        onGetRegions?: (
            fileId: string,
        ) => {
            channelIdx?: number;
            content: string;
            end: number;
            id: string;
            start: number;
        }[];
        onMarkerAdd?: (
            fileId: string,
            marker: {
                authorId?: string;
                authorName?: string;
                color?: string;
                content: string;
                createdAt?: string;
                editedAt?: string;
                id: string;
                time: number;
            },
        ) => void;
        onMarkerChange?: (
            fileId: string,
            marker: {
                authorId?: string;
                authorName?: string;
                color?: string;
                content: string;
                createdAt?: string;
                editedAt?: string;
                id: string;
                time: number;
            },
        ) => void;
        onMarkerDelete?: (fileId: string, markerId: string) => void;
        onMove?: (files: FileEntry[], newLocation: string) => Promise<void>;
        onNavigate?: (path: string) => void;
        onRefresh?: () => void;
        onRegionChange?: (
            fileId: string,
            region: {
                channelIdx?: number;
                content: string;
                end: number;
                id: string;
                start: number;
            },
        ) => void;
        onRegionDelete?: (fileId: string, regionId: string) => void;
        onRename?: (file: FileEntry, newName: string) => Promise<void>;
        onSelect?: (selection: { fileId: string; filename: string }) => void;
        onShare?: (files: FileEntry[], userIds: string[]) => Promise<void>;
        onSwitchToTab?: (tabName: string, file: FileEntry) => void;
        onUpload?: (file: File, location: string) => Promise<void>;
        onViewModeChange?: (mode: FileManagerViewMode) => void;
        refresh?: number;
        renderProps?: FileManagerRenderProps;
        renderShareUserList?: (
            props: {
                availableUsers: { userId: string; userName?: string }[];
                isDisabled: boolean;
                onToggleUser: (userId: string) => void;
                selectedUserIds: Set<string>;
            },
        ) => ReactNode;
        resourceTabMapping?: {
            add?: Record<string, string>;
            remove?: string[];
            replace?: Record<string, string>;
        };
        resourceViewerTypes?: {
            add?: string[];
            remove?: string[];
            replace?: string[];
        };
        roomName?: string;
        showBothOwnedAndShared?: boolean;
        showBreadcrumbs?: boolean;
        showOnlySharedFiles?: boolean;
        showToolbar?: boolean;
        sortStorageKey?: string;
        styles?: Partial<FileManagerStyles>;
        sx?: SxProps<Theme>;
        userId?: string;
        viewMode?: FileManagerViewMode;
    }
    Index

    Properties

    availableTabs?: string[]

    Available tabs for smart opening

    colors?: Partial<FileManagerColors>

    Custom colors for theming

    columns?: FileListColumn[]

    Columns to display in the file list

    currentPath?: string

    Current folder path (e.g., '/', '/Notes', '/Recordings/2024'). When inside FileCacheProvider, this is managed internally unless overridden.

    currentUserId?: string

    Current user ID (used to determine edit permissions on markers)

    customAction?: CustomToolbarAction | null

    Custom toolbar action

    customContextActions?: CustomContextAction[]

    Custom context menu actions for files (appended after built-in actions)

    customFilters?: CustomToolbarFilter[]

    Custom filter dropdowns rendered in the toolbar alongside search and sort

    customViewers?: Partial<Record<string, CustomViewerRenderer>>

    Custom viewer renderers for specific resource types. These are passed to FileViewer for rendering custom file types.

    defaultFilterChip?: string

    Label of the filter chip to select by default. When provided, this chip is active on mount instead of "All".

    defaultViewMode?: FileManagerViewMode

    Default view mode when uncontrolled

    'table'
    
    enableDragDrop?: boolean

    Whether to enable drag-and-drop file moving

    true
    
    enableMarkers?: boolean

    Enable timeline markers for audio/video files

    false
    
    enableMultiSelect?: boolean

    Whether to enable multi-file selection

    true
    
    enableRegions?: boolean

    Enable region creation and loop playback for audio/video files

    false
    
    enableSmartOpening?: boolean

    Enable smart opening (open whiteboards/notes in their respective tabs)

    false
    
    fieldFormatters?: Partial<Record<FileListColumn, (file: FileEntry) => string>>

    Custom formatters for file list columns. Each key is a column name, and the value is a function that receives the file and returns a display string. The formatter's return value replaces the default cell text.

    <FileManager
    fieldFormatters={{
    roomName: (file) => roomAliasMap.get(file.roomName) || file.roomName,
    owner: (file) => userNameMap.get(file.userId) || file.userId,
    }}
    />
    fileNameFormatter?: (file: FileEntry) => string

    Custom file name formatter

    files?: FileEntry[]

    Array of files in current folder. When inside FileCacheProvider, this is derived from context unless overridden.

    filterChipPriority?: ResourceType[]

    Resource types to show first in auto-generated filter chips. Types not in this list appear after, sorted alphabetically. Only used when filterChips is not provided.

    filterChips?: { label: string; types?: ResourceType[] }[]

    Filter chip definitions to render between toolbar and content. When provided, a chip bar is shown allowing users to filter by resource type. The first chip is selected by default.

    <FileManager
    filterChips={[
    { label: 'All', types: undefined },
    { label: 'Whiteboards', types: ['whiteboard'] },
    { label: 'Notes', types: ['usernote', 'note'] },
    ]}
    />
    filterFileTypes?: ResourceType[]

    Filter to specific file types (forces flat view)

    folders?: FolderEntry[]

    Array of subfolders in current folder. When inside FileCacheProvider, this is derived from context unless overridden.

    getCommentCount?: (file: FileEntry) => number

    Return the number of comments on a file (for badge display on file rows/cards). When provided, files with count > 0 show a comment icon.

    icons?: Partial<FileManagerIcons>

    Custom icons

    isDownloading?: boolean

    Whether download is in progress (managed internally when inside FileCacheProvider)

    isLoading?: boolean

    Whether files are currently loading. When inside FileCacheProvider, this is derived from context unless overridden.

    isRefreshing?: boolean

    Whether refresh is in progress (managed internally when inside FileCacheProvider)

    isRoomOwner?: boolean

    Whether current user is room owner (derived from context when inside FileCacheProvider)

    isUploading?: boolean

    Whether upload is in progress (managed internally when inside FileCacheProvider)

    isVisible?: boolean

    Whether the component is visible (for lazy loading)

    labels?: Partial<FileManagerLabels>

    Custom labels for internationalization

    onAddComment?: (fileId: string, content: string) => Promise<void>

    Add a new comment to a file

    onCreateFolder?: (name: string, parentPath: string) => Promise<void>

    Create a new folder

    onDelete?: (files: FileEntry[]) => Promise<void>

    Delete files

    onDeleteComment?: (fileId: string, commentId: string) => Promise<void>

    Delete a comment from a file

    onDeleteFolder?: (folder: FolderEntry) => Promise<void>

    Delete a folder

    onDownload?: (files: FileEntry[]) => Promise<void>

    Download a file or files

    onEditComment?: (
        fileId: string,
        commentId: string,
        content: string,
    ) => Promise<void>

    Edit a comment on a file

    onFetchFileTypes?: () => Promise<string[]>

    Get list of available file types for filtering

    onFileCountChange?: (count: number) => void

    Callback fired when the file count changes (useful for conditional UI)

    onFileEdit?: (file: FileEntry) => void

    Callback when a file should be opened in an editor (for types without inline viewers). If provided, prevents the fallback "no preview" viewer from opening.

    onFileOpen?: (file: FileEntry) => void

    Handle double-click to open file. This is always called when a file is opened.

    onGetAttendees?: () => Promise<{ userId: string; userName?: string }[]>

    Get attendees for sharing dialog

    onGetComments?: (fileId: string) => Promise<FileComment[]>

    Get comments for a specific file. When provided, enables the comments panel. Called when a file is selected and the comments panel is opened.

    onGetFileUrl?: (file: FileEntry) => Promise<string>

    Get presigned URL for file viewing

    onGetMarkers?: (
        fileId: string,
    ) => {
        authorId?: string;
        authorName?: string;
        color?: string;
        content: string;
        createdAt?: string;
        editedAt?: string;
        id: string;
        time: number;
    }[]

    Get saved timeline markers for a specific file

    onGetRegions?: (
        fileId: string,
    ) => {
        channelIdx?: number;
        content: string;
        end: number;
        id: string;
        start: number;
    }[]

    Get saved regions for a specific file

    onMarkerAdd?: (
        fileId: string,
        marker: {
            authorId?: string;
            authorName?: string;
            color?: string;
            content: string;
            createdAt?: string;
            editedAt?: string;
            id: string;
            time: number;
        },
    ) => void

    Called when a new timeline marker is added

    onMarkerChange?: (
        fileId: string,
        marker: {
            authorId?: string;
            authorName?: string;
            color?: string;
            content: string;
            createdAt?: string;
            editedAt?: string;
            id: string;
            time: number;
        },
    ) => void

    Called when a timeline marker is updated

    onMarkerDelete?: (fileId: string, markerId: string) => void

    Called when a timeline marker is deleted

    onMove?: (files: FileEntry[], newLocation: string) => Promise<void>

    Move file(s) to a new location

    onNavigate?: (path: string) => void

    Navigate to a folder path. When inside FileCacheProvider, this is auto-wired unless overridden.

    onRefresh?: () => void

    Refresh the file list. When inside FileCacheProvider, this is auto-wired unless overridden.

    onRegionChange?: (
        fileId: string,
        region: {
            channelIdx?: number;
            content: string;
            end: number;
            id: string;
            start: number;
        },
    ) => void

    Called when a named region is created or updated

    onRegionDelete?: (fileId: string, regionId: string) => void

    Called when a named region is deleted

    onRename?: (file: FileEntry, newName: string) => Promise<void>

    Rename a file

    onSelect?: (selection: { fileId: string; filename: string }) => void

    Callback when a file is selected

    onShare?: (files: FileEntry[], userIds: string[]) => Promise<void>

    Share files with users

    onSwitchToTab?: (tabName: string, file: FileEntry) => void

    Callback when switching to a specific tab (for smart opening)

    onUpload?: (file: File, location: string) => Promise<void>

    Upload a file. Returns void or throws on error.

    onViewModeChange?: (mode: FileManagerViewMode) => void

    Callback when view mode changes

    refresh?: number

    Trigger refresh from parent (increment to trigger refresh)

    Render props for advanced customization

    renderShareUserList?: (
        props: {
            availableUsers: { userId: string; userName?: string }[];
            isDisabled: boolean;
            onToggleUser: (userId: string) => void;
            selectedUserIds: Set<string>;
        },
    ) => ReactNode

    Custom render function for the sharing dialog's user selection area. When provided, replaces the default checkbox user list in the share dialog.

    resourceTabMapping?: {
        add?: Record<string, string>;
        remove?: string[];
        replace?: Record<string, string>;
    }

    Customize the mapping of resource types to sidebar tab names for smart opening. When a file is double-clicked and has no inline viewer, this mapping determines which tab to switch to via onSwitchToTab.

    // Add a custom resource type that opens in a "documents" tab
    <FileManager resourceTabMapping={{ add: { 'custom-doc': 'documents' } }} />

    // Remove a mapping so it falls through to the file viewer
    <FileManager resourceTabMapping={{ remove: ['whiteboard'] }} />

    // Replace the entire mapping
    <FileManager resourceTabMapping={{ replace: { notes: 'notes', whiteboard: 'board' } }} />
    resourceViewerTypes?: { add?: string[]; remove?: string[]; replace?: string[] }

    Override which resource types open in the inline FileViewer. By default, types like image, video, pdf, room-summary, etc. open in the viewer. Types not in this set (e.g., whiteboard, notes) route to tab switching instead.

    // Add a custom type to the viewer set
    <FileManager resourceViewerTypes={{ add: ['my-custom-type'] }} />

    // Remove a type so it routes to tab switching
    <FileManager resourceViewerTypes={{ remove: ['room-summary'] }} />

    // Replace the entire set
    <FileManager resourceViewerTypes={{ replace: ['image', 'video', 'pdf'] }} />
    roomName?: string

    Room name (derived from context when inside FileCacheProvider)

    showBothOwnedAndShared?: boolean

    Whether to show both owned and shared files

    showBreadcrumbs?: boolean

    Whether to show breadcrumb navigation

    true
    
    showOnlySharedFiles?: boolean

    Whether to show only files shared with user

    showToolbar?: boolean

    Whether to show the toolbar

    true
    
    sortStorageKey?: string

    localStorage key for persisting sort state. When provided, sort column and direction are saved and restored across sessions.

    styles?: Partial<FileManagerStyles>

    Custom style values

    sx?: SxProps<Theme>

    MUI sx styling prop

    userId?: string

    Current user's ID. When inside FileCacheProvider, this is derived from context unless overridden.

    Controlled view mode (table or card). When provided, the component is controlled.