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.
<PackageVersion Include="Blazor.FamilyTreeJS" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Blazor.FamilyTreeJS" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version 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.
#:package Blazor.FamilyTreeJS@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Blazor.FamilyTreeJS&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Blazor.FamilyTreeJS&version=1.0.0
                    
Install as a Cake Tool

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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
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
3.0.1 237 10/20/2024
3.0.0 193 10/12/2024
2.0.7 193 9/7/2024
2.0.6 215 9/3/2024
2.0.5 169 8/6/2024
2.0.4 221 6/30/2024
2.0.3 200 6/23/2024
2.0.2 181 6/23/2024
2.0.1 175 6/12/2024
2.0.0 174 6/11/2024
1.0.1 232 4/19/2024
1.0.0 214 4/13/2024