Use Fullscreen
use-fullscreen allows to enter/exit fullscreen
Usage
Code EditorCopyimport { useFullscreen } from '@erudilabs/alma'
Default
const { toggle, fullscreen } = useFullscreen()
Code EditorCopy<Button onClick={toggle} theme={fullscreen ? 'danger' : 'primary'}> {fullscreen ? 'Exit Fullscreen' : 'Enter Fullscreen'} </Button>
Custom ref
const { ref, toggle } = useFullscreen()
Code EditorCopy<Fragment> <Image ref={ref} src="your-path-image" alt="Unsplash Image to make Fullscreen" width={800} height={600} /> <Button onClick={toggle} theme={fullscreen ? 'danger' : 'primary'} className="mt-4" > View Image Fullscreen </Button> </Fragment>
Definition
Code EditorCopyfunction useFullscreen<T extends HTMLElement = any>(): { readonly ref: (element: T | null) => void; readonly toggle: () => Promise<void>; readonly fullscreen: boolean; };