Forms.tsx 801 B

1234567891011121314151617181920212223242526272829
  1. import React, { InputHTMLAttributes, FunctionComponent } from 'react';
  2. import { InlineFormLabel } from '@grafana/ui';
  3. export interface Props extends InputHTMLAttributes<HTMLInputElement> {
  4. label: string;
  5. tooltip?: string;
  6. children?: React.ReactNode;
  7. }
  8. export const QueryField: FunctionComponent<Partial<Props>> = ({ label, tooltip, children }) => (
  9. <>
  10. <InlineFormLabel width={8} className="query-keyword" tooltip={tooltip}>
  11. {label}
  12. </InlineFormLabel>
  13. {children}
  14. </>
  15. );
  16. export const QueryInlineField: FunctionComponent<Props> = ({ ...props }) => {
  17. return (
  18. <div className={'gf-form-inline'}>
  19. <QueryField {...props} />
  20. <div className="gf-form gf-form--grow">
  21. <div className="gf-form-label gf-form-label--grow" />
  22. </div>
  23. </div>
  24. );
  25. };