You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

23 lines
553 B

import React from 'react';
import { SelectableValue } from '@grafana/data';
import { Seg } from './Seg';
import { unwrap } from './unwrap';
type Props = {
loadOptions: () => Promise<SelectableValue[]>;
allowCustomValue?: boolean;
onAdd: (v: string) => void;
};
export const AddButton = ({ loadOptions, allowCustomValue, onAdd }: Props): JSX.Element => {
return (
<Seg
value="+"
loadOptions={loadOptions}
allowCustomValue={allowCustomValue}
onChange={(v) => {
onAdd(unwrap(v.value));
}}
/>
);
};