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

@a4banana/react-layout-primitives

v2.0.0

Published

Flexible and type-safe React layout components inspired by Jetpack Compose

Downloads

481

Readme

React Layout Primitives

Flexible and type-safe React layout components inspired by Jetpack Compose's Row and Column.

Features

  • Type-safe - Full TypeScript support with exported constants for arrangement and alignment
  • React 19+ - Uses modern ref-as-prop pattern
  • Lightweight - Zero dependencies, minimal bundle size
  • Motion compatible - Works seamlessly with Motion for animations

Requirements

  • React 19.0.0 or later
  • Node.js 22.0.0 or later
  • TypeScript 5.7 or later (recommended)

Installation

npm install @a4banana/react-layout-primitives

Usage

Basic Usage

import {
  Row,
  Column,
  HorizontalArrangement,
  VerticalArrangement,
  HorizontalAlignment,
  VerticalAlignment,
} from '@a4banana/react-layout-primitives';

function App() {
  return (
    <Column
      gap={20}
      arrangement={VerticalArrangement.Center}
      alignment={HorizontalAlignment.Center}
    >
      <h1>Title</h1>
      <Row
        gap={10}
        arrangement={HorizontalArrangement.SpaceBetween}
        alignment={VerticalAlignment.Center}
      >
        <button>Left</button>
        <button>Right</button>
      </Row>
    </Column>
  );
}

With Motion

You can easily add animations using Motion:

npm install motion
import { motion } from 'motion/react';
import { Row, Column, HorizontalArrangement } from '@a4banana/react-layout-primitives';

// Create motion-enabled components
const MotionRow = motion.create(Row);
const MotionColumn = motion.create(Column);

function AnimatedLayout() {
  return (
    <MotionRow
      initial={{ opacity: 0, y: 20 }}
      animate={{ opacity: 1, y: 0 }}
      transition={{ duration: 0.3 }}
      gap={16}
      arrangement={HorizontalArrangement.SpaceBetween}
    >
      <MotionColumn
        initial={{ scale: 0.9 }}
        animate={{ scale: 1 }}
        gap={8}
      >
        <span>Item 1</span>
        <span>Item 2</span>
      </MotionColumn>
    </MotionRow>
  );
}

API

Row

Arranges children horizontally (flex-direction: row).

| Prop | Type | Default | Description | |------|------|---------|-------------| | arrangement | HorizontalArrangement | 'start' | Main axis distribution | | alignment | VerticalAlignment | 'stretch' | Cross axis alignment | | gap | number | 0 | Gap between children (px) | | as | ElementType | 'div' | Element to render as | | ref | Ref<HTMLElement> | - | Ref to DOM element |

Column

Arranges children vertically (flex-direction: column).

| Prop | Type | Default | Description | |------|------|---------|-------------| | arrangement | VerticalArrangement | 'top' | Main axis distribution | | alignment | HorizontalAlignment | 'stretch' | Cross axis alignment | | gap | number | 0 | Gap between children (px) | | as | ElementType | 'div' | Element to render as | | ref | Ref<HTMLElement> | - | Ref to DOM element |

Arrangement & Alignment Values

// Row arrangement (horizontal)
HorizontalArrangement.Start        // 'start'
HorizontalArrangement.End          // 'end'
HorizontalArrangement.Center       // 'center'
HorizontalArrangement.SpaceBetween // 'space-between'
HorizontalArrangement.SpaceAround  // 'space-around'
HorizontalArrangement.SpaceEvenly  // 'space-evenly'

// Column arrangement (vertical)
VerticalArrangement.Top            // 'top'
VerticalArrangement.Bottom         // 'bottom'
VerticalArrangement.Center         // 'center'
VerticalArrangement.SpaceBetween   // 'space-between'
VerticalArrangement.SpaceAround    // 'space-around'
VerticalArrangement.SpaceEvenly    // 'space-evenly'

// Row alignment (vertical)
VerticalAlignment.Top              // 'top'
VerticalAlignment.Center           // 'center'
VerticalAlignment.Bottom           // 'bottom'
VerticalAlignment.Stretch          // 'stretch'

// Column alignment (horizontal)
HorizontalAlignment.Start          // 'start'
HorizontalAlignment.Center         // 'center'
HorizontalAlignment.End            // 'end'
HorizontalAlignment.Stretch        // 'stretch'

License

MIT