> For the complete documentation index, see [llms.txt](https://leaf.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://leaf.js.org/api/sending/modal.md).

# Modal

Information of modal

## What is Modal?

It's a form that has 2 buttons (Y/N)

## Example

```javascript
import Modal from './src/api/packets/Modal.js'

const modal = new Modal()
.setId(69)
.setTitle('Player Modification')
.setContent('Enable fly command?')
.setButton1('Yes') // if player click this button, it will `true`
.setButton2('No')// if player click this button, it will `false`

modal.onResponse = (player, accepted) => {
    if(accepted)
        player.send('Modal: You accepted')
    else 
        player.send('Modal: You declined')
}

modal.execute(player)
```

## API

```typescript
interface Modal {
    setId(id: number)
    setTitle(title: string)    
    setContent(content: string)
    setButton1(btn: string)
    setButton2(btn: string)    
    
    abstract onResponse(player: Player, accepted: boolean)
    
    execute(player: Player)
}
```
