npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

alignment-react

v0.2.1

Published

Alignment display engine for React

Downloads

5

Readme

Alignment React

React library for displaying alignments.

Note that this library currently has an unstable API (version 0.x.x).

Demo

https://perseids-tools.github.io/alignment-react/

Installation

yarn add alignment-react

Note that this package has the following peer dependencies:

{
  "react": "^16.0.0 || ^17.0.0"
}

(See project on npm.)

How to use

Demo

See the demo App.js.

Example

import {
  Alignment,
  Collapse,
  Sentence,
  Segment,
  Xml,
} from 'alignment-react';

import 'alignment-react/build/index.css';

const xml = `
<aligned-text xmlns="http://alpheios.net/namespaces/aligned-text">
    <language lnum="L1" xml:lang="eng"/>
    <language lnum="L2" xml:lang="fra"/>
    <sentence n="1">
        <wds lnum="L1">
            <comment class="uri"/>
            <w n="1-1">
                <text>Hello</text>
                <refs nrefs="1-1"/>
            </w>
            <w n="1-2">
                <text>world</text>
                <refs nrefs="1-2 1-3"/>
            </w>
        </wds>
        <wds lnum="L2">
            <comment class="uri"/>
            <w n="1-1">
                <text>Bonjour</text>
                <refs nrefs="1-1"/>
            </w>
            <w n="1-2">
                <text>le</text>
                <refs nrefs="1-2"/>
            </w>
            <w n="1-3">
                <text>monde</text>
                <refs nrefs="1-2"/>
            </w>
        </wds>
    </sentence>
</aligned-text>
`;


const App = () => (
  <Alignment alignment={xml}>
    <Sentence n="1">
      <Segment lnum="L1" />
      <Segment lnum="L2" />
      <Comments />
      <Collapse title="XML">
        <Xml />
      </Collapse>
    </Sentence>
  </Alignment>
);

export default  App;

Alignment

The <Alignment> component accepts an XML document of an alignment as an alignment prop. The other components should be children (or grandchildren, etc.) of the <Alignment> component.

Sentence

The <Sentence> component accepts a string n which represents the n of the sentence to display.

Segment

The <Segment> component shows the text of one of the languages. It takes an lnum prop for the lnum of the language to display.

Comments

The <Comments> component displays comments associated with any of the active words. If there are no comments, it does not render.

Xml

The <Xml> component displays the XML of the sentence.

Collapse

The <Collapse> component is provided for convenience. It is a button that displays or hides its children whenever it is clicked.

Development

Setup

git clone [email protected]:perseids-tools/alignment-react.git

then install development dependencies

yarn install

Running tests

Unit tests

yarn test

Running demo application

In one terminal window

yarn start

In another

cd example
yarn start

Building

yarn build

Deploying demo application

yarn build
yarn deploy

Publishing

yarn build
npm publish

(Make sure to update the version in package.json before publishing a new release.)

Upgrading Notes

This library was created using create-react-library version 3.1.1. See the documentation there for information about upgrading the underlying dependencies.