[英]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:我正在后台脚手架中创建一个模板,我需要一种向用户呈现选项选择 UI 的方法,它可以是下拉 select 或一组单选按钮,如下所示:
Name of your project ______
Include foo [ ]
CSS Processor |v|
- None
- SASS
- Stylus
I couldn't find how to do the select part.我找不到如何做 select 部分。 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
. 文档中存在的唯一下拉列表是 Repository Picker,但它是一个自定义控件,除此之外,我只能找到
type: string
和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)实际上,
type: array
有一些东西,但这个例子似乎不完整(或者这种类型不适合我正在寻找的东西)
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.但没关系,尽管没有标签,但它按预期工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.