Skip to content

SandboxedFrame

Stable

A locked box for a mini app made by someone else, with clear limits and asks before it does anything.

Also known as iframe, sandbox, embed, artifact frame

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

A small page that asks to open a link

Generated by Trip helper
  • Ask to open a link

What this can do. This page runs in a locked box and cannot see your account. It can ask to open a link, and it asks you every time.

The page tells us how tall it is, so the frame fits it. Press its button and the frame asks before opening the link.

When to use it

A locked box for a small page the assistant wrote itself, outside our approved parts. The page cannot see the account, and anything it asks for needs a yes from the person each time.

Made of: Generated by label · List of what the page asked for · The locked frame · Permission question (Allow, Don't allow) · What this can do line

Use it for

  • A mini app, like a budget calculator, that our approved parts cannot build.
  • A page from another site that should only show things.
  • A page that may ask to open a link or run a tool, with the person's approval.

Not for

  • A screen our approved parts can draw: use GenUIRenderer.
  • Asking for passwords or payment details.

Do and avoid

Generated by Trip helper

What this can do. This page runs in a locked box and cannot see your account. It can only show things on this screen.

Do. A locked box shows the page and says what it can do.
Generated by Trip helper

What this can do. This page runs in a locked box and cannot see your account. It can only show things on this screen.

Avoid. A made-up page asks for card details that nobody has checked.

Do

  • Use it only when our approved parts cannot do the job.
  • Declare exactly what the page may ask for, and keep the list short.
  • Keep the sandbox without allow-same-origin.
  • Show who made the page and what it can do, next to the frame.

Avoid

  • Don't build the page's HTML into our own page. Never use dangerouslySetInnerHTML for it.
  • Don't let the page open links or take steps without asking, even for permissions it declared.
  • Don't trust a message just because it says it is from the frame. Check who sent it and from where.
  • Don't ask for passwords or payment details inside a generated page.

On a phone

  • The frame fills the width, and the page inside decides its own layout, so build it for a narrow screen.
  • The frame height follows the page up to the maximum, 640px by default, and scrolls inside after that.
  • The permission buttons wrap under the question. They keep their size and have a 44px tap area on a touch screen.

Seen in products

  • MCP Apps: the app runs in a sandboxed iframe, talks to the host only through messages, declares permissions and can be asked for consent before it calls a tool.
  • MCP Apps: the host can turn off the app's ability to open links.
  • Claude Artifacts: generated pages run in a sandboxed frame on a separate origin.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started