Skip to main content
Version: 1.0.3

Responsive

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.

Desktop Layout

Installation

ignix add component responsive

Usage

import Responsive from '@ignix-ui/responsive';

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
mobileReact.ReactNode-Component to render for mobile breakpoint
tabletReact.ReactNode-Component to render for tablet breakpoint
desktopReact.ReactNode-Component to render for desktop breakpoint
fallbackReact.ReactNode-Component to render when no breakpoint-specific one is available