1.1.16 • Published 11 months ago

@linkurious/ogma-annotations-react v1.1.16

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
11 months ago

@linkurious/ogma-annotations-react

This package provides a set of React components to create and manage annotations in an Ogma graph. It doesn't depend on your UI components library, but provides the utilities to deal with the annotations in React way.

Installation

npm install @linkurious/ogma @linkurious/ogma-react @linkurious/ogma-annotations @linkurious/ogma-annotations-react

Usage

The package provides a context provider and a set of hooks to interact with the annotations. The context provider should be placed at the top of your component tree, and the hooks can be used in any component that needs to interact with the annotations.

import { useState } from "react";
import { RawGraph } from "@linkurious/ogma";
import { Ogma } from "@linkurious/ogma-react";
import { AnnotationsContextProvider } from "@linkurious/ogma-annotations-react";
import "@linkurious/ogma-annotations/style.css";
import { UI } from "./UI";
import "./App.css";

export default function App() {
  const [graph] = useState<RawGraph>({
    nodes: [
      { id: 0, attributes: { x: 0, y: 0 } },
      { id: 1, attributes: { x: 100, y: 100 } },
    ],
    edges: [],
  });
  return (
    <div className="App">
      <Ogma graph={graph}>
        <AnnotationsContextProvider>
          {/* Your UI components applying the settings and drawing logic */}
          <UI ... />
        </AnnotationsContextProvider>
      </Ogma>
    </div>
  );
}

License

Apache-2.0

1.1.16

11 months ago

1.1.15

11 months ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.9

1 year ago

1.1.10

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.8

1 year ago

1.0.5

2 years ago