ROAMJS COMPONENTS

This is a collection of common UI components used by RoamJS extensions made available to make development easier for other Roam developers.

Organization

This package takes a modular approach - each function exposed in its own file in an effort to limit the bundle sizes of consumers. It has the following directories:

  • components - React components used in Roam

  • marked - RoamJS' official Roam-flavored markdown to HTML processor

  • queries - Helpers that abstract datalog into common, easy-to-invoke, typed queries

  • types - Common typescript types used when interacting with these methods

  • util - Common utilities for interacting with Roam's user interface

  • writes - Helpers that abstract Roam's write API into common, easy-to-invoke, typed actions

We require using modular imports for using any methods found in these libraries. For example,

import getTextByBlockUid from "roamjs-components/queries/getTextByBlockUid";

instead of

import { getTextByBlockUid } from "roamjs-components/queries";

or

import { getTextByBlockUid } from "roamjs-components";

We require this so that bundle sizes are as small as possible when they finally make it to the end user.

All necessary packages needed to make the methods in this package work are installed as peer dependencies when you install roamjs-components. Most are exposed on Roam's window object, which you could view here.