@memoir/tree

Public API

Public exports from @memoir/tree.

All public exports come from @memoir/tree.

Family Tree

  • FamilyTree
  • DefaultFamilyCard
  • rel
  • createFamilyIndex(people, relationships)
  • collectFamilyNeighborhood(index, subject)
  • buildFamilyTreeLayout(input)

Org Chart

  • OrgChart
  • DefaultOrgChartCard
  • createOrgChart(root)
  • buildOrgChartLayout(input)

createOrgChart(root) accepts a nested reporting tree and returns:

type OrgChartDefinition<Person> = {
  rootId: string;
  nodes: OrgChartNode<Person>[];
  generations: OrgChartGeneration[];
  maxGeneration: number;
  reportLines: OrgChartReportLine[];
};

Use generations and maxGeneration to show how far the chart goes. Use reportLines to inspect who reports to who without walking the nested input again.

Shared Surface

  • TreeSurface
  • TreeInteractionMode
  • optional CSS from @memoir/tree/styles.css

Family Types

  • PersonId
  • PeopleById<Person>
  • FamilyRelationship
  • FamilyParentageRelationship
  • FamilyPartnershipRelationship
  • FamilyGuardianshipRelationship
  • ComputedRelation
  • FamilyCardProps<Person>
  • FamilyTreeProps<Person>
  • FamilyTreeLayoutResult<Person>

Org Types

  • OrgChartNode<Person>
  • OrgChartBranch<Person>
  • OrgChartDefinition<Person>
  • OrgChartGeneration
  • OrgChartReportLine
  • OrgChartCardProps<Person>
  • OrgChartProps<Person>
  • OrgChartLayoutResult<Person>

Relationship Helpers

  • rel.parents(child, parents, options?)
  • rel.children(parents, children, options?)
  • rel.partner(a, b, options?)
  • rel.guardians(child, guardians, options?)

Use family relationship facts for the ergonomic FamilyTree API.

On this page