Code drawer
2 min
code drawer docid 9rc9lvirrezcwra8j4lit blocks display request examples and response samples in the right column of a two column layout use them to build interactive api documentation syntax you can add this component using either markdown or mdx \ codedrawer{title="endpoint name"} \ codeblocktabsexamples (code blocks with request examples) \ \ codeblocktabsresponses (code blocks with response examples) \ \ \<codedrawer title="endpoint name"> \<codeblocktabsexamples> (code blocks with request examples) \</codeblocktabsexamples> \<codeblocktabsresponses> (code blocks with response examples) \</codeblocktabsresponses> \</codedrawer> a code drawer consists of two sections codeblocktabsexamples for request examples codeblocktabsresponses for response samples each section can contain one or more fenced code blocks when multiple code blocks are present, they are automatically grouped into language tabs code drawers are rendered in the right column when used inside a two column layout mdx example the following example creates a code drawer with request examples in javascript, python, and bash, along with successful and error responses \<codedrawer title="create a user"> \<codeblocktabsexamples> ```javascript const response = await fetch('https //api example com/users', { method 'post', headers { 'content type' 'application/json', 'authorization' 'bearer sk live xxx' }, body json stringify({ name 'jane doe', email 'jane\@example com', role 'admin' }) }) const user = await response json() ``` ```python import requests response = requests post('https //api example com/users', json={ 'name' 'jane doe', 'email' 'jane\@example com', 'role' 'admin' }, headers={ 'authorization' 'bearer sk live xxx' }) user = response json() ``` ```bash curl x post https //api example com/users \\ h "content type application/json" \\ h "authorization bearer sk live xxx" \\ d '{"name" "jane doe","email" "jane\@example com","role" "admin"}' ``` \</codeblocktabsexamples> \<codeblocktabsresponses> ```json { "id" "usr abc123", "name" "jane doe", "email" "jane\@example com", "role" "admin", "createdat" "2026 04 01t10 00 00z" } ``` ```json { "error" "validation failed", "message" "email already exists", "code" 409 } ``` \</codeblocktabsresponses> \</codedrawer>
Have a question?
Our super-smart AI, knowledgeable support team and an awesome community will get you an answer in a flash.
To ask a question or participate in discussions, you'll need to authenticate first.