Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jangan's avatar

How to create a modal in Nova 4

Please help me out with making a modal for a custom tool for laravel nova 4.

I can make a deletemodal but that is as far as I have gotten, I would love to just get a skeleton on making a simple modal with any single input text field please and thank you very much.

0 likes
4 replies
jangan's avatar

@jlrdw I appreciate it thank you, but I'm trying to learn how to use Nova Components properly, and there is really no documentation on it, its why I was hoping to get an idea how to use it here

1 like
programandoDE's avatar

@jangan i feel you.

You can directly use the modal where you need it. It will be teleported to the right place inside nova.

Checkout the Nova Modal directly here: vendor/laravel/nova/resources/js/components/Modals/Modal.vue

Example

<Modal
    :show="show"
    maxWidth="screen-md"
    tabindex="-1"
    role="dialog"
>
<div>
  <ModalHeader v-text="'Headline of Modal'" class="bg-gray-100 dark:bg-gray-700" />

  // Your custom component
  <report :data="reportData"></report>

  <ModalFooter>
    <div class="flex items-center ml-auto">
      <CancelButton
          component="button"
          type="button"
          dusk="cancel-action-button"
          class="ml-auto mr-3"
          @click="onClose"
      />

      <DefaultButton
          type="submit"
          @click="onSubmit"
      >
        Submit
      </DefaultButton>
    </div>
  </ModalFooter>
</div>
</Modal>
5 likes

Please or to participate in this conversation.