Installing

Install the library

npm install @apideck/components

Getting started

Wrap your app in a

ModalProvider

import { ModalProvider } from '@apideck/components'

const App = ({ Component, pageProps }: AppProps) => {
  return (
    <ModalProvider>
      <Component {...pageProps} />
    </ModalProvider>
  )
}

export default App

Import the

useModal
hook and use it to open and close modals with the
addModal
and
removeModal
functions.

import { useModal } from '@apideck/components'

export default function MyComponent() {
  const { addModal } = useModal()

  return <button onClick={() => addModal('Yo world')}>Open</button>
}

Basic

You can pass the modal content as the first argument and any options as the second argument of the

addModal
function.

Loading

Props

Coming soon