0.10.1 • Published 3 years ago
@improv/preact-responsive v0.10.1
@improv/preact-responsive
Tiny preact bindings for @improv/responsive
.
Try it on codesandbox.io.
Getting Started
import { useResponsiveWidth } from "@improv/preact-responsive";
export function MyComponent(): JSX.Element | null {
// True if the viewport is at least the width of a common tablet.
const isTablet = useResponsiveWidth(ResponsiveWidth.Tablet);
return isTablet ? <div className={className}>I'm on a tablet! Or, maybe something bigger.</div> : null;
}
API
Includes the @improv/responsive API.
Hooks
useMediaQuery(query)
- Returns true if the media query matches.
- This hook supports all CSS media queries.
useResponsiveWidth(minWidth)
- Returns true if the min-width is met.
- This hook is a wrapper for
useMediaQuery(`(min-width: ${minWidth}px)`)
.
0.10.1
3 years ago
0.10.0
3 years ago
0.9.17
3 years ago
0.9.18
3 years ago
0.9.12
3 years ago
0.9.8
3 years ago
0.9.13
3 years ago
0.9.7
3 years ago
0.9.6-next.0
3 years ago
0.9.14
3 years ago
0.9.15
3 years ago
0.9.9
3 years ago
0.9.4
3 years ago
0.9.3
3 years ago
0.9.10
3 years ago
0.9.11
3 years ago
0.9.5
3 years ago
0.9.16
3 years ago
0.9.7-alpha.2
3 years ago
0.9.7-alpha.1
3 years ago
0.9.6-alpha.0
3 years ago
0.9.7-alpha.0
3 years ago
0.9.2
3 years ago
0.9.1
3 years ago
0.9.0
3 years ago
0.8.1
3 years ago
0.8.0
3 years ago
0.7.5
3 years ago
0.7.4
3 years ago
0.7.2
3 years ago
0.7.3
3 years ago
0.7.1
3 years ago
0.7.0
3 years ago
0.6.0
3 years ago