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

xy-direction

v0.0.4

Published

## Why XY?

Readme

X and Y Components

Why XY?

The X and Y components provide a minimalistic and efficient approach to managing flexbox layouts in React. With a lightweight API, they eliminate boilerplate code and seamlessly integrate with both styled-components and @emotion/styled. Instead of repeatedly defining flex properties, X and Y offer intuitive horizontal and vertical layout utilities, making UI composition easier and more readable.

Key Benefits:

  • 🪶 Ultra Lightweight – Less than 1KB minified and gzipped (excluding peer dependencies).
  • 🚀 Less Boilerplate – No need to write repetitive flexbox styles.
  • 🎯 Lightweight – Minimal dependency footprint for better performance.
  • 🔧 Flexible – Works with both styled-components and @emotion/styled.
  • 📏 Consistent – Provides a structured way to handle layout spacing and alignment.

Installation

You can install the library for either styled-components or @emotion/styled:

For styled-components:

npm install @xy-direction/styled

For @emotion/styled:

npm install @xy-direction/emotion

Then, import and use the X and Y components:

import { X, Y } from "@xy-direction/styled"; // or "@xy-direction/emotion"

Usage

Row (X) and Column (Y) Components

<X gap="10px" padding="5px" margin="10px">
  <div>Row Item 1</div>
  <div>Row Item 2</div>
</X>

<Y g="10px" p="5px" m="10px">
  <div>Column Item 1</div>
  <div>Column Item 2</div>
</Y>

Props

| Prop | Type | Description | | ---------------- | ------- | ----------------------------------------------------------------- | | g | string | Sets the CSS gap property. | | gap | string | Alias for g. | | m | string | Sets the CSS margin property. | | margin | string | Alias for m. | | p | string | Sets the CSS padding property. | | padding | string | Alias for p. | | inline | boolean | Sets display: inline-flex if true, otherwise display: flex. | | wrap | boolean | Enables flex-wrap: wrap. | | shrink | boolean | Prevents flex shrinking (flex-shrink: 0). | | align | string | Sets align-items. | | alignItems | string | Alias for align. | | justify | string | Sets justify-content. | | justifyContent | string | Alias for justify. | | fullWidth | boolean | Sets width: 100%. | | fullHeight | boolean | Sets height: 100%. | | debug | boolean | Adds a red outline for debugging. |

Example with Debugging

<X debug gap="10px" padding="5px" margin="10px">
  <div>Debugging mode</div>
</X>

This will outline the X component in red to help visualize its dimensions.

Debugging with Theme

You can enable debugging globally using a theme:

import { ThemeProvider } from "styled-components"; // or "@emotion/react"
import { X } from "@xy-direction/styled";

const theme = { xyDebug: true };

<ThemeProvider theme={theme}>
  <X gap="10px" padding="5px" margin="10px">
    <div>Debugging with Theme</div>
  </X>
</ThemeProvider>;

When xyDebug is set to true in the theme, all X and Y components will display a red outline for debugging.

Without a Library

If you were to achieve the same layout without using styled-components or @emotion/styled, you would need to write CSS manually:

const X = ({ children, gap, padding, margin }) => (
  <div style={{ display: 'flex', flexDirection: 'row', gap, padding, margin }}>
    {children}
  </div>
);

const Y = ({ children, gap, padding, margin }) => (
  <div style={{ display: 'flex', flexDirection: 'column', gap, padding, margin }}>
    {children}
  </div>
);

<X gap="10px" padding="5px" margin="10px">
  <div>Row Item 1</div>
  <div>Row Item 2</div>
</X>

<Y gap="10px" padding="5px" margin="10px">
  <div>Column Item 1</div>
  <div>Column Item 2</div>
</Y>

License

MIT