Composition and API
Pass the method and url, plus optional headers and query records and a body value. The header renders a method badge colored by HTTP verb (GET, POST, PUT, PATCH, DELETE, with a neutral fallback) next to the monospace URL. The Headers, Query, and Body tabs switch the panel below; key:value records render as rows and the body is pretty-printed with JSON.stringify. defaultTab chooses which panel opens first, enableClipboard toggles the copy button, and labels overrides the tab and copy text. The separate animated entry adds fade and slide motion presets for the panel transition.
Accessibility
Each tab is a real button with aria-selected reflecting the active panel, so keyboard and screen-reader users can move between Headers, Query, and Body. The root and every region carry data-slot attributes for styling and testing, and the method badge exposes a data-method attribute with the uppercased verb. The animated entry's panel transition is short and easing-based; pair it with prefers-reduced-motion handling in your app where needed.
Next.js integration notes
The static HttpRequestViewer entry ships no framer-motion and is safe in any Server or Client Component tree (it is a Client Component because it tracks the active tab). The animated HttpRequestViewerAnimated entry imports framer-motion, which is an optional peer dependency — install it only if you use the animated entry. Both render deterministically from the same props, so server and client output match and there is no hydration mismatch.
FAQ
What request parts can it display?
The method and url in the header, plus optional headers and query records as key:value rows and a body value pretty-printed as JSON. Sections with no data show a muted empty-state line such as No headers.
How is the method badge colored?
The badge color is chosen from the uppercased method: GET, POST, PUT, PATCH, and DELETE each have a tone, and any other verb falls back to a neutral tone. Every tone is a themeable --zui-http-request-viewer-method-* token with a light fallback and a paired dark variant.
Do I need framer-motion?
Only for the animated entry. The default import from @zentauri-ui/zentauri-components/ui/http-request-viewer is framer-motion-free. Import HttpRequestViewerAnimated from the /animated subpath when you want fade or slide transitions between tabs, and install framer-motion as a peer dependency.
How do I theme the colors?
Override the --zui-http-request-viewer-* CSS variables (border, bg, fg, the per-method badge tones, tab, key, value, body, and more) on :root, a theme selector, or a wrapper. Each variable ships a light fallback and a paired -dark variant for dark mode.