⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.
TypeScript agenticagileai-agentsbug-reportingbug-trackerganttissue-trackerjirajira-alternativekanbanlinearlinear-alternativeopen-sourceproduct-managementproject-managementroadmapself-hostedsprint-planningteam-collaborationtrello-alternative
import { type ReactNode } from 'react';
import { ChevronRight, type LucideIcon } from 'lucide-react';
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
// A borderless section of the agent form: a quiet header (optional leading icon, a
// title, an optional one-line hint) over the fields, separated from its neighbours by
// whitespace and a hairline divider under the header, not by a card. This follows the
// project's borderless-first rule (see DESIGN.md) instead of boxing every group.
//
// The header toggles the section. Open state is controlled by the parent, which keeps
// which sections are open in one place.
export function AgentFormSection({
icon: Icon,
title,
hint,
headerRight,
open,
onOpenChange,
children,
}: {
icon?: LucideIcon;
title: string;
hint?: string;
// Optional content pinned to the right of the header (e.g. a selected/total count).
headerRight?: ReactNode;
open: boolean;
onOpenChange: (open: boolean) => void;
children: ReactNode;
}) {
return (
<Collapsible open={open} onOpenChange={onOpenChange}>
<CollapsibleTrigger className="group/section flex w-full items-center gap-2.5 border-b border-border/60 pb-2.5 text-start">
{Icon && (
<Icon className="size-4 shrink-0 text-muted-foreground transition-colors group-hover/section:text-foreground" />
)}
<span className="min-w-0 flex-1">
<span className="text-sm font-medium">{title}</span>
{hint && <span className="block text-xs text-muted-foreground">{hint}</span>}
</span>
{headerRight && (
<span className="shrink-0 text-xs text-muted-foreground tabular-nums">{headerRight}</span>
)}
<ChevronRight
className={`size-4 shrink-0 text-muted-foreground/60 transition group-hover/section:text-muted-foreground ${
open ? 'rotate-90' : 'rtl:rotate-180'
}`}
/>
</CollapsibleTrigger>
<CollapsibleContent>
{/* Indented to the header's title column (past the icon), so the fields read
as belonging to the section above them. */}
<div className="space-y-4 ps-6 pt-4">{children}</div>
</CollapsibleContent>
</Collapsible>
);
}