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

quickflex

v1.0.5

Published

A customizable Flexbox layout component for React and Typescript using Emotion.

Downloads

390

Readme

QuickFlex

quickflex is a lightweight, customizable Flexbox component built with React and Emotion. It simplifies the usage of Flexbox in your React applications by providing an easy-to-use component with flexible options.

Features

  • Simple, declarative API to manage Flexbox layouts
  • Full control over flex properties (justify, align, direction, wrap, gap)
  • Written in TypeScript, with full type safety
  • Lightweight and fast, optimized for performance
  • Easily extendable with className or inline style props
  • Not dependent on any CSS libraries or frameworks

Installation

You can install the package via npm:

npm install quickflex

Usage

The QuickFlex component is a wrapper around a div element with flex properties passed as props. Here’s an example of how to use it in a React project:

import React from 'react';
import { QuickFlex } from 'quickflex';

const App = () => {
  return (
    <QuickFlex
      justify="center"
      align="center"
      direction="row"
      wrap="wrap"
      gap="16px"
      style={{ height: '100vh' }}
    >
      <div>Item 1</div>
      <div>Item 2</div>
      <div>Item 3</div>
    </QuickFlex>
  );
};

export default App;

Example Explanation

  • The QuickFlex component allows you to set the justify, align, direction, wrap, and gap properties via props.
  • Additional styles can be passed using the style or className prop.

Props

Here are the available props for the QuickFlex component:

| Prop | Type | Options | Default | Description | | --------- | ------------------- | ------------------------------------------------------------------------------------------------------------- | -------------- | ------------------------------------------------------------------------ | | justify | string | "flex-start""flex-end""center""space-between""space-around""space-evenly" | "flex-start" | Refers: Justify-content | | align | string | "stretch""flex-start""flex-end""center""baseline" | "stretch" | Refers: align-items | | direction | string | "row""row-reverse""column""column-reverse" | "row" | Defines the direction in which the container's children are placed. | | wrap | string | "nowrap""wrap""wrap-reverse" | "nowrap" | Controls whether the children should wrap onto multiple lines. | | gap | string | - | "0" | Specifies the gap between the child elements. (e.g., gap="16px"). | | className | string | - | undefined | Optional class name to add custom classes. | | style | React.CSSProperties | - | undefined | Optional inline styles for custom layout |

Customization

The QuickFlex component is highly customizable through props. If you need more flexibility, you can also pass additional styles or classes:

Example with Custom Class

import React from 'react';
import { QuickFlex } from 'quickflex';

const App = () => {
  return (
    <QuickFlex className="custom-flex">
      <div>Custom styled item</div>
    </QuickFlex>
  );
};

// custom.css
.custom-flex {
  background-color: lightgray;
  padding: 20px;
  border-radius: 8px;
}

Example with Inline Styles

<QuickFlex
  justify="center"
  align="center"
  style={{ backgroundColor: "lightblue", padding: "20px" }}
>
  <div>Inline styled item</div>
</QuickFlex>

TypeScript Support

quickflex is written in TypeScript, providing full type safety and intellisense for all props.

import React from "react";
import { QuickFlex } from "quickflex";

const App: React.FC = () => {
  return (
    <QuickFlex justify="center" align="center" gap="10px">
      <div>Item 1</div>
      <div>Item 2</div>
    </QuickFlex>
  );
};

Development

Feel free to contribute or modify the package, just clone the repository and install dependencies:

git clone https://github.com/Khurshida-Meem/QuickFlex.git
cd QuickFlex
npm install

You can build the project with:

npm run build

Contributing

You are welcome for any contributions and ideas! Feel free to open issues or submit pull requests. Before contributing, make sure to run the tests and ensure that everything works as expected.

  • Fork the repository
  • Create a new branch (git checkout -b feature/your-feature)
  • Make your changes and commit them (git commit -am 'Add new feature')
  • Push the branch (git push origin feature/your-feature)
  • Create a pull request

Repository

You can find the source code at: GitHub Repo.

License

QuickFlex is MIT licensed.