mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
28 lines
683 B
TypeScript
28 lines
683 B
TypeScript
import React, { InputHTMLAttributes, FunctionComponent } from 'react';
|
|
import { Label } from '..';
|
|
|
|
export interface Props {
|
|
label: string;
|
|
inputProps: InputHTMLAttributes<HTMLInputElement>;
|
|
labelWidth?: number;
|
|
inputWidth?: number;
|
|
}
|
|
|
|
const defaultProps = {
|
|
labelWidth: 6,
|
|
inputProps: {},
|
|
inputWidth: 12,
|
|
};
|
|
|
|
const FormField: FunctionComponent<Props> = ({ label, labelWidth, inputProps, inputWidth }) => {
|
|
return (
|
|
<div className="gf-form">
|
|
<Label width={labelWidth}>{label}</Label>
|
|
<input type="text" className={`gf-form-input width-${inputWidth}`} {...inputProps} />
|
|
</div>
|
|
);
|
|
};
|
|
|
|
FormField.defaultProps = defaultProps;
|
|
export { FormField };
|