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

react-flexylayout

v0.8.0

Published

React components for creating responsive flex layout inspired by [@angular/flex-layout](https://github.com/angular/flex-layout)

Downloads

33

Readme

React Flex Layout

React components for creating responsive flex layout inspired by @angular/flex-layout

Install

npm i -s react-flexylayout

API

The api provides 3 components: FlexProvider, FlexRow, , FlexItem

FlexProvider is just the simple provider you need to wrap around

FlexRow is the row or container around your items

FlexItem is a single item inside a FlexRow

FlexRow properties

  • layout: Defines the flow order of child items within a flexbox container <FlexRow layout="row" />
  • gap: Defines if child items within a flexbox container should have a gap <FlexRow gap="10px" />
  • align: Defines how flexbox items are aligned according to both the main-axis and the cross-axis, within a flexbox container <FlexRow align="flex-start stretch" />
  • element: you can specify the html element of FlexRow by default is div

FlexItem properties

  • size: This markup specifies the resizing of its host element within a flexbox container flow <FlexItem size="50%" />
  • align: Defines how flexbox items are aligned according to both the main-axis and the cross-axis, within a flexbox container <FlexItem align="flex-start stretch" />
  • offset: Offset a flexbox item in its parent container flow layout <FlexItem offset="15px" />
  • order: Defines the order of a flexbox item <FlexItem order="2" />
  • fill: Maximizes width and height of element in a layout container <FlexItem fill />
  • element: you can specify the html element of FlexItem by default is div

Responsive API

Out of the box the componet provides fallowing breakpoints

  • xs: "screen and (max-width: 599px)"
  • sm: "screen and (min-width: 600px) and (max-width: 959px)"
  • md: "screen and (min-width: 960px) and (max-width: 1279px)"
  • lg: "screen and (min-width: 1280px) and (max-width: 1919px)"
  • xl: "screen and (min-width: 1920px) and (max-width: 5000px)"

All props have according responsive version, when responsive version is not provided it uses default one. The sintaxis for those properties is [prop][breakpoint] like so sizeXs ( notice the uppercase of the breakpoint )

Example: <FlexItem size="50%" sizeXs="100%" sizeXl="25%" />

Example

import { FlexRow, FlexProvider, FlexItem } from "react-flexlayout";

function App() {
  return (
      <FlexProvider>
        <FlexRow layout="row wrap" gap="10px">
          <FlexItem size="80px" sizeXs="50%" order="2" orderXs="1">
            Item 1
          </FlexItem>
          <FlexItem size="80px" sizeXs="50%" order="1" orderXs="2">
            Item 2
          </FlexItem>
          <FlexItem size="50px" sizeXs="50%" align="end">
            Item 3
          </FlexItem>
        </FlexRow>
      </FlexProvider>
  );
}

Custom breakpoints

You can provide a config object to specify custom sizes and names for your media query breakpoints:

  • queries: Object containign media queries
  • behaviour: One of "replace" or "overrider", the default is replace.
    • override the whole default media queries has been overrided.
    • replace Its only update / append new media queries to default ones

Example

const config = {
  queries: {
    xs: "screen and (max-width: 700px)",
    sm: "screen and (min-width: 701px) and (max-width: 959px)",
  },
  behaviour: "replace",
};

<FlexProvider config={config}>
 <App />
</FlexProvider>

ToDo

  • Add types