Skip to content

Modal

PropData typeRequired?DefaultDescription
titlestringYesThe modal title
v-modeltrue | falseYesWhether the modal is open or not
template
<fw-modal v-model="open" title="My modal">
  Modal content
</fw-modal>

<fw-button @click="open = true">
  Open modal
</fw-button>

Use the #actions slot to add actions to a modal. Actions typically take the form of buttons.

template
<fw-modal v-model="open" title="My modal">
  Modal content

  <template #actions>
    <fw-button @click="open = false" color="secondary">
      Cancel
    </fw-button>

    <fw-button @click="open = false">
      Ok
    </fw-button>
  </template>
</fw-modal>

<fw-button @click="open = true">
  Open modal
</fw-button>

Nested modals

You can nest modals to allow users to open a modal from inside another modal. This can be useful when creating a multi-step workflow.

template
<fw-modal v-model="open" title="My modal">
  <fw-modal v-model="openNested" title="My modal">
    Nested modal content
  </fw-modal>

  <fw-button @click="openNested = true">
    Open nested modal
  </fw-button>
</fw-modal>

<fw-button @click="open = true">
  Open modal
</fw-button>

Alert inside modal

You can nest Funkwhale alerts to visually highlight content within the modal.

template
<fw-modal v-model="open" title="My modal">
  Modal content

  <template #alert v-if="alertOpen">
    <fw-alert>
      Alert content

      <template #actions>
        <fw-button @click="alertOpen = false">Close alert</fw-button>
      </template>
    </fw-alert>
  </template>
</fw-modal>

<fw-button @click="open = true">
  Open modal
</fw-button>