- Chapter 1: Why Agents Get Components Almost Right
- Understanding the behavior nobody sees
- Seeing the problem in a few lines
- Recognizing four kinds of easily missed work
- Treating behavior as a tested unit
- Seeing why this suits agents
- Previewing what we build
- Chapter 2: Your First Primitive
- Understanding what we are building
- Describing the component
- Finding the right import
- Testing it like a person
- Seeing what createFocusRecovery earns
- Running it in a real browser
- Understanding what Root renders
- Exercises
- Chapter 3: State, Actions and Slots
- Understanding the four fields
- Building a confirm button
- Testing the primitive on its own
- Knowing what the change log records
- Rendering it in React
- Writing a second primitive: read more
- Rendering on the server
- Understanding how parts are named
- Exercises
- Chapter 4: Rendering and Styling Parts
- Starting without styles
- Choosing the element
- Giving a control an accessible name
- Animating a popup
- Adding one line of setup
- Working with a Content Security Policy
- Styling the Atlas page
- Chapter 5: Ready-Made Components in Atlas
- Building ticket views with Tabs
- Adding a command menu
- Adding an assign dialog
- Handling a setup the dialog needed
- Meeting the agent bridge
- Driving a Select from data
- Keeping a popover open
- Chapter 6: State, Events and Change Details
- Choosing starting values and controlled values
- Reading the second argument
- Canceling an agent's change
- Understanding a controlled value that never changes
- Handling empty and multiple values
- Debugging changes
- Chapter 7: Forms, Fields and Validation
- Understanding the pieces of a field
- Building the new-ticket form
- Using the browser's validation
- Showing an error from the server
- Reading what the handler receives
- Checking what the accessibility tree shows
- Chapter 8: Lists, Popups and Notifications
- Using Combobox to type and find
- Using Select to choose from a few
- Using Menu to choose an action
- Using Command to type and run
- Using Toast to say that something happened
- Styling popups
- Reviewing keys at a glance
- Chapter 9: Sliders, Resizable Panels and Trees
- Using a Slider
- Using resizable panels
- Using a Tree
- Operating these components with an agent
- Reviewing all the results
- Chapter 10: What a Screen Reader Receives
- Reading the accessibility tree
- Reading the tree for Tabs
- Reading the tree for a Dialog
- Reading the tree for a Menu
- Finding the confirm button's flaw
- Checking live regions
- Following a checklist for any component
- Knowing what the tree cannot tell you
- Chapter 11: Testing Behavior
- Understanding four levels of testing
- Checking a pattern
- Reading a failure
- Understanding the warnings you will see
- Using the other checks in the kit
- Reading parts without a DOM
- Knowing what jsdom cannot tell you
- Chapter 12: Verifying in a Real Browser
- Understanding what jsdom leaves out
- Building the harness
- Finding what jsdom missed
- Browsing the gallery
- Listing every check
- Running three engines
- Knowing the limits of this approach
- Chapter 13: Server Rendering and Hydration
- Understanding the concern
- Running the check
- Inspecting what the server sent
- Watching hydration
- Reviewing all the results
- Reading the notes from the docs
- Repeating the check in Next.js
- Knowing what was not tested
- Chapter 14: Building Components with an Agent
- Finding the docs that travel with the package
- Using the setup prompt
- Describing the interaction, not the markup
- Checking the result
- Knowing what this book did not measure
- Chapter 15: Letting an Agent Use Your Interface
- Understanding why a bridge helps
- Creating the bridge
- Reading and changing values
- Running it in a real browser
- Routing a model's tool calls
- Connecting a model
- Choosing from a list
- Filling and submitting a form
- Exposing your own components
- Heeding a caution that is easy to miss
- Chapter 16: Permissions and Trust
- Refusing actions with allow
- Hiding components and redacting values
- Requiring a person
- Canceling in the component
- Knowing what allow does not do
- Following a permissions checklist
- Exercises
- Chapter 17: Recording and Undoing Changes
- Recording changes
- Undoing only the agent
- Handling a person's edit after the agent
- Stepping back and forward
- Knowing what history cannot do
- Working after an await
- Observing changes
- Exercises
- Chapter 18: WebMCP
- Understanding WebMCP
- Turning it on
- Listing the tools
- Running a tool
- Combining two layers of allow
- Knowing what was not tested
- Working without the flag
- Chapter 19: Putting Atlas Together
- Meeting the app
- Finding where the seams show
- Letting an agent do the same thing
- Knowing what undo cannot restore
- Reviewing all the results
- Knowing what was not tested
- Chapter 20: Case Study: An Agent Files a Ticket
- Defining the task
- Writing the policy
- Watching the run
- Undoing the result
- Seeing what this shows
- Knowing what was not tested
- Chapter 21: A Review Checklist for Agent-Built Interfaces
- Reviewing before accepting a component
- Reviewing before exposing an interface to an agent
- Learning from mistakes found while writing this book
- Chapter 22: Working with a Beta
- Pinning and rechecking
- Judging what looks more settled and what looks less
- Keeping your own seams
- Knowing what this book did not cover
- Upgrading safely
- Appendix A: Quick Reference
- Packages
- Imports used in this book
- Agent bridge
- Agent marks
- Change details
- Appendix B: Version Notes and Sources
- Appendix C: Exercise Solutions
- Exercise 2.1: Escape clears the search field
- Exercise 2.2: Why only the Clear button needs bind
- Exercise 3.1: A mute button
- Exercise 16.1: A policy for Title and Status
- Exercise 17.1: Record only one region
- Appendix D: The Components in the React Package
- Appendix E: Running Everything
- Install
- Simulated browser (jsdom)
- Real Chrome
- Native WebMCP
- Chapter by chapter
- Every check in the real-browser suites
- Appendix F: Glossary
- Appendix G: Answers to Questions
- Chapter 1: Why Agents Get Components Almost Right
- Chapter 2: Your First Primitive
- Chapter 3: State, Actions and Slots
- Chapter 4: Rendering and Styling Parts
- Chapter 5: Ready-Made Components in Atlas
- Chapter 6: State, Events and Change Details
- Chapter 7: Forms, Fields and Validation
- Chapter 8: Lists, Popups and Notifications
- Chapter 9: Sliders, Resizable Panels and Trees
- Chapter 10: What a Screen Reader Receives
- Chapter 11: Testing Behavior
- Chapter 12: Verifying in a Real Browser
- Chapter 13: Server Rendering and Hydration
- Chapter 14: Building Components with an Agent
- Chapter 15: Letting an Agent Use Your Interface
- Chapter 16: Permissions and Trust
- Chapter 17: Recording and Undoing Changes
- Chapter 18: WebMCP
- Chapter 19: Putting Atlas Together
- Chapter 20: Case Study: An Agent Files a Ticket
- Chapter 21: A Review Checklist for Agent-Built Interfaces
- Chapter 22: Working with a Beta
- Appendix H: Further Reading
- Chapter 1: Why Agents Get Components Almost Right
- Chapter 2: Your First Primitive
- Chapter 3: State, Actions and Slots
- Chapter 4: Rendering and Styling Parts
- Chapter 5: Ready-Made Components in Atlas
- Chapter 6: State, Events and Change Details
- Chapter 7: Forms, Fields and Validation
- Chapter 8: Lists, Popups and Notifications
- Chapter 9: Sliders, Resizable Panels and Trees
- Chapter 10: What a Screen Reader Receives
- Chapter 11: Testing Behavior
- Chapter 12: Verifying in a Real Browser
- Chapter 13: Server Rendering and Hydration
- Chapter 14: Building Components with an Agent
- Chapter 15: Letting an Agent Use Your Interface
- Chapter 16: Permissions and Trust
- Chapter 17: Recording and Undoing Changes
- Chapter 18: WebMCP
- Chapter 19: Putting Atlas Together
- Chapter 20: Case Study: An Agent Files a Ticket
- Chapter 21: A Review Checklist for Agent-Built Interfaces
- Chapter 22: Working with a Beta
Agent Interfaces with the Vercel UI SDK
Behaviors, primitives and agents
Learn the keyboard, focus and screen reader behavior that makes a component work, using Vercel's UI SDK. Then let an AI agent operate your app under rules you set.
Minimum price
$8.00
$9.00
You pay
Author earns
Buying multiple copies for your team? See below for a discount!
About
About the Book
A component is mostly behavior you cannot see in a screenshot: which keys move focus, what Escape does, where focus goes when a dialog closes, what a screen reader is told. Code from an AI coding agent often gets the visible part right and misses these. Vercel's UI SDK builds that behavior once, tests it, and lets you assemble components from it. It also gives an agent a way to read and operate your interface, under rules you write.
This book is about the UI SDK (the @ui-sdk/react and @ui-sdk/core packages), not the Vercel AI SDK. It is an independent book and is not affiliated with or endorsed by Vercel.
You follow one project, a small support console called Atlas. You write a primitive, then use readymade Tabs, Dialog, Command, Select, Combobox, Menu, Toast, Slider, Resizable and Tree. You build a form, read the accessibility tree, render on the server, and then let an agent use the app while your rules limit what it can do.
What is inside
- Defining a component as state, actions and slots, and rendering it in React
- Styling parts with data attributes
- Forms with validation and server errors
- Reading the accessibility tree
- Testing with simulated and real browsers
- Server rendering and hydration, including with Next.js
- An agent filling in a form and operating a whole app
- Allow rules, confirmation, hidden fields, history and undo
- WebMCP, for the browser's own agent
Who it is for
React and TypeScript developers who already use AI coding agents. You do not need to know accessibility. To run the examples you need Node.js and Google Chrome.
Team Discounts
Team Discounts
Get a team discount on this book!
Up to 3 members
- Minimum price
- $20.00
- Suggested price
- $22.00
Up to 5 members
- Minimum price
- $32.00
- Suggested price
- $36.00
Up to 10 members
- Minimum price
- $56.00
- Suggested price
- $63.00
Up to 15 members
- Minimum price
- $80.00
- Suggested price
- $90.00
Up to 25 members
- Minimum price
- $120
- Suggested price
- $135
Author
About the Author
Sandeep Kumar Patel is a senior web developer with more than 17 years of experience building web applications in object-oriented JavaScript and JSON. In 2012 he founded tutorialsavvy, a programming blog that developers have been reading ever since.
He is GATE-2005 Information Technology (IT) qualified and holds a Master's degree from VIT University, Vellore.
Contents
Table of Contents
Get the free sample chapters
Click the buttons to get the free sample in PDF or EPUB, or read the sample online here
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.