• "Import Inline" Input - Paste data, validate it, and fill your form!

"Import Inline" Input - Paste data, validate it, and fill your form!

Plugin information

by camya

Form builder Field Admin panel

The ImportInline Input component helps you to paste machine-readable data like JSON or CSV, validate it, and import it into your form fields.

Support

#import-inline-form-paste on Discord

Views

2269

License

MIT

Documentation

The ImportInline Input component helps you to paste machine-readable data like JSON or CSV, validate it, and import it into your form fields.

The plugin can automatically import data via the "on paste" event, which makes it a great tool for increasing productivity when editing content. Just click in the input field and paste the data of the clipboard.

You can validate imported data using the standard Laravel Validation Rules. The plugin comes with two handy importers for JSON and CSV, but you can also just write and use your own importer.

Quick jump to the documentation.

Watch the » Demo Video «

You can install the package via composer:

composer require camya/filament-import-inline

Use it in your Filament Resource:

ImportInlineInput::make('Import')
->afterStateUpdated(
function ($state, Closure $set, ImportInlineInput $component): void {
 
$validator = $component->validator();
 
try {
$importedData = Import::jsonString($state);
} catch (\Exception $e) {
$validator->setValidationError($e->getMessage());
}
 
$validatedData = $validator->validate(
data: $importedData,
rules: [
'title' => [
'required',
],
'slug' => [
'required',
],
'content' => [
'required',
],
],
messages: [
'title.required' => 'title is required',
'slug.required' => 'slug is required',
'content.required' => 'content is required',
]
);
 
$set('title', $validatedData['title']);
$set('slug', $validatedData['slug']);
$set('content', $validatedData['content']);
 
$component->statusMessage('Data imported <strong>successful!</strong>');
 
}
)
->dataHelperHtml('Example JSON: {"title":"Lorem","slug":"ipsum","content":"Hello"}')
->dataHelperLink('https://www.camya.com/', 'Help')

Features

  • Import and validate any type of machine readable string data.
  • Direct import "on paste" event for a content editing productivity boost.
  • Importers for JSON and CSV included.
  • Validation of the structure using Laravel's validation rules.
  • All texts customizable and translatable.
  • Dark mode supported.
  • Fully configurable.

Visit the GitHub Repository for all details.