> ## Documentation Index
> Fetch the complete documentation index at: https://studio.bjanczak.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up FLEX Fields and Studio

> Verify optional integration support, serve matching assets and authorize the workspace.

Install compatible FLEX Fields and Studio packages in the host application. Check that the installed FLEX Fields build provides `FlexFileUpload::mediaStudio()`. This factory selects `UseFlex\MediaStudio\Integrations\FlexFields\StudioFileUpload`.

## Verify the installed packages

```bash theme={null}
composer show janczakb/filament-flex-fields
composer show useflex/media-studio
```

Use your licensed package distribution or the application's configured Composer repositories. Apply [Studio installation](https://studio.bjanczak.com/installation.md), migrations and [Filament setup](https://studio.bjanczak.com/filament-setup.md) before adding the field.

## Prepare an authorized workspace

Resolve the workspace ID from the current server-side tenant or host record. For a create form, use a resolver that works before the record exists. The selected workspace must allow the current user to view the library. New uploads additionally require upload permission. See [permissions](https://studio.bjanczak.com/filament-permissions.md) and [tenant integration](https://studio.bjanczak.com/filament-tenancy.md).

## Serve the Studio assets

Serve the matching Studio JavaScript module and stylesheet and pass their URLs to `studio()`. FLEX's component assets use its asset manager. Studio's module and CSS are loaded when its picker mounts. Serve `rich-editor-extension.js` alongside the module when using the [rich editor integration](https://studio.bjanczak.com/filament-flex-rich-editor.md).

For example, this field allows choosing existing PDF files only.

```php theme={null}
use Bjanczak\FilamentFlexFields\Filament\Forms\Components\FlexFileUpload;

FlexFileUpload::mediaStudio('documents')
    ->studio(
        workspace: $workspaceId,
        moduleUrl: '/studio-assets/studio.js',
        stylesheetUrl: '/studio-assets/studio.css',
        acceptedMimeTypes: ['application/pdf'],
    )
    ->studioUpload(false)
    ->multiple()
    ->maxFiles(5);
```

## Check the complete form workflow

Open Choose media, confirm the workspace is correct, select a permitted file and save the form. Reload and confirm its metadata is resolved. Then enable uploads in a test field, upload an allowed file and verify it appears once in Studio. The [persistence guide](https://studio.bjanczak.com/flex-fields/persistence.md) explains how to save references and protect used assets.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.