@netdata/netdata-ui
Version:
netdata UI kit
42 lines (35 loc) • 800 B
Markdown
A container that follows a target element. Useful for implementing dropdowns, tooltips, popovers etc.
```typescript
interface DropProps extends FlexProps, AlignProps, StretchProps {
target: object
onClickOutside: Function
onEsc: Function
children: any
[]: any
}
```
```JSX
export const SimpleMenu = props => {
const ref = useRef()
return (
<Flex {...props}>
<Flex ref={ref} background="disabled" padding={[4]}>
Target
</Flex>
{ref.current && (
<Drop
target={ref.current}
align={{ top: "bottom", left: "left" }}
>
<Flex background="border" padding={[6]}>
Drop Contents
</Flex>
</Drop>
)}
</Flex>
)
}
```