astralyxdev

Context Picker

AI chats

About

A dropdown menu for attaching files, docs or other context sources to an AI chat prompt, with search and multi-select ticks instead of a focus-stealing dialog.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Context Picker to your project and fits it to your theme.

Code

How Context Picker is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { ContextPicker } from "@/components/ui/context-picker";
import { FileCode, Globe, ImageIcon, Terminal } from "lucide-react";
import { useState } from "react";

function ContextPickerDemo() {
  const sources = [
    {
      id: "button",
      label: "button.tsx",
      group: "Open files",
      detail: "1-86",
      icon: <FileCode />,
    },
    {
      id: "styles",
      label: "styles.ts",
      group: "Open files",
      detail: "1-210",
      icon: <FileCode />,
    },
    {
      id: "index",
      label: "index.css",
      group: "Open files",
      icon: <FileCode />,
    },
    {
      id: "docs",
      label: "Tailwind v4 docs",
      group: "External",
      icon: <Globe />,
    },
    {
      id: "shell",
      label: "Terminal output",
      group: "External",
      icon: <Terminal />,
    },
    {
      id: "screenshot",
      label: "screenshot.png",
      group: "External",
      icon: <ImageIcon />,
      disabled: true,
    },
  ];
  const [attached, setAttached] = useState(["button"]);

  return (
    <div className="flex min-h-[320px] w-full items-start justify-center bg-background p-10">
      <ContextPicker
        sources={sources}
        selected={attached}
        onSelect={(id) => setAttached((a) => [...a, id])}
        onDeselect={(id) => setAttached((a) => a.filter((x) => x !== id))}
      />
    </div>
  );
}

export default ContextPickerDemo;

Dependencies

More by astralyxdev

View all
  • Rate Limit Meter

    Rate Limit Meter

    34
  • Note Graph

    Note Graph

    24
  • Checkout Summary

    Checkout Summary

    21
  • Migration List

    Migration List

    10
  • IP Cluster

    IP Cluster

    9
  • Budget Guard

    Budget Guard

    9
  • Prompt Versions

    Prompt Versions

    8
  • Attribution

    Attribution

    8

More in AI chats

View all
  • AI Actions

    AI Actions

    347
  • Aquarium Prompt

    Aquarium Prompt

    81
  • Agent Chat

    Agent Chat

    19
  • Commit

    Commit

    35
  • Color Picker

    Color Picker

    181
  • Message With Header And Delivery Status

    Message With Header And Delivery Status

    54
  • Message Thread

    Message Thread

    63
  • Research Report

    Research Report

    4