Show More
An expandable UI component that reveals hidden content on demand, optimizing space while maintaining accessibility and improving content management.
Installation
Install the component via the CLI in one command.
npx shadcn@latest add @intentui/show-more
Manual installation
Use this approach if you prefer to install and wire up the component yourself instead of using the CLI.
npm install react-aria-components tailwind-variants
Anatomy
Import the components and use them as shown below, adapting the structure to fit each component.
import { ChevronDownIcon } from "@heroicons/react/20/solid"
import { ShowMore } from "@/components/ui/show-more"
import { twMerge } from "tailwind-merge"
<ShowMore>
{({ isSelected }) => (
<>
Show {isSelected ? "less" : "more"}
<ChevronDownIcon
className={twMerge(
isSelected ? "rotate-180" : "",
"size-4 transition-transform duration-200"
)}
/>
</>
)}
</ShowMore>Examples
As text
While the default behavior utilizes a button for interactions, the ShowMore component can also be configured to function as a clickable text element.
Or continue with
Controlled
Gain fine-grained control over the ShowMore component's behavior. This setup ensures you can manage the expanded state externally, ideal for more complex interactions.
Orientation
The default orientation for the ShowMore component is horizontal. However, it can easily be adjusted to a vertical layout to suit different design needs.
Or
Component API
The ShowMore component expands and collapses overflowing content.
| Prop | Type | Default |
|---|---|---|
className | string | - |
orientation | "horizontal" | "vertical" | horizontal |
text | string | - |
See the React Aria for the full API reference.
Unlock the full power ofIntent UI Design
Build modern web apps faster with 1000+ resources across components, blocks, patterns, templates, and starter kits.