Skip to main content
Version: 1.0.2

Responsive

Overview

The Responsive component allows developers to render entirely different components or layouts depending on the active device breakpoint.
Unlike <Breakpoint>, which only hides or shows content, <Responsive> ensures only the correct component is rendered for the current screen size.

Preview

Desktop Layout

Installation

npx @mindfiredigital/ignix-ui add responsive

Usage

Basic Example

function Page() {
return (
<Responsive
mobile={<div>Mobile</div>}
tablet={<div>Tablet</div>}
desktop={<div>Desktop</div>}
fallback={<div>Default</div>}
/>
);
}

Different Layouts

function Dashboard() {
return (
<Responsive
mobile={<MobileNav />}
tablet={<TabletSidebar />}
desktop={<DesktopSidebar />}
fallback={<DefaultNav />}
/>
);
}

Props

PropTypeDefaultDescription
mobileReactNodenullComponent to render for mobile breakpoint.
tabletReactNodenullComponent to render for tablet breakpoint.
desktopReactNodenullComponent to render for desktop breakpoint.
fallbackReactNodenullComponent to render when no breakpoint-specific one is available.