From 9cd97ce9beac73dd4c96135f754b19b0d863aad6 Mon Sep 17 00:00:00 2001 From: Konasov Dmitriy Date: Tue, 30 Apr 2024 10:18:03 +0200 Subject: [PATCH] docs for autohide --- react-ux-semantics-docs/docs/docs/autohide.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 react-ux-semantics-docs/docs/docs/autohide.md diff --git a/react-ux-semantics-docs/docs/docs/autohide.md b/react-ux-semantics-docs/docs/docs/autohide.md new file mode 100644 index 0000000..b32d0be --- /dev/null +++ b/react-ux-semantics-docs/docs/docs/autohide.md @@ -0,0 +1,40 @@ +--- +sidebar_position: 2 +title: Autohide +--- + +## General description + +Basic hook, that allows you to manage visiblity state of smth, e.g. dialog, modal or popup. Additionaly, it automatically hides after specified amount of time (default is 5000 ms.) + +## Usage example + +```jsx +export const ComponentWithVisiblityManagement = () => { + const [ isToastVisible, showToast, hideToast ] = useAutohide(200); + + return ( + <> + + + + ) +}; +``` + +## API + +### useAutohide + +```ts +declare function useShowable(time: number): [boolean, () => void, () => void]; +``` + +#### Arguments + +|arg|type|description| +|:--|:---|:----------| +|`time`|`number`|An interval, after which visibility will be changed to false| + + +Returns a tuple with current visibility status, show function and hide function. \ No newline at end of file