index
@statelyjs/files - File System Plugin
File system integration plugin for Stately applications. Provides comprehensive file management capabilities for both schema and UI.
Features
- File Browsing: Directory navigation with breadcrumbs
- File Uploads: Drag-and-drop with automatic versioning
- File Downloads: Support for multiple storage targets (data, cache, upload)
- RelativePath Field: Form components for file path selection
- Version History: Track and manage file versions
Installation
Setup
1. Add Schema Plugin
2. Add UI Plugin
3. Access in Components
Type Aliases
FilesOptions
FilesOptions =
DefineOptions<{api?: {pathPrefix?:string; };navigation?: {routes?:UiNavigationOptions["routes"]; }; }>
Defined in: files/src/plugin.tsx:93
Configuration options for the Files plugin.
Example
FilesPlugin
FilesPlugin =
DefinePlugin<typeofFILES_PLUGIN_NAME,FilesNodeMap,FilesTypes,FilesData,FilesUtils>
Defined in: files/src/plugin.tsx:108
Files schema plugin type definition.
This type augments the Stately schema runtime with file-related node types, data structures, and utilities.
See
filesPlugin - Factory function to create this plugin
FilesUiPlugin
FilesUiPlugin =
DefineUiPlugin<typeofFILES_PLUGIN_NAME,FilesPaths, typeofFILES_OPERATIONS,FilesUiUtils,FilesOptions, typeoffilesRoutes>
Defined in: files/src/plugin.tsx:150
Files UI plugin type definition.
This type defines the shape of the Files UI plugin, including its API operations, configuration options, and utilities.
See
filesUiPlugin - Factory function to create this plugin
FilesUiUtils
FilesUiUtils =
DefineUiUtils<{formatFileSize: (bytes) =>string;formatTimestamp: (timestamp?,withTime?) =>string|null;getFileEntryIcon: (entryType,isSelected?) =>ComponentType<any>; }>
Defined in: files/src/utils.ts:21
Files UI plugin utilities
FilesUtils
FilesUtils =
Record<string,never>
Defined in: files/src/utils.ts:16
Files plugin utilities
Variables
FILES_PLUGIN_NAME
constFILES_PLUGIN_NAME:"files"
Defined in: files/src/plugin.tsx:80
Plugin identifier for the Files plugin.
filesPlugin()
constfilesPlugin: <S>() =>PluginFactory<S>
Defined in: files/src/plugin.tsx:136
Creates the Files schema plugin factory.
This plugin registers file-related types and utilities into the Stately
schema runtime. It should be used with stately().withPlugin().
Type Parameters
S
S extends StatelySchemas<any, any>
Returns
A plugin factory function that augments the runtime
Example
filesUiPlugin
constfilesUiPlugin:UiPluginFactoryFn<FilesUiPlugin>
Defined in: files/src/plugin.tsx:186
Creates the Files UI plugin factory.
This plugin registers file-related components, API operations, and navigation routes into the Stately UI runtime. It provides:
- RelativePath field components for edit and view modes
- String primitive transformers
- Typed API operations for file management
Example
filesUiUtils
constfilesUiUtils:FilesUiUtils
Defined in: files/src/utils.ts:39
Files plugin utilities implementation
useFilesStatelyUi()
constuseFilesStatelyUi: () =>StatelyUiRuntime<Schemas<any,any>, readonly [CoreUiPlugin,FilesUiPlugin]>
Defined in: files/src/context.tsx:19
Default hook instance for files plugin Use this in files plugin components and hooks
Access the Stately runtime from React context.
Use this hook in components to access the runtime's plugins, utilities,
and configuration. The runtime must be provided via statelyUiProvider.
Returns
StatelyUiRuntime<Schemas<any, any>, readonly [CoreUiPlugin, FilesUiPlugin]>
The current Stately runtime from context
Throws
If called outside of a StatelyUiProvider
Example
Functions
createUseFilesStatelyUi()
createUseFilesStatelyUi<
Schema>(): () =>StatelyUiRuntime<Schema, readonly [CoreUiPlugin,FilesUiPlugin]>
Defined in: files/src/context.tsx:11
Hook for accessing Stately UI runtime with Files plugin
Assumes core plugin is available (since files uses core components like Editor) Returns runtime with type-safe access to core and files plugins
Type Parameters
Schema
Schema extends Schemas<any, any> = Schemas<any, any>
Returns
():
StatelyUiRuntime<Schema, readonly [CoreUiPlugin,FilesUiPlugin]>
Access the Stately runtime from React context.
Use this hook in components to access the runtime's plugins, utilities,
and configuration. The runtime must be provided via statelyUiProvider.
Returns
StatelyUiRuntime<Schema, readonly [CoreUiPlugin, FilesUiPlugin]>
The current Stately runtime from context
Throws
If called outside of a StatelyUiProvider
Example
References
FilesApi
Re-exports FilesApi
FilesData
Re-exports FilesData
FilesNodeType
Re-exports FilesNodeType
FilesOperations
Re-exports FilesOperations
FilesPaths
Re-exports FilesPaths
FilesTypes
Re-exports FilesTypes
RelativePathNode
Re-exports RelativePathNode
TFilesNodeType
Re-exports TFilesNodeType