0.2.0 ā€¢ Published 3 years ago

react-breakpoint-widget v0.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
3 years ago

A react widget to help you view your breakpoints as you're developing and testing your app without having to use any dev tools

npm.io

šŸ  Homepage

Setting this tool up is as easy as installing this dependency and passing in your breakpoints for your app. This is meant to ONLY be used in development mode so please make sure to add any checks for dev/prod when adding this widget.

Preview

npm.io

Install

Yarn

$ yarn add -D react-breakpoint-widget

Npm

$ npm install -D react-breakpoint-widget

Import

import ResponsiveWidget, { BreakPoint } from 'react-breakpoint-widget';

Usage

<div>
  {process.env.NODE_ENV === 'development' && (
    <ResponsiveWidget breakPoints={breakpoints} />
  )}
</div>

Example of breakpoints

One thing to keep note of is that if you do not want a max breakpiont set on the last point, you can not set a maximum and it will automatically be taken care of.

const breakpoints: BreakPoint[] = [
  {
    minWidth: 0,
    maxWidth: 300,
    label: 'šŸ“± MobileSmall',
  },
  {
    minWidth: 301,
    maxWidth: 600,
    label: 'šŸ“± Mobile',
  },
  {
    minWidth: 601,
    maxWidth: 800,
    label: 'šŸ’» Tablet',
  },
  {
    minWidth: 801,
    label: ' šŸ–„ Desktop',
  },
];

API

Props

Prop NameDescription
breakPointsAn array of breakpoints that follow the BreakPoint interface
initialPositionPosition where the tool should be anchored to initially on screen

Author

šŸ‘¤ Muhamed Brifkani

Show your support

Give a ā­ļø if this project helped you!

šŸ“ License

Copyright Ā© 2021 Muhamed Brifkani. This project is MIT licensed.


This README was generated with ā¤ļø by readme-md-generator