- Accordion
- Agent Thinking
- Alert
- Alert Dialog
- Announcement
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Checkbox
- Checkbox Card
- Code Block
- Collapsible
- Color Picker
- Combobox
- Command
- Composer
- Composer Loader
- Context Menu
- Data Grid
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- File Upload
- Hover Card
- Input
- Input Group
- Input Otp
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Meter
- Native Select
- Navigation Menu
- Number Field
- Pagination
- Period Switcher
- Popover
- Progress
- Questionnaire
- Radio Card
- Radio Group
- Resizable
- Reveal
- Scroll Area
- Search Field
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Social Button
- Sonner
- Spinner
- Status Dot
- Switch
- Switch Card
- Table
- Tabs
- Tag Group
- Textarea
- Theme Toggle
- Time Field
- Toggle
- Toggle Group
- Tooltip
- Trace
- Tree View
- Agent Creator 01
- Agent Limits Card 01
- Agent Progress 01
- AI Chat 01
- AI Image Generation 01
- AI Profile 01
- Alerts Card 01
- Auth Card 01
- Calendar 01
- Composer 01
- Composer Attachments 01
- Composer Panel 01
- Finance Dashboard 01
- Home Dashboard 01
- Marketing Dashboard 01
- Medical Profile 01
- Meeting Scheduler 01
- Multi Agent Chat 01
- Notification Center 01
- Patient Info Card 01
- Project Board 01
- Questionnaire 01
- Settings Modal 01
- Sidebar 01
- Stat Cards 01
- Task List 01
- Web Search 01
- Activity Rings Card 01
- Area Chart Card 01
- Bar List Card 01
- Combo Chart Card 01
- Contributions Card 01
- Earnings Chart Card 01
- Funnel Chart Card 01
- Heatmap Chart Card 01
- Line Chart Card 01
- Most Active Days Card 01
- Orders Chart Card 01
- Radar Chart Card 01
- Radial Chart Card 01
- Revenue Chart Card 01
- Sankey Chart Card 01
- Scatter Chart Card 01
- Sleep Score Card 01
- Stage Bars Card 01
- Steps Card 01
Project details
The next review is scheduled for Tuesday.
Archived details
Release notes. The build moved to the new compiler, the settings page was rebuilt around the shared form fields, and the dashboard now keeps its filters between visits. Older exports are still available from the archive, and the migration guide covers the renamed options one by one.
Installation
$ pnpm dlx shadcn@latest add @cobalt/collapsible
Options
CollapsiblePeekkeeps its content in view while the collapsible is closed, clipped toheight(16rem by default), and shows all of it when open. Use it instead ofCollapsibleContentfor a long block such as code, where the first lines are worth showing. It must sit insideCollapsible, which now carries thegroup/collapsibleclass it reads.
Source
"use client";
import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
import { cn } from "cn";
import * as React from "react";
function Collapsible({ className, ...props }: CollapsiblePrimitive.Root.Props) {
return (
<CollapsiblePrimitive.Root
data-slot="collapsible"
className={(state) =>
cn(
"group/collapsible",
typeof className === "function" ? className(state) : className
)
}
{...props}
/>
);
}
function CollapsibleTrigger({
className,
...props
}: CollapsiblePrimitive.Trigger.Props) {
return (
<CollapsiblePrimitive.Trigger
data-slot="collapsible-trigger"
className={(state) =>
cn(
"cursor-pointer data-disabled:cursor-default",
typeof className === "function" ? className(state) : className
)
}
{...props}
/>
);
}
function CollapsibleContent({
className,
...props
}: CollapsiblePrimitive.Panel.Props) {
return (
<CollapsiblePrimitive.Panel
data-slot="collapsible-content"
className={(state) =>
cn(
"h-(--collapsible-panel-height) overflow-clip transition-[height,opacity,translate,filter] duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] data-ending-style:duration-200 data-starting-style:h-0 data-starting-style:opacity-0 data-ending-style:h-0 data-ending-style:opacity-0 motion-safe:data-starting-style:-translate-y-1 motion-safe:data-starting-style:blur-[4px] motion-safe:data-ending-style:-translate-y-1 motion-safe:data-ending-style:blur-[4px] motion-reduce:transition-none",
typeof className === "function" ? className(state) : className
)
}
{...props}
/>
);
}
// Content that stays in view while the collapsible is closed, clipped to
// `height`, and shows in full once it is open. Use it instead of
// CollapsibleContent for a long block such as code, where the first lines
// are worth showing. It must sit inside Collapsible.
// The height animates with the same timing as CollapsibleContent. CSS cannot
// transition to `auto`, so the full content height is measured and kept in
// --collapsible-peek-full. Until it is measured (first paint) the closed state
// falls back to a plain max-height clamp.
function CollapsiblePeek({
className,
height = "16rem",
style,
ref,
...props
}: React.ComponentProps<"div"> & { height?: string }) {
const innerRef = React.useRef<HTMLDivElement | null>(null);
const [full, setFull] = React.useState<number | null>(null);
React.useLayoutEffect(() => {
const el = innerRef.current;
if (!el) {
return;
}
const measure = () => {
setFull(el.scrollHeight + (el.offsetHeight - el.clientHeight));
};
measure();
// The box has a fixed height, so observe its children for size changes.
const observer = new ResizeObserver(measure);
const observeChildren = () => {
observer.disconnect();
for (const child of el.children) {
observer.observe(child);
}
};
observeChildren();
const mutations = new MutationObserver(() => {
observeChildren();
measure();
});
mutations.observe(el, { childList: true });
return () => {
observer.disconnect();
mutations.disconnect();
};
}, []);
return (
<div
ref={(node) => {
innerRef.current = node;
if (typeof ref === "function") {
ref(node);
} else if (ref) {
ref.current = node;
}
}}
data-slot="collapsible-peek"
data-measured={full === null ? undefined : ""}
style={
{
"--collapsible-peek": height,
...(full === null
? null
: { "--collapsible-peek-full": `${full}px` }),
...style,
} as React.CSSProperties
}
className={cn(
"relative overflow-hidden transition-[height] duration-250 ease-[cubic-bezier(0.22,1,0.36,1)] group-data-closed/collapsible:max-h-(--collapsible-peek) group-data-closed/collapsible:duration-200 data-measured:h-(--collapsible-peek-full) data-measured:max-h-none data-measured:group-data-closed/collapsible:h-[min(var(--collapsible-peek),var(--collapsible-peek-full))] motion-reduce:transition-none",
className
)}
{...props}
/>
);
}
export { Collapsible, CollapsibleTrigger, CollapsibleContent, CollapsiblePeek }; On this page