SoftwareDriven.SurveyJs.Creator.Blazor
2.0.0
dotnet add package SoftwareDriven.SurveyJs.Creator.Blazor --version 2.0.0
NuGet\Install-Package SoftwareDriven.SurveyJs.Creator.Blazor -Version 2.0.0
<PackageReference Include="SoftwareDriven.SurveyJs.Creator.Blazor" Version="2.0.0" />
<PackageVersion Include="SoftwareDriven.SurveyJs.Creator.Blazor" Version="2.0.0" />
<PackageReference Include="SoftwareDriven.SurveyJs.Creator.Blazor" />
paket add SoftwareDriven.SurveyJs.Creator.Blazor --version 2.0.0
#r "nuget: SoftwareDriven.SurveyJs.Creator.Blazor, 2.0.0"
#:package SoftwareDriven.SurveyJs.Creator.Blazor@2.0.0
#addin nuget:?package=SoftwareDriven.SurveyJs.Creator.Blazor&version=2.0.0
#tool nuget:?package=SoftwareDriven.SurveyJs.Creator.Blazor&version=2.0.0
SoftwareDriven.SurveyJs.Creator.Blazor
A Blazor WebAssembly wrapper for the SurveyJS Survey Creator — an embeddable drag-and-drop form builder. Design a survey in the browser and get its JSON definition back. The SurveyJS JavaScript is shipped inside the package as a single minified bundle, loaded on demand; no script tag or npm install is required in your app.
Targets .NET 10 (net10.0) and wraps SurveyJS Survey Creator 3.0.
Commercial license: The SurveyJS Survey Creator is not free for commercial use. Without a license key, the creator shows an alert banner. Pass your key via the
LicenseKeyparameter.
Installation
dotnet add package SoftwareDriven.SurveyJs.Creator.Blazor
Add the namespace (e.g. in _Imports.razor):
@using SoftwareDriven.SurveyJs.Creator.Blazor
Usage
<SurveyCreatorHost @ref="creator"
Json="initialJson"
OnModified="OnModified"
LicenseKey="YOUR-SURVEYJS-LICENSE-KEY" />
<button @onclick="Save">Save</button>
@code {
private SurveyCreatorHost? creator;
private string? currentJson;
private readonly object initialJson = new
{
elements = new object[]
{
new { type = "text", name = "firstName", title = "Your name" }
}
};
// Fires on every edit with the current survey JSON.
private void OnModified(string json) => currentJson = json;
// Or pull the JSON on demand (e.g. on a Save click).
private async Task Save()
{
var json = await creator!.GetJsonAsync();
// persist json...
}
}
Save workflow
Set OnSave to enable the Save button (and, with AutoSave, auto-saving). It
receives the survey JSON and returns whether the save succeeded — wire it to your
own storage; there is no built-in backend.
<SurveyCreatorHost OnSave="SaveAsync" AutoSave="true" LicenseKey="…" />
@code {
private async Task<bool> SaveAsync(string surveyJson)
{
await Http.PutAsJsonAsync("api/surveys/1", surveyJson);
return true;
}
}
Set OnUploadFile to store images/logos the user adds in the designer. Files
arrive as data URLs; return the URL to reference, or null on failure.
UI presets
SurveyJS 3.0 introduced UI presets: a JSON configuration that tailors the creator — which toolbox items and tabs are available, how the property grid is grouped, which languages can be edited. Pass the name of one of the presets that ship with Survey Creator:
<SurveyCreatorHost Json="initialJson" Preset="@("Basic")" />
"Basic", "Advanced" and "Expert" are available; they are fetched lazily, so
they cost nothing unless used. To use your own configuration — for example the
JSON exported from the UI Preset Editor
— pass it as a POCO, a JsonElement, or a JSON string:
<SurveyCreatorHost Json="initialJson" Preset="preset" />
@code {
private readonly object preset = new
{
toolbox = new
{
definition = new object[]
{
new { name = "text" },
new { name = "radiogroup" },
new { name = "slider" },
}
},
tabs = new { items = new object[] { new { name = "designer" }, new { name = "preview" } } },
};
}
Assigning a new Preset instance rebuilds the creator, since a preset shapes the
UI the creator builds on construction. ApplyPresetAsync applies one to the
running instance instead.
Component reference
SurveyCreatorHost
Parameters
| Parameter | Type | Description |
|---|---|---|
Json |
object? |
Initial survey definition (POCO, JsonElement, or string). Target of @bind-Json. |
Options |
object? |
SurveyCreatorModel options (e.g. new { showLogicTab = true }). A new instance rebuilds the creator. |
Preset |
object? |
UI preset: a built-in name ("Basic", "Advanced", "Expert") or a preset configuration. A new instance rebuilds the creator. |
LicenseKey |
string? |
SurveyJS commercial license key. |
Height |
string |
CSS height of the container (default 70vh). |
AutoSave |
bool |
Auto-save after each change (requires OnSave). |
ShowSaveButton |
bool |
Show the Save button when OnSave is set (default true). |
Notification events
| Event | Type | Description |
|---|---|---|
OnModified |
EventCallback<string> |
Every edit, with the current survey JSON. |
JsonChanged |
EventCallback<object?> |
Backing callback for @bind-Json. |
OnActiveTabChanged |
EventCallback<string> |
After the active tab changes (tab id). |
OnQuestionAdded / OnPanelAdded / OnPageAdded |
EventCallback<CreatorElementAdded> |
An element was added. |
OnSelectedElementChanged |
EventCallback<CreatorSelectedElement> |
The selected element changed. |
OnAfterPropertyChanged |
EventCallback<CreatorPropertyChange> |
A property of an element changed. |
OnNotify |
EventCallback<CreatorNotification> |
Creator notification (e.g. after saving). |
Server-side / veto callbacks (wire to your own storage; veto is synchronous, requires WebAssembly)
| Callback | Type | Description |
|---|---|---|
OnSave |
Func<string, Task<bool>>? |
Save the survey JSON; return success. Shows the Save button. |
OnSaveTheme |
Func<string, Task<bool>>? |
Save the theme JSON; return success. |
OnUploadFile |
Func<CreatorFileUpload, Task<string?>>? |
Store an uploaded file; return its URL or null. |
OnClearFile |
Func<CreatorFileClear, Task<bool>>? |
Delete an uploaded file; return success. |
OnElementDeleting |
Func<CreatorElementDeleting, bool>? |
Return false to cancel a deletion. |
Methods
| Method | Description |
|---|---|
Task<string?> GetJsonAsync() |
Current survey definition as a JSON string. |
ValueTask SetJsonAsync(object? json) |
Replace the definition being edited. |
ValueTask<string?> GetActiveTabAsync() |
The active tab id. |
ValueTask<bool> SetActiveTabAsync(string) |
Switch the active tab. |
ValueTask ShowPreviewAsync() |
Open the Preview tab. |
ValueTask UndoAsync() / RedoAsync() |
Undo / redo the last designer change. |
ValueTask SaveAsync() |
Trigger the save workflow (OnSave). |
ValueTask ApplyPresetAsync(object preset) |
Apply a UI preset to the running creator. |
Context types
CreatorElementAdded(ElementType, Name, Reason)CreatorSelectedElement(Name, ElementType)CreatorPropertyChange(ElementName, PropertyName, ValueJson)CreatorElementDeleting(ElementType, Name)CreatorNotification(Message, Type)CreatorFileUpload(ElementType, PropertyName, Files)withCreatorIncomingFile(Name, Type, ContentBase64)CreatorFileClear(ElementType, PropertyName)
License
Wrapper code: see repository. Bundled survey-creator: commercial SurveyJS
license required — https://surveyjs.io/licensing.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Components.Web (>= 10.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0 | 131 | 9/3/2026 |