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-responsive-linear-layout

v2.0.3

Published

A layout component that arranges children in a responsive single row or column using CSS flexbox.

Downloads

16

Readme

react-responsive-linear-layout NPM Package

ISC License

A layout component that arranges children in a responsive single row or column using CSS flexbox.

At it's core, this component is basically a CSS flexbox with responsiveness baked-in for you automatically when you use the provided custom CSS properties. As such, all CSS flexbox properties are valid when styling a ResponsiveLinearLayout. The component consists of some sensible CSS defaults as well as a few CSS custom properties (see the documented CSS custom properties below for more details) that make styling item gaps (I.E. margins) and sizing of elements quite a bit easier.

This component is built on top of react-linear-layout.

Storybook

Changelog

Install

$ npm install --save react-responsive-linear-layout

Basic Usage

Storybook Examples

MyResponsiveLinearLayoutComponent.jsx

import React from 'react';
import LinearLayout from 'react-linear-layout';
import ResponsiveLinearLayout from 'react-responsive-linear-layout';

import './MyResponsiveLinearLayoutComponent.css';


export default function MyResponsiveLinearLayoutComponent(props) {
  return (
    <ResponsiveLinearLayout {...props} className="layout" direction="horizontal">
      <a>Anchor 0</a>
      <a>Anchor 1</a>
      <a>Anchor 2</a>

      {/**
        * When embedding one ResponsiveLinearLayout inside another
        * (or inside a LinearLayout), an extra div is needed for
        * margins to be set correctly by both the wrapping layout
        * and the embedded layout
        */}
      <div>
        <ResponsiveLinearLayout className="embedded-layout" direction="vertical">
          <a>Sub Anchor 0</a>
          <a>Sub Anchor 1</a>
          <a>Sub Anchor 2</a>
        </ResponsiveLinearLayout>
      </div>
    </ResponsiveLinearLayout>
  );
}

MyResponsiveLinearLayoutComponent.css

.layout {
  --responsive-linear-layout-item-gap: 50x;
}

.inner-layout {
  --responsive-linear-layout-item-gap: 10px;
}

Output (Text Representation)

The component above will lay out it's children similar to the following (but will also
be responsive to sizing changes):

    |----------|----------|----------|----------------|
    | Anchor 0 | Anchor 1 | Anchor 2 ||--------------||
    |          |          |          || Sub Anchor 0 ||
    |          |          |          ||--------------||
    |          |          |          || Sub Anchor 1 ||
    |          |          |          ||--------------||
    |          |          |          || Sub Anchor 2 ||
    |          |          |          ||--------------||
    |----------|----------|----------|----------------|

API

Props

Any prop that is acceptable by a div component is acceptable by a ResponsvieLinearLayout component.

  • direction ?String - Default = "horizontal"

    The direction to arrange the component's children.

    Possible values:

    • "horizontal"
    • "horiz"
    • "h"
    • "vertical"
    • "vert
    • "v"
  • inline ?Boolean - Default = false

    Determines whether or not the layout should be treated as an inline element or a block element.

  • ref ?Function

    Forwarded ref to underlying DOM element.

CSS Custom Properties

  • --responsive-linear-layout-item-gap Same types as any "margin" CSS property

    Sets the gap (I.E. margin) between all direct children of a ResponsiveLinearLayout.

Immediate Children CSS Custom Properties

  • --responsive-linear-layout-item-size Same types as "width" or "height" CSS properties

    Sets the height (if direction = "vertical") or width (if direction = "horizontal") of all direct children of a ResponsiveLinearLayout.

  • --responsive-linear-layout-item-min-size Same types as "min-width" or "min-height" CSS properties

    Sets the minimum height (if direction = "vertical") or width (if direction = "horizontal") of all direct children of a ResponsiveLinearLayout.

  • --responsive-linear-layout-item-max-size Same types as "max-width" or "max-height" CSS properties

    Sets the maximum height (if direction = "vertical") or width (if direction = "horizontal") of all direct children of a ResponsiveLinearLayout.

License

ISC License (ISC)

Copyright (c) 2020, Brandon D. Sara (https://bsara.dev)

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.