Skip to main content
Version: 1.0.3

Breakpoint

The Breakpoint component provides a declarative way to conditionally render content based on the current viewport size. It eliminates the need for CSS media queries in your React components.

Example: Responsive Navigation

Resize your browser window to see the navigation change between mobile and desktop views.

Installation

ignix add component breakpoint

Usage

Import the component:

import { Breakpoint } from '@ignix-ui/breakpoint';

Basic Usage

<Breakpoint show="mobile">
<p>This content is visible only on mobile devices.</p>
</Breakpoint>
<Breakpoint hide="desktop">
<p>This content is hidden on desktop devices.</p>
</Breakpoint>
<Breakpoint from="tablet" to="desktop">
<p>This content is visible on tablet and desktop viewports.</p>
</Breakpoint>

Examples

Show Content on Mobile

<Breakpoint show="mobile">
<p>This content is visible only on mobile devices.</p>
</Breakpoint>

Hide Content on Desktop

<Breakpoint hide="desktop">
<p>This content is hidden on desktop devices.</p>
</Breakpoint>

Render Content Between Tablet and Desktop

<Breakpoint from="tablet" to="desktop">
<p>This content is visible from the start of tablet up to the end of desktop viewports.</p>
</Breakpoint>

Props

PropTypeDefaultDescription
show"mobile" | "tablet" | "desktop"-Render content only on the specified device.
hide"mobile" | "tablet" | "desktop"-Hide content on the specified device.
from"mobile" | "tablet" | "desktop"-Render content starting from the beginning of this breakpoint.
to"mobile" | "tablet" | "desktop"-Render content up to the end of this breakpoint.
childrenReact.ReactNode-Content to be conditionally rendered.