Grok Compose
A copy-paste block that recreates the Grok prompt stage with xAI's rail, brand mark, prompt surface, model menu, and tool toggles. The block is not a package component: copy the file, or install it with the shadcn CLI, then edit the layout like any other file in your project. It is assembled entirely from Agent UI compose primitives, and every control is keyboard accessible.
Source you own: install the block with the shadcn CLI or copy components/blocks/composes/grok-compose.tsx. The preview below is the real file, and the code tab is the exact source.
The code tab contains the full block, ready to copy.
Installation
Add the block with the shadcn CLI. It writes components/blocks/composes/grok-compose.tsx and installs its dependencies.
npx shadcn@latest add https://agent-ui-27t.pages.dev/r/grok-compose.jsonPrefer to own the file manually? Install the dependencies, then copy the source from the Files section.
pnpm add @agent-ui/react lucide-reactTailwind CSS v4 users: add @source "../node_modules/@agent-ui/react/src" to the global stylesheet so the library utilities are generated.
Usage
Import the copied file and render it anywhere. The block accepts onSend, disabled, and className; wire onSend to any backend.
import { GrokCompose } from "@/components/blocks/composes/grok-compose"; <GrokCompose onSend={(text) => console.log(text)} />Files
One file. The same source is served by the shadcn registry endpoint, so the CLI and the docs can never drift.
components/blocks/composes/grok-compose.tsxtsx"use client"; import * as React from "react";import { ArrowUp, Globe, Plus, Settings } from "lucide-react";import { ComposeDisclaimer, ComposeSendButton, ComposeTextarea, ModelChip, createCompose, useCompose, type ComposeProps,} from "@agent-ui/react"; const Root = createCompose({ id: "xai", maxWidth: "max-w-none", models: [ { id: "fast", name: "Fast", hint: "Grok 4.1" }, { id: "expert", name: "Expert", hint: "Reasons longer" }, { id: "heavy", name: "Heavy", hint: "Multi-agent" }, ], initialToggles: { search: false },}); function GrokMark({ className }: { className?: string }) { return ( <svg viewBox="0 0 24 24" className={className} aria-hidden="true" fill="none"> <path d="M20.6 3.4 3.4 20.6M3.9 3.9a7.7 7.7 0 0 1 10.9 0l5.3 5.3a7.7 7.7 0 0 1 0 10.9" stroke="currentColor" strokeWidth="1.7" strokeLinecap="round" /> </svg> );} /** Grok: near-white canvas, oversized soft composer, blue send, stark pills. */function GrokComposeLayout() { const { toggles, toggle } = useCompose(); return ( <div className="relative flex min-h-[400px] w-full flex-col bg-[#fafafa] px-6 pb-7 pt-4 text-[13px] text-[#0a0a0a]"> <div className="flex items-center"> <GrokMark className="h-6 w-6" /> <div className="ml-auto flex items-center gap-2"> <button type="button" aria-label="Settings" className="grid h-8 w-8 place-items-center rounded-full hover:bg-black/5" > <Settings className="h-4 w-4" aria-hidden="true" /> </button> <button type="button" className="rounded-full border border-black/[0.12] px-3.5 py-1.5 text-[11.5px] font-medium" > Sign in </button> <button type="button" className="rounded-full bg-[#0a0a0a] px-3.5 py-1.5 text-[11.5px] font-medium text-white" > Sign up </button> </div> </div> <div className="my-auto flex w-full flex-col items-center pt-4"> <h1 className="text-center text-[26px] font-semibold tracking-[-0.02em]"> What should we explore? </h1> <div data-agent-id="compose-card" className="mt-6 flex w-full max-w-[470px] flex-col rounded-3xl border border-black/[0.08] bg-white p-3.5 shadow-[0_2px_14px_rgba(0,0,0,0.05)] transition-[border-color,box-shadow] duration-200 focus-within:border-black/20 focus-within:shadow-[0_4px_24px_rgba(0,0,0,0.09)]" > <ComposeTextarea aria-label="Ask anything" placeholder="Switch to Build Mode to create apps" rows={2} className="min-h-[46px] px-1 py-1 text-[15px] leading-6 placeholder:text-black/40" /> <div className="mt-2 flex items-center justify-between gap-2"> <div className="flex items-center gap-1"> <button type="button" aria-label="Attach" className="grid h-8 w-8 place-items-center rounded-full text-[#0a0a0a] hover:bg-black/5" > <Plus className="h-[18px] w-[18px]" aria-hidden="true" /> </button> <button type="button" aria-label="Live search" aria-pressed={toggles.search} onClick={() => toggle("search")} className="flex items-center gap-1 rounded-full px-2 py-1.5 text-[11.5px] text-black/50 hover:bg-black/5 aria-pressed:bg-black/[0.06] aria-pressed:text-black" > <Globe className="h-3.5 w-3.5" aria-hidden="true" /> Live search </button> </div> <div className="flex items-center gap-2"> <ModelChip tone="light" className="[&>button]:h-7 [&>button]:px-1 [&>button]:text-[12px] [&>button]:text-black/70 [&>button]:hover:bg-transparent" /> <ComposeSendButton aria-label="Send message" className="h-8 w-8 bg-[#a9c8ff] text-white hover:bg-[#93b8fb] disabled:bg-[#a9c8ff] disabled:text-white disabled:opacity-100" icon={<ArrowUp className="h-[17px] w-[17px]" strokeWidth={2.4} />} /> </div> </div> </div> </div> <ComposeDisclaimer className="mt-0 text-[10px] text-black/50"> By messaging Grok, you agree to our{" "} <a href="#" className="underline"> Terms </a>{" "} and{" "} <a href="#" className="underline"> Privacy Policy </a> . </ComposeDisclaimer> </div> );} export function GrokCompose(props: ComposeProps) { return ( <Root {...props}> <GrokComposeLayout /> </Root> );} Built with
The block imports these Agent UI primitives. Each one is a package export with its own docs page, so you can change the layout without giving up the behaviour.
Accessibility
Grok also has a full product page.
Metadata, model list, and the same block in a dedicated route.
GrokCompose composes with MessageList, ChatShell, useChat, and the provider compose blocks. Browse the full reference or see all components in the gallery.
140 lines · copy-ready