Scroll Button
prompt-kit/scroll-buttonFreeComponent
A floating button component that appears when users scroll up in a container, allowing them to quickly return to the bottom of the content
Live preview
live · rendered by the registry
Rendered by prompt-kit on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://raw.githubusercontent.com/ibelick/prompt-kit/HEAD/public/c/scroll-button.jsonSource
1"use client"23import { Button, buttonVariants } from "@/components/ui/button"4import { cn } from "@/lib/utils"5import { type VariantProps } from "class-variance-authority"6import { ChevronDown } from "lucide-react"7import { useStickToBottomContext } from "use-stick-to-bottom"89export type ScrollButtonProps = {10 className?: string11 variant?: VariantProps<typeof buttonVariants>["variant"]12 size?: VariantProps<typeof buttonVariants>["size"]13} & React.ButtonHTMLAttributes<HTMLButtonElement>1415function ScrollButton({16 className,17 variant = "outline",18 size = "sm",19 ...props20}: ScrollButtonProps) {21 const { isAtBottom, scrollToBottom } = useStickToBottomContext()2223 return (24 <Button25 variant={variant}26 size={size}27 className={cn(28 "h-10 w-10 rounded-full transition-all duration-150 ease-out",29 !isAtBottom30 ? "translate-y-0 scale-100 opacity-100"31 : "pointer-events-none translate-y-4 scale-95 opacity-0",32 className33 )}34 onClick={() => scrollToBottom()}35 {...props}36 >37 <ChevronDown className="h-5 w-5" />38 </Button>39 )40}4142export { ScrollButton }
What it pulls in
npm packages
Other registry items
Files it writes
More from prompt-kit
All 23 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Chain Of Thoughtchain-of-thought | prompt-kit | Components | Free | 1 dep | |
| Chat Containerchat-container | prompt-kit | Components | Free | 1 dep | |
| Code Blockcode-block | prompt-kit | Components | Free | 1 dep | |
| Feedback Barfeedback-bar | prompt-kit | Components | Free | 1 dep | |
| File Uploadfile-upload | prompt-kit | Components | Free | no deps | |
| Imageimage | prompt-kit | Components | Free | no deps | |
| Jsx Previewjsx-preview | prompt-kit | Components | Free | 1 dep | |
| Loaderloader | prompt-kit | Components | Free | no deps |
