Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Split Layout GraphQL Query Hero Block for React

A showcase hero for a GraphQL gateway: the headline and the pitch with a Shine Button above a wide editor window in a hairline frame, with a schema explorer, a query that types itself in and its response.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

A showcase hero for Gridwire, a managed GraphQL gateway, on drafting lines. The headline and an announcement link sit at the start of the header, and the pitch with a Shine Button and an outline second action at the end; below it a wide editor window in a hairline frame with + marks on its corners shows a schema explorer, our TreeView, whose types (User, Post, Comment) open to their fields, a query in SyntaxText with numbered lines that comes in token by token, and the response the query returns. The page follows your theme; only the editor window is dark, like a code editor. For GraphQL platforms, API gateways, schema registries and backend-as-a-service tools.

FAQ

How do I change the query, the schema and the response?

The query is the QUERY string at the top of the file and the response is RESPONSE: write them as you would in an editor, and their lines and indentation are kept. The words in KEYWORDS are coloured as keywords. The schema explorer is the schema collection: each type has an id, a name and its fields as children; types in OPEN_TYPES start open. FILE names both the title bar and the query.

Does the schema explorer really open and close?

Yes. Click a type, or move to it with the arrow keys and press Enter, to show or hide its fields; the right and left arrows open and close it too, and typing a letter jumps to the next name that starts with it. Picking a field marks it but changes nothing in the query: listen to the tree's selection change to insert it in your own editor.

Why is the editor dark when the page is light?

The hero follows your theme, but a code editor is dark by nature, so only the editor carries the dark class (marked with a comment in the code) and everything inside takes the theme's dark tokens. Remove the class and the editor follows the page's mode like the rest of the hero. The Run button is drawn in foreground tones, so the Shine Button stays the one primary action.

How does a screen reader read the editor?

The editor is a figure named GraphQL editor. The schema explorer is a tree named Schema, with each type announced as expanded or collapsed. The query and the response are real text in regions named GetUser.graphql and Response, which take focus so a keyboard can scroll a long line; their line numbers are neither read out nor copied. The title bar is decoration, hidden from screen readers.

How does the editor fit on a phone?

The header stacks, headline first, then the pitch and the Shine Button, which sits well inside the first screen; the editor follows. Below sm the schema explorer is hidden so the query keeps the full width, and below lg the response is hidden. A line wider than the screen scrolls inside the code rather than widening the page.

What moves, and can I turn it off?

The header fades and rises in on load, the editor settles in just after it, and the query and response come in token by token once they're on screen. Types slide open in the explorer. It's all CSS, with no animation library. With reduced motion on, everything is there at once.

  • Pro

    Split API Playground Hero

    Code and terminal

    A showcase hero for a payments API: a headline, a Shine Button, a second action and three ticks, then a wide playground under its own rule: a POST request beside the 200 response, each JSON body writing itself out.

  • Pro

    A split hero for a database tool: the headline, a Shine Button and three ticks beside a wide schema editor that runs flush to the page's end rail, with a model sidebar and a diagram whose foreign keys link to the rows they reference.

  • Pro

    Code Window Hero

    Code and terminal

    A split hero for an API client generator on solid rails: a headline and a Shine Button beside a code window whose snippet comes in token by token, in a hairline frame with + marks.

  • Pro

    A split hero for an API: the headline, a Shine Button and three ticks beside a dark terminal with a request, a status and a JSON response that writes itself out, above a band of three figures.

  • Pro

    A showcase hero for a code editor: a centred headline, a Shine Button and three ticks above a wide editor window in a hairline frame, with a working file tree beside a sketched editor pane.

  • Pro

    A compact centred hero for a web framework: an install command with a copy button, two calls to action and a band of three stats.