shaderscn

Search shaders

Jump to a shader or run an action.

All shaders

Pulsing Border Prompt

Component

An AI prompt input with modes and file drops, whose glow shows what it is doing: listening, thinking, streaming or failing.

Installation

npx shadcn@latest add https://shaderscn.com/r/pulsing-border-prompt.json

Usage

"use client"

import { useChat } from "@ai-sdk/react"

import { PulsingBorderPrompt } from "@/components/pulsing-border-prompt"

export function Chat() {
  const { sendMessage, status, stop } = useChat()

  return (
    <PulsingBorderPrompt
      status={status}
      onStop={stop}
      accept="image/*,.pdf"
      modes={[
        { value: "fast", label: "Fast", colors: ["#22d3ee", "#3b82f6"] },
        { value: "think", label: "Think", colors: ["#d915ef", "#0dc1fd"] },
      ]}
      onSubmit={({ text, files, mode }) => {
        const fileList = new DataTransfer()
        files.forEach((file) => fileList.items.add(file))
        sendMessage({ text, files: fileList.files }, { body: { mode } })
      }}
    />
  )
}