mirror of
https://github.com/grafana/grafana.git
synced 2025-09-22 21:33:50 +08:00

* migrate experimental to core grafana - update refs Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
23 lines
650 B
TypeScript
23 lines
650 B
TypeScript
import React from 'react';
|
|
|
|
import { EditorField, InlineField } from '@grafana/ui';
|
|
import { Props as InlineFieldProps } from '@grafana/ui/src/components/Forms/InlineField';
|
|
|
|
interface Props extends InlineFieldProps {
|
|
label: string;
|
|
inlineField?: boolean;
|
|
labelWidth?: number;
|
|
}
|
|
|
|
const DEFAULT_LABEL_WIDTH = 18;
|
|
|
|
export const Field = (props: Props) => {
|
|
const { labelWidth, inlineField, ...remainingProps } = props;
|
|
|
|
if (!inlineField) {
|
|
return <EditorField width={labelWidth || DEFAULT_LABEL_WIDTH} {...remainingProps} />;
|
|
} else {
|
|
return <InlineField labelWidth={labelWidth || DEFAULT_LABEL_WIDTH} {...remainingProps} />;
|
|
}
|
|
};
|