Apollo Elements Apollo Elements Guides API Blog Toggle darkmode

Generator: Component

Generate an Apollo Element

Example

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' \
    --skip-codegen
    --yes

Options

FlagDescriptionTypeDefault
--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
--yes, -yOptional subdir under src/componentsbooleanfalse
--skip-codegenSkip the codegen phasebooleanfalse
--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