Backpack breakpoint component.
npm install bpk-component-breakpoint --save-dev
import React from 'react';
import BpkBreakpoint, { BREAKPOINTS } from 'bpk-component-breakpoint';
export default () => (
<BpkBreakpoint query={BREAKPOINTS.MOBILE}>
{isActive => (isActive ? <span>Mobile viewport is active</span> : <span>Mobile viewport is inactive</span>)}
</BpkBreakpoint>
<BpkBreakpoint query={BREAKPOINTS.TABLET}>
<span>Tablet viewport is active</span>
</BpkBreakpoint>
);
Property | PropType | Required | Default Value |
---|---|---|---|
children | oneOfType(node, func) | true | - |
query | oneOf(BREAKPOINTS) | true | - |
legacy | bool | false | false |