Expandable Plan Rows
ProPlan rows with name, headline limit, price and action on one line, each opening in place to show its limits and grouped features. Use when feature lists are long and most visitors only need the price.
How it differs. Detail sits behind a disclosure on each row, so the collapsed list is a short price ladder. The buy action is outside the trigger and reachable without expanding.
Install
pnpm dlx shadcn@latest add @hazine/plan-rows-expandable-detailsAdds 1 file, 2 shadcn primitives (button, collapsible), 2 Hazine items (@hazine/heading, @hazine/use-controllable-state), and 1 package (lucide-react).
First time? Add the registry to components.json
{
"registries": {
"@hazine": {
"url": "https://api.hazine.dev/r/{name}.json",
"headers": { "Authorization": "Bearer ${HAZINE_TOKEN}" }
}
}
}Set HAZINE_TOKEN in your environment. The token comes with a Pro licence.
The source of a Pro item is not published on this site. It installs into your codebase with the same command once your registry entry carries a Pro token.
- components/blocks/plan-rows-expandable-details.tsx
- 449 lines
- 1 file
- 449 lines
pnpm dlx shadcn@latest add @hazine/plan-rows-expandable-detailsAdds 1 file, 2 shadcn primitives (button, collapsible), 2 Hazine items (@hazine/heading, @hazine/use-controllable-state), and 1 package (lucide-react).
Props12
- title
- string = "Four plans, one line each"
- plans
- Plan[] = DEFAULT_PLANS
- openPlans
- string[]
- Ids of the plans whose details are open.
- defaultOpenPlans
- string[] = []
- onOpenPlansChange
- (ids: string[]) => void
- type
- "single" | "multiple" = "multiple"
- "single" closes the open row when another one opens and hides the expand all control.
- currentPlan
- string
- Id of the plan the visitor is already on. Its action is replaced by a disabled "Current plan".
- currency
- string = "USD"
- ISO 4217 code.
- locale
- string = "en-US"
- loading
- boolean = false
- contactHref
- string = "#contact"
- Target of the action in the empty state.
- headingLevel
- HeadingLevel = 2
Also accepts every prop of Omit<React.ComponentProps<"section">, "title">.
Accessibility
- Pattern
- Disclosure (APG, opens in a new tab), Pricing structure, Landmarks and headings
- Keyboard
Keyboard support for Expandable Plan Rows Key Effect Tab Moves through expand all, then the plan name button and the action of each plan in order. A plan with no details has no button, and the disabled current plan action is skipped Enter or Space on a plan name Opens or closes the details of that plan. Focus stays on the button. In single mode the previously open plan closes Enter or Space on Expand all Opens every plan, or closes them all when all are open. Focus stays on the button and its label changes Enter on a plan action Follows the link for that plan, whether its details are open or not - Screen reader
Section labelled by its heading. Plans are list items whose heading wraps a button with aria-expanded and aria-controls. The buy link is a sibling of that button and is described by the plan name. Every feature carries hidden text saying whether it is included.
- Announces: All {count} plans expanded.
- Announces: All plans collapsed.
- Announces: Loading plans.
- Reduced motion
- The chevron turns without a transition and the loading skeleton does not pulse. Colour transitions only.
- Checked
- Not checked yet. Automated results appear here once CI has run.
Dependencies5
- button
- collapsible
- @hazine/heading
- @hazine/use-controllable-state
- lucide-react
Filled chips are registry items the CLI adds for you. Outlined chips are npm packages.
Tokens shipped0
None. The item is styled by the tokens your theme already has.