简体   繁体   中英

Dropdown control on Backstage scaffolder (or radio buttons)

I'm creating a template in the Backstage scaffolder and I need a way to present to the user an option selection UI, it can be a dropdown select or a group of radio buttons, something like that:

Name of your project ______
Include foo [ ]
CSS Processor |v|
 - None
 - SASS
 - Stylus

I couldn't find how to do the select part. The only dropdown that exists in the documentation is the Repository Picker, but it is a custom control, besides that, I could only find examples for type: string and type: boolean . Actually, there's something about type: array , but the example seems incomplete (or this type is not intended for what I'm looking for)

Is it possible to do without a custom component?

Ultimately I've managed to solve this by doing

  parameters:
    - title: My scaffolder
      properties:
        ...
        includeRequester:
          title: Include an API requester?
          type: string
          description: Should this module include an API requester? (REST or GraphQL)
          default: none
          enum:
            - none
            - rest
            - graphql

However, I couldn't figure out how to define labels for the options. Ideally, I had in mind something like

none: Don't include a requester
rest: Include a REST requester
graphql: Include a GraphQL requester

but it's OK, despite not having labels, it's working as expected.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM