Blazor.FamilyTreeJS 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Blazor.FamilyTreeJS --version 1.0.0
NuGet\Install-Package Blazor.FamilyTreeJS -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Blazor.FamilyTreeJS" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Blazor.FamilyTreeJS --version 1.0.0
#r "nuget: Blazor.FamilyTreeJS, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Blazor.FamilyTreeJS as a Cake Addin
#addin nuget:?package=Blazor.FamilyTreeJS&version=1.0.0

// Install Blazor.FamilyTreeJS as a Cake Tool
#tool nuget:?package=Blazor.FamilyTreeJS&version=1.0.0

Blazor.FamilyTreeJS

This is a wrapper library for FamilyTreeJS and it is only compatible for Blazor WASM.

FamilyTreeJS version: 1.9.18

See samples on Github page.

Installation

Install from Nuget (not available yet).

dotnet add package Blazor.FamilyTreeJS --version <latest-version>

Register Blazor.FamilyTreeJS dependencies.

builder.Services.AddBlazorFamilyJS();

Configure IJSRuntime's JsonSerializerOptions. This allows System.Text.Json to ignore null when serializing to JSON and send that JSON to Javascript. Note this affects globally.

var app = builder
  .Build()
  .ConfigureIJSRuntimeJsonOptions();

If you have classes/records that inhereit from classes/records in this library, then you may need to use the following extension method, UseDerivedTypes<BaseType>([derive types]). This allows serializing your derived classes/records with all of their properties.

var app = builder
  .Build()
  .ConfigureIJSRuntimeJsonOptions();
  .UseDerivedTypes<Node>(typeof(NodeWithProfession))
  .UseDerivedTypes<NodeMenu>(typeof(CollapseNodeMenu), typeof(DrawLineNodeMenu));

public record NodeWithProfession : Node
{
  public string? Job { get; init; } = null;
}

public record CollapseNodeMenu : NodeMenu
{
  public Menu? Collapse { get; init; } = null;
}

public record DrawLineNodeMenu : NodeMenu
{
  public Menu? Draw { get; init; } = null;
}

Usage

Simplest usage is to provide a tree id.

<FamilyTree TreeId="my-tree" />

This library is heavily driven by the FamilyTreeOptions class so almost every control and UI are specified via this class. This C# class mirrors this Typescript options interface.

<FamilyTree TreeId="my-tree" Options=@new() { Mode = "dark" } />

Please refer to the sample project for more examples.

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.1 78 4/19/2024
1.0.0 108 4/13/2024