wip js/ts examples

This commit is contained in:
Luke committed 2022-09-16 17:43:47 +02:00
1 parent 3aee4976c3
commit d44c42104e
7 files changed
+602 -163

No files matched your search

+25 -10
View File
@@ -2,23 +2,38 @@
title: Alert Dialog
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
Simple alert dialog that can display a message to the player.
Returns whether the player pressed the confirm button or canceled the dialog.
<Tabs>
<TabItem value='Lua'>
```lua
-- data: table
-- header: string
-- content: string
-- centered: boolean (optional)
-- cancel: boolean (optional)
lib.alertDialog(data)
```
</TabItem>
<TabItem value='JS/TS'>
```ts
import lib from '@overextended/ox_lib/client'
lib.alertDialog(data)
```
</TabItem>
</Tabs>
`header` - Dialog title.
`content` - Dialog body content, supports markdown.
`centered` - Centers the dialog vertically and horizontally.
`cancel` - Displays a cancel button (ESC is still available if this is not defined).
* data: `table` (`object`)
* header: `string`
* Dialog title.
* content: `string`
* Dialog body content, supports markdown.
* centered?: `boolean`
* Centers the dialog vertically and horizontally.
* cancel?: `boolean`
* Displays a cancel button (ESC is still available if this is not defined).
Returns `confirm` if the player pressed the confirm button, otherwise if the player pressed the cancel button
or has exited the dialog with ESC the return will be `cancel`.
@@ -36,4 +51,4 @@ local alert = lib.alertDialog({
print(alert)
```
![alert_dialog](https://i.imgur.com/TnUT3S1.png)
![alert_dialog](https://i.imgur.com/TnUT3S1.png)