ProviderPicker
从任意数量的服务商中选择:已连接的排在前面并显示密钥数量,其余随后。
Anthropic1 keyOpenAI2 keys
Amazon BedrockAssemblyAIAzureBaidu QianfanBasetenCartesiaCerebrasCloudflare AI GatewayCohereDeepgramDeepInfraDeepSeekFireworks AIGemini Enterprise Agent PlatformGoogle AI StudioGroqHugging FaceIONOS AI Model HubJina AIMiniMaxMistralMoonshotNebius Token FactoryNovita AINVIDIAOllama CloudOpenRouterOVHcloud AI EndpointsPerplexityQwenCloudReplicateSambaNovaScalewaySiliconFlowSpaceXStandard ComputeStepFunTencent TokenHubTogether AITypeSafeUpstageVeniceVercelVolcengine ArkVoyage AIZ.ai
function Grid() {
const [provider, setProvider] = useState<string | null>(null);
return (
<div className="w-512 max-w-full">
<ProviderPicker appearance="grid" aria-label="Provider" providers={providers} value={provider} onValueChange={setProvider} />
</div>
);
}import { ProviderPicker } from "@logicplanes/kaeso-ui";属性
allLabelstring仅限选择框:第一个选项表示不限特定服务商,例如“所有服务商”;选择它时报告
null。appearance"list" | "grid" | "select"用于对话框步骤的常开列表、用于对话框第一步并带有各提供商标志的图块,或打开该列表的胶囊按钮。
aria-labelstring没有可见标签时说明选择器的用途:它为列表命名;胶囊以它显示的服务商命名,并把这段文字读作它的描述。
autoFocusboolean仅限列表:出现时聚焦搜索框。
descriptionReactNode标签下方的一句帮助文字。
disabledboolean将其禁用:无法使用,并显示为变暗。
labelReactNode可见标签。
layout"horizontal" | "vertical"标签位于控件上方(
vertical)或旁边(horizontal)。onChoose((id: string) => void)使用
grid时:在按下或点击图块时调用,方向键移动选择时不调用,因此对话框步骤可以立即继续。onValueChange((id: string | null) => void)以选中服务商的 ID 调用;选择
allLabel时为null。optionalboolean在标签后加上“可选”,用于大多数字段为必填的表单。
orderedboolean按传入的顺序保留服务商,而不是按 A 到 Z 排序,适用于最后一项(例如“其他”)必须保持在末尾的列表。
placeholderstring搜索框的占位符;在没有
allLabel的胶囊按钮中,也是未选择时显示的文本。providersProviderPickerOption[]服务商:ID、名称、组织是否已连接它、简短提示(例如其密钥数量),以及没有标志的选项所用的图标,例如任何其他服务器。
requiredboolean在表单中将其标记为必填。
size"md" | "sm"仅限选择框:胶囊按钮的高度。
valuestring | null受控时选中服务商的 ID。