mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Grafana UI: Add forwardRef (#22466)
This commit is contained in:
parent
f92f657f17
commit
62d86c956f
@ -1,4 +1,4 @@
|
||||
import React, { FC, HTMLProps } from 'react';
|
||||
import React, { HTMLProps, forwardRef } from 'react';
|
||||
import { GrafanaTheme } from '@grafana/data';
|
||||
import { css, cx } from 'emotion';
|
||||
import { stylesFactory, useTheme } from '../../../themes';
|
||||
@ -26,13 +26,13 @@ const getTextAreaStyle = stylesFactory((theme: GrafanaTheme, invalid = false) =>
|
||||
};
|
||||
});
|
||||
|
||||
export const TextArea: FC<Props> = ({ invalid, size = 'auto', ...props }) => {
|
||||
export const TextArea = forwardRef<HTMLTextAreaElement, Props>(({ invalid, size = 'auto', ...props }, ref) => {
|
||||
const theme = useTheme();
|
||||
const styles = getTextAreaStyle(theme, invalid);
|
||||
|
||||
return (
|
||||
<div className={inputSizes()[size]}>
|
||||
<textarea className={styles.textarea} {...props} />
|
||||
<textarea ref={ref} className={styles.textarea} {...props} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user