Search

Event Folds

Events

Group simultaneous events into collapsible folds.

Event Folds
View live example →

Hover over the timeline to reveal the areas that contain event folds. Click the highlighted area to show the individual events. Then click the "x" or the timeline background to close the fold.

Event folds are shown when more than one event occurs at the same time.

In this example, we show transactions from a series of Bitcoin blocks. Each transaction is given the timestamp of its block.

See also:

import { createTimeline } from "kronograph";
import { entities, events, eventTypes, entityTypes } from "./data";

const fontAwesomeSolid = '900 16px "Font Awesome 5 Free"';
document.fonts.load(fontAwesomeSolid);

document.fonts.ready.then(() => {
  const timeline = createTimeline("my-timeline");
  timeline.options({
    backgroundColor: "#14181D",
    controls: {
      eventFolds: {
        color: "#2DD4BF",
        foldColor: "#F2C14E",
      },
    },
  });
  timeline.set({ entities, events, eventTypes, entityTypes });
  timeline.fit();
});
export const eventTypes = {
  default: {
    color: "#F3E7C8",
  },
};

export const entityTypes = {
  default: {
    color: "rgba(243, 231, 200, 0.2)",
  },
};
export const entities = {
  "smith-johnathan-151": {
    label: "John Smith",
  },
  "west-josephine-126": {
    label: "Josephine West",
  },
  "roberts-nathaniel-023": {
    label: "Nathan Roberts",
  },
  "baxter-eleanor-004": {
    label: "Ella Baxter",
  },
};
export const events = {
  "email 1": {
    entityIds: ["smith-johnathan-151", "baxter-eleanor-004"],
    time: new Date(2025, 7, 14, 8),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 2": {
    entityIds: ["smith-johnathan-151", "west-josephine-126"],
    time: new Date(2025, 7, 14, 8),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 3": {
    entityIds: ["smith-johnathan-151", "baxter-eleanor-004"],
    time: new Date(2025, 7, 14, 10, 15),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 4": {
    entityIds: ["smith-johnathan-151", "roberts-nathaniel-023"],
    time: new Date(2025, 7, 14, 10, 15),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 5": {
    entityIds: [
      "smith-johnathan-151",
      "baxter-eleanor-004",
      "west-josephine-126",
      "roberts-nathaniel-023",
    ],
    time: new Date(2025, 7, 14, 9),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 6": {
    entityIds: [
      "roberts-nathaniel-023",
      "smith-johnathan-151",
      "baxter-eleanor-004",
      "west-josephine-126",
    ],
    time: new Date(2025, 7, 14, 9),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 7": {
    entityIds: ["smith-johnathan-151", "baxter-eleanor-004"],
    time: new Date(2025, 7, 14, 8, 30),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 8": {
    entityIds: ["roberts-nathaniel-023", "baxter-eleanor-004"],
    time: new Date(2025, 7, 14, 10),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
};
<!doctype html>
<html>
  <head>
    <link rel="stylesheet" type="text/css" href="/public/fonts/fontawesome-free/css/all.css" />
    <link rel="stylesheet" href="@ci/theme/kg/css/examples.css" />
  </head>
  <body>
    <div class="story">
      <div class="story__timeline" id="my-timeline"></div>
    </div>
    <script type="module" src="./code.js"></script>
  </body>
</html>
import React, { useState } from "react";
import { createRoot } from "react-dom/client";
import Timeline from "kronograph/react/Timeline";
import { entities, events, eventTypes, entityTypes } from "./data";

const loadFonts = () => {
  // These fonts are declared in the <head> element of the HTML page.
  const fontAwesomeSolid = '900 16px "Font Awesome 5 Free"';
  document.fonts.load(fontAwesomeSolid);
};

export const Demo = () => {
  const [fontsReady, setFontsReady] = useState(false);

  loadFonts();
  document.fonts.ready.then(() => {
    setFontsReady(true);
  });

  if (!fontsReady) {
    return null;
  }

  return (
    <Timeline
      entities={entities}
      events={events}
      entityTypes={entityTypes}
      eventTypes={eventTypes}
      options={{
        backgroundColor: "#14181D",
        controls: {
          eventFolds: {
            color: "#2DD4BF",
            foldColor: "#F2C14E",
          },
        },
      }}
    />
  );
};

const root = createRoot(document.getElementById("my-timeline"));
root.render(<Demo />);
export const eventTypes = {
  default: {
    color: "#F3E7C8",
  },
};
export const entityTypes = {
  default: {
    color: "rgba(243, 231, 200, 0.2)",
  },
};
export const entities = {
  "smith-johnathan-151": {
    label: "John Smith",
  },
  "west-josephine-126": {
    label: "Josephine West",
  },
  "roberts-nathaniel-023": {
    label: "Nathan Roberts",
  },
  "baxter-eleanor-004": {
    label: "Ella Baxter",
  },
};
export const events = {
  "email 1": {
    entityIds: ["smith-johnathan-151", "baxter-eleanor-004"],
    time: new Date(2025, 7, 14, 8),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 2": {
    entityIds: ["smith-johnathan-151", "west-josephine-126"],
    time: new Date(2025, 7, 14, 8),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 3": {
    entityIds: ["smith-johnathan-151", "baxter-eleanor-004"],
    time: new Date(2025, 7, 14, 10, 15),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 4": {
    entityIds: ["smith-johnathan-151", "roberts-nathaniel-023"],
    time: new Date(2025, 7, 14, 10, 15),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 5": {
    entityIds: [
      "smith-johnathan-151",
      "baxter-eleanor-004",
      "west-josephine-126",
      "roberts-nathaniel-023",
    ],
    time: new Date(2025, 7, 14, 9),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 6": {
    entityIds: [
      "roberts-nathaniel-023",
      "smith-johnathan-151",
      "baxter-eleanor-004",
      "west-josephine-126",
    ],
    time: new Date(2025, 7, 14, 9),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 7": {
    entityIds: ["smith-johnathan-151", "baxter-eleanor-004"],
    time: new Date(2025, 7, 14, 8, 30),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
  "email 8": {
    entityIds: ["roberts-nathaniel-023", "baxter-eleanor-004"],
    time: new Date(2025, 7, 14, 10),
    fontIcon: {
      fontFamily: "Font Awesome 5 Free",
      scale: 1.3,
      text: "\u{f0e0}",
    },
  },
};
<!doctype html>
<html>
  <head>
    <link rel="stylesheet" href="@ci/theme/kg/css/examples.css" />
  </head>
  <body>
    <div id="my-timeline" style="height: 100vh"></div>
    <script type="module" src="./code.jsx"></script>
  </body>
</html>

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.