{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"thread","title":"Thread","description":"Scrollable chat thread with stick-to-bottom scrolling and jump-to-bottom control","dependencies":["@radix-ui/react-slot","@hugeicons/react","@hugeicons/core-free-icons","use-stick-to-bottom"],"files":[{"path":"components/nexus-ui/thread.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { ArrowDown02Icon } from \"@hugeicons/core-free-icons\";\nimport { HugeiconsIcon } from \"@hugeicons/react\";\nimport { StickToBottom, useStickToBottomContext } from \"use-stick-to-bottom\";\n\nimport { cn } from \"@/lib/utils\";\n\ntype ThreadProps = React.ComponentProps<typeof StickToBottom>;\n\nfunction Thread({\n  className,\n  resize = \"smooth\",\n  initial = \"smooth\",\n  ...props\n}: ThreadProps) {\n  return (\n    <StickToBottom\n      data-slot=\"thread\"\n      className={cn(\"relative w-full h-full\", className)}\n      resize={resize}\n      initial={initial}\n      {...props}\n    />\n  );\n}\n\ntype ThreadContentProps = React.ComponentProps<typeof StickToBottom.Content>;\n\nfunction ThreadContent({ className, ...props }: ThreadContentProps) {\n  return (\n    <StickToBottom.Content\n      data-slot=\"thread-content\"\n      className={cn(\n        \"flex w-full flex-col gap-6 p-6\",\n        className,\n      )}\n      {...props}\n    />\n  );\n}\n\ntype ThreadScrollToBottomProps = React.ComponentProps<\"button\"> & {\n  asChild?: boolean;\n};\n\nfunction ThreadScrollToBottom({\n  asChild = false,\n  className,\n  children,\n  onClick,\n  ...props\n}: ThreadScrollToBottomProps) {\n  const { isAtBottom, scrollToBottom } = useStickToBottomContext();\n\n  if (isAtBottom) {\n    return null;\n  }\n\n  const Comp = asChild ? Slot : \"button\";\n\n  return (\n    <Comp\n      data-slot=\"thread-scroll-to-bottom\"\n      type={asChild ? undefined : \"button\"}\n      className={cn(\n        !asChild &&\n          \"absolute bottom-6 left-[50%] flex size-8 translate-x-[-50%] cursor-pointer items-center justify-center rounded-full border border-border bg-secondary text-muted-foreground shadow-sm transition-all hover:bg-border active:scale-95\",\n        className,\n      )}\n      onClick={(event) => {\n        scrollToBottom();\n        onClick?.(event);\n      }}\n      {...props}\n    >\n      {children ?? (\n        <HugeiconsIcon\n          icon={ArrowDown02Icon}\n          strokeWidth={2.0}\n          className=\"size-4.5\"\n        />\n      )}\n    </Comp>\n  );\n}\n\nexport { Thread, ThreadContent, ThreadScrollToBottom };\n","type":"registry:file","target":"~/components/nexus-ui/thread.tsx"}],"type":"registry:ui"}