Components
Standalone mode selector pill button with built-in popover. Bring your own icons or omit them; renders a non-interactive label when given a single mode. Self-contained port from 21st.dev Agent Elements.
npx shadcn@latest add https://21st.dev/r/21stdev/mode-selectorLoading preview...
import { ModeSelector, type ModeOption } from "@/components/ui/mode-selector";
import { IconInfinity, IconListCheck, IconArrowUp } from "@tabler/icons-react";
const modes: ModeOption[] = [
{ id: "agent", label: "Agent", icon: IconInfinity },
{ id: "plan", label: "Plan", icon: IconListCheck },
];
export default function Demo() {
return (
<div className="flex items-center justify-center w-full min-h-screen bg-background p-8 overflow-hidden">
<div className="w-full max-w-md">
<div className="rounded-3xl border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-950 p-3 shadow-sm">
<input
type="text"
placeholder="Send a message…"
className="w-full bg-transparent px-2 py-1.5 text-sm text-neutral-900 dark:text-neutral-100 placeholder:text-neutral-400 dark:placeholder:text-neutral-500 outline-none"
/>
<div className="flex items-center justify-between mt-1">
<ModeSelector modes={modes} defaultValue="agent" />
<button
type="button"
aria-label="Send message"
className="flex items-center justify-center size-7 rounded-full bg-neutral-300 dark:bg-neutral-700 text-neutral-600 dark:text-neutral-300 transition-colors hover:bg-neutral-400 dark:hover:bg-neutral-600"
>
<IconArrowUp className="size-4" />
</button>
</div>
</div>
</div>
</div>
);
}
Loading preview...