Show Hide
Overview
ShowHide toggles element visibility using CSS display: none / display: revert. Unlike conditional rendering, the element stays in the DOM when hidden, preserving component state, form values, and scroll positions.
Usage
<div class="pm-show">Visible content</div><div class="pm-hide">Hidden content (stays in DOM)</div>import { ShowHide } from "@paramanu/utilities-react"
<ShowHide display={isVisible ? "show" : "hide"}> <div>Content that toggles visibility</div></ShowHide>Guidelines
- Use when you need to preserve internal state while hiding content
- Use conditional rendering (
{show && <Child />}) when you want to fully unmount pm-showusesdisplay: revertto preserve the element’s original display typepm-hideusesdisplay: none
API
| Prop | Type | Default | Description |
|---|---|---|---|
display | "show" | "hide" | "show" | The visibility state |