2.2.3 • Published 4 years ago

@microsoft/fast-breakpoint-tracker-react v2.2.3

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

This project is no longer under active development.

FAST Breakpoint tracker React

A library for managing viewport breakpoints. Given a set of breakpoints, this component will monitor the width of the browser window and track the current active breakpoint.

Installation

npm i --save @microsoft/fast-breakpoint-tracker-react

Breakpoints

Breakpoints are expected as an array. Six default breakpoint values are provided for convenience:

const defaultBreakpoints = [0, 540, 768, 1084, 1400, 1779];

Setting custom breakpoint values

Custom breakpoint values are defined by setting the breakpoints value on the BreakpointTracker class with a new array of number values:

// Set the public static value to your custom breakpoints
BreakpointTracker.breakpoints = [0, 800, 1024, 1559];

Usage

import React from "react";
import BreakpointTracker from "@microsoft/fast-breakpoint-tracker-react";

export interface AppProps {}

class App extends React.Component<AppProps, {}> {
    render() {
        return (
            <BreakpointTracker
                render={breakpoint => (
                    <p>The current breakpoint is {breakpoint}</p>
                )}
            />
        );
    }
}
2.2.3

4 years ago

2.2.2

4 years ago

2.2.1

4 years ago

2.2.0

4 years ago

2.1.3

4 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago