Files
grafana/packages/grafana-ui/src/components/Input/utils.ts
T
Dominik Prokop f887576a27 Table panel: Make filter case insensitive (#39746)
* Expose FilterInput from grafana/ui

* Make table filter case insensitive

* Update packages/grafana-ui/src/components/Table/FilterList.tsx

Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>

Co-authored-by: Oscar Kilhed <oscar.kilhed@grafana.com>
Co-authored-by: Hugo Häggmark <hugo.haggmark@grafana.com>
2021-09-29 09:35:41 +02:00

10 lines
262 B
TypeScript

import { RefObject, useRef } from 'react';
export function useFocus(): [RefObject<HTMLInputElement>, () => void] {
const ref = useRef<HTMLInputElement>(null);
const setFocus = () => {
ref.current && ref.current.focus();
};
return [ref, setFocus];
}