brief.mdlogo.png
Chat
"use client"
import * as React from "react"
import { cn } from "@/lib/utils"
export type ChatComposerProps = Omit<
React.ComponentProps<"div">,
"children"
> & {
attachments?: React.ReactNode
input?: React.ReactNode
leading?: React.ReactNode
trailing?: React.ReactNode
}
/**
* Presentational chat composer shell. Pass your own input, actions, and
* attachments through the slots — this component only owns the chrome.
*/
export function ChatComposer({
attachments,
input,
leading,
trailing,
className,
...props
}: ChatComposerProps) {
return (
<div
data-slot="chat-composer"
className={cn(
"relative flex w-full flex-col gap-2 rounded-[28px] border border-border bg-card p-2 shadow-none outline-none",
"focus-within:border-border focus-within:shadow-none focus-within:outline-none focus-within:ring-0",
"dark:bg-card",
className
)}
{...props}
>
{attachments ? (
<div data-slot="chat-composer-attachments" className="px-1 pt-1">
{attachments}
</div>
) : null}
{input ? (
<div data-slot="chat-composer-input" className="min-w-0">
{input}
</div>
) : null}
{leading || trailing ? (
<div
data-slot="chat-composer-actions"
className="flex items-center justify-between gap-2"
>
<div
data-slot="chat-composer-leading"
className="flex min-w-0 items-center gap-1"
>
{leading}
</div>
<div
data-slot="chat-composer-trailing"
className="flex shrink-0 items-center gap-1"
>
{trailing}
</div>
</div>
) : null}
</div>
)
}