Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

Generator: Component

Generate an Apollo Element


npm init @apollo-elements -- \
  component \
    --type mutation \
    --name x-user-profile \
    --operation-name UpdateProfile
    --variables '$input: UpdateProfileInput!' \
    --fields 'updateProfile(input: $input) { id }' \
    --subdir user \
    --schema-path '#schema' \
    --shared-css-path '#components/shared.css' \


--helpShow helpboolean
--versionShow version numberboolean
--pkg-managerPreferred package managernpm|yarnnpm
--type, -tElement typequery|mutation| subscriptionquery
--name, -nCustom element tag namestring
--subdir, -dOptional subdir under src/componentsstring
--overwriteOverwrite existing filesbooleanfalse
--codegenRun codegen after scaffolding filesbooleantrue
--schema-pathOptional custom path to schema types filestring
--shared-css-pathOptional custom path to shared component styles filestring
--variablesOptional custom variables e.g. input: $UpdateUserInputstring
--fieldsOptional custom fields e.g. id name picture { alt url }string