npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sametozkale/prompt-input

v1.0.0

Published

A production-ready prompt input with agent selector, sources, file attach, and research mode

Readme

Prompt Input

A production-ready prompt input component with agent selector, sources toggle, file attach, and deep research mode.

Installation

npm install @sametozkale/prompt-input

Install peer dependencies if not already in your project:

npm install framer-motion @radix-ui/react-dropdown-menu @radix-ui/react-select lucide-react

Requires Tailwind CSS. Include the package in your Tailwind content so its classes are generated:

Tailwind v3 (e.g. tailwind.config.js):

module.exports = {
  content: [
    "./app/**/*.{js,ts,jsx,tsx,mdx}",
    "./components/**/*.{js,ts,jsx,tsx,mdx}",
    "./node_modules/@sametozkale/prompt-input/dist/**/*.js",
  ],
  // ...
};

Tailwind v4 (PostCSS / @config): ensure your content sources include the package, for example in your main CSS or config:

@import "tailwindcss";

@source "../node_modules/@sametozkale/prompt-input/dist/**/*.js";

Or in tailwind.config.ts: set content (or the v4 equivalent) to include "./node_modules/@sametozkale/prompt-input/dist/**/*.js".

Usage

When the user submits (send button or Cmd/Ctrl+Enter), onSubmit is called with the full PromptData. The component then clears the input. Use onSubmit to add the prompt to your chat and send it to your API. When Task is selected (instead of Agent), the placeholder shows "Describe a task to automate" unless you pass a custom placeholder.

import { useState } from "react";
import { AIPromptInput } from "@sametozkale/prompt-input";
import type { PromptData } from "@sametozkale/prompt-input";

function ChatPage() {
  const [messages, setMessages] = useState<{ role: "user"; text: string }[]>([]);

  const handleSubmit = (data: PromptData) => {
    setMessages((prev) => [...prev, { role: "user", text: data.text }]);
    // Component clears input automatically; call your API here
  };

  return (
    <div>
      {messages.map((m, i) => (
        <div key={i}>{m.text}</div>
      ))}
      <AIPromptInput
        onSubmit={handleSubmit}
        placeholder="What would you like to do?"
      />
    </div>
  );
}

API

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | onSubmit | (data: PromptData) => void \| Promise<void> | - | Called when the user submits (Cmd/Ctrl+Enter or send button). May be sync or async; the input is cleared after success. Add data.text to your chat in this handler. | | onVoiceRecord | (audio: Blob) => void | - | Called when voice recording finishes. Voice UI only: the component provides the button and recording state; actual capture (e.g. MediaRecorder) is app-specific—implement it and pass the resulting blob here. | | onFileAttach | (files: File[]) => void | - | Called when files are attached or removed | | onFileRejected | (rejected: File[]) => void | - | Called when one or more files are rejected (e.g. exceed maxFileSize) | | placeholder | string | "What would you like to do?" | Textarea placeholder. When agent is Task, the placeholder is "Describe a task to automate" unless overridden. | | maxLength | number | - | Max character length | | maxFileSize | number | - | Max file size in bytes per file. Files over this limit are rejected and onFileRejected is called. | | agents | AgentOption[] | DEFAULT_AGENTS | Agent options (Agent, Task). If empty, the agent selector is disabled and shows no options. | | researchModels | ResearchModelOption[] | DEFAULT_RESEARCH_MODELS | Research model options | | connectorSources | ConnectorSource[] | DEFAULT_CONNECTOR_SOURCES | Source options for the Sources menu | | className | string | "" | Additional CSS class for the root element | | disabled | boolean | false | Disable the component | | theme | "light" \| "dark" | "light" | Visual theme for the component |

PromptData

interface PromptData {
  text: string;
  agent: "task" | "agent";
  sourcesEnabled: boolean;
  connectorSources: string[];
  researchModel: "deep-research" | "fast" | "standard";
  attachedFiles: File[];
}

Exports

  • AIPromptInput – Main component
  • DEFAULT_AGENTS, DEFAULT_RESEARCH_MODELS, DEFAULT_CONNECTOR_SOURCES – Default option arrays
  • Types: PromptInputProps, PromptData, PromptTheme, AgentType, AgentOption, ResearchModelType, ResearchModelOption, ConnectorSource

Customization

The component uses Tailwind CSS classes. Override styles by passing a custom className or by configuring your Tailwind theme. Colors, borders, and typography can be adjusted to match your design system.

Links

License

MIT