Composable UI parts

Compose host-styled views from the same parts used by MCP Blocks widgets.

1.Compose a summary or document

InlineCard combines a Surface, a StatusPill, and a DataList. DocumentCard uses the same parts with aligned property rows. Install the parts on their own when you need to bring your own layout or actions.

npx shadcn@latest add https://mcpblocks.dev/r/surface.json https://mcpblocks.dev/r/status-pill.json https://mcpblocks.dev/r/data-list.json
import { Surface } from "@/components/ui/surface"
import { StatusPill } from "@/components/ui/status-pill"
import { DataList } from "@/components/ui/data-list"

<Surface as="section" className="space-y-3 p-4">
  <h2>Northwind Traders</h2>
  <StatusPill tone="info">Proposal</StatusPill>
  <DataList layout="aligned" items={[{ label: "Value", value: "$48,000" }]} />
</Surface>

2.Show a proposal and its outcome

ConfirmAction uses ChangePreview for the review and OutcomeCard for the result. ChangePreview accepts label, from and to values. Omit from to show a single proposed value. StatusUpdate is the general-purpose outcome banner underlying OutcomeCard.

npx shadcn@latest add https://mcpblocks.dev/r/change-preview.json https://mcpblocks.dev/r/outcome-card.json
import { ChangePreview } from "@/components/ui/change-preview"
import { OutcomeCard } from "@/components/ui/outcome-card"

<ChangePreview rows={[{ label: "Stage", from: "Proposal", to: "Negotiation" }]} />
<OutcomeCard
  status="unknown"
  description="The server hasn't returned a receipt."
  action={{ label: "Check again", onClick: write.checkAgain }}
/>

3.Edit in a panel

Sheet opens to the side at 36rem of available container width and to the bottom below that width. Give it the current view through background and pass the trigger ref through returnFocusRef. The sheet keeps keyboard focus inside while open and handles Escape. Pass canClose from a prepared write to keep the sheet open during a request or while its outcome is unknown.

npx shadcn@latest add https://mcpblocks.dev/r/field.json https://mcpblocks.dev/r/sheet.json
import { TextField, SelectField } from "@/components/ui/field"
import { Sheet } from "@/components/ui/sheet"

<Sheet
  open={open}
  onOpenChange={setOpen}
  title="Edit deal"
  canClose={write.canClose}
  returnFocusRef={triggerRef}
  background={<button ref={triggerRef} onClick={() => setOpen(true)}>Edit</button>}
>
  <TextField label="Deal name" defaultValue="Northwind Traders" />
  <SelectField label="Stage" defaultValue="Proposal">
    <option>Proposal</option>
    <option>Negotiation</option>
  </SelectField>
</Sheet>

Use Field to wrap your own native control. Use TextField and SelectField for a labelled 44px target and a control that inherits the host color scheme.