Skip to main content

buttons

Description

Optional. An array of buttons for a modal box

Usage

buttons?: string[];

Default value

["cancel", "ok"]

Example

import { useState } from "react";
import { Modal, Text, Portal, Button } from "@svar-ui/react-core";

export default function Example() {
const [custom1, setCustom1] = useState(true);

function hideAll() {
setCustom1(false);
}

return (
<>
{custom1 && (
<Portal>
<Modal title="Custom Prompt" onConfirm={hideAll} buttons={["ok"]}>
<Text select={true} focus={true} value="Some" />
</Modal>
</Portal>
)}
</>
);
}

Related article: Providing the buttons functionality

Related sample: Messages