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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@purpurds/grid

v5.27.3

Published

import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";

Downloads

4,707

Readme

import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";

import * as GridStories from "./src/grid.stories"; import * as GridItemStories from "./src/grid.item.stories"; import packageInfo from "./package.json";

Grid

Version {packageInfo.version}

Showcase

Properties

Grid

Grid.Item

Installation

Via NPM

Add the dependency to your consumer app like "@purpurds/purpur": "^x.y.z"

Usage

The standard usage is to have multiple elements directly as children of the Grid component. It's also possible to only have one, to get the standard page padding, max width and prevent getting gaps between elements.

In MyApp.tsx

import "@purpurds/purpur/styles";

In MyComponent.tsx

Basic grid with same-width columns

import { Grid } from "@purpurds/purpur";

export const MyComponent = () => {
  return (
    <Grid colsSm={2} colsMd={4} colsLg={6}>
      <div>Grid item 1</div>
      <div>Grid item 2</div>
      <div>Grid item 3</div>
      <div>Grid item 4</div>
      <div>Grid item 5</div>
      <div>Grid item 6</div>
    </Grid>
  );
};

Basic grid with noGap

import { Grid } from "@purpurds/purpur";

export const MyComponent = () => {
  return (
    <Grid noGap colsMd={3}>
      <div>Grid item 1</div>
      <div>Grid item 2</div>
      <div>Grid item 3</div>      
    </Grid>
  );
};

Besides noGap, noColGap and noRowGap are also available

Advanced grid using nested grids

import { Grid } from "@purpurds/purpur";

export const MyComponent = () => {
  return (
    <Grid>
      <Grid colsSm={1} colsMd={3} colsLg={3}>
        <div>Grid item 1</div>
        <div>Grid item 2</div>
        <div>Grid item 3</div>
      </Grid>
      <Grid colsSm={1} colsMd={2} colsLg={2}>
        <div>Grid item 4</div>
        <div>Grid item 5</div>
      </Grid>
      <Grid colsSm={1} colsMd={2} colsLg={2}>
        <div>Grid item 6</div>
        <div>Grid item 7</div>
      </Grid>
    </Grid>
  );
};

Advanced grid using Grid.Item

import { Grid } from "@purpurds/purpur";

export const MyComponent = () => {
  return (
    <Grid>
      <Grid.Item colSpanSm={2} colSpanMd={5} colSpanLg={3}>
        Grid item 1
      </Grid.Item>
      <Grid.Item colSpanSm={2} colSpanMd={3} colSpanLg={9}>
        Grid item 2
      </Grid.Item>
      <Grid.Item colSpanSm={4} colSpanMd={2} colSpanLg={6}>
        Grid item 3
      </Grid.Item>
      <Grid.Item colSpanSm={4} colSpanMd={6} colSpanLg={6}>
        Grid item 4
      </Grid.Item>
    </Grid>
  );
};