Confirm
A focusable inline yes/no control with two-way model binding and customizable labels for each state.
Import
import { Confirm } from '@sigx/terminal';
Usage
/** @jsxImportSource @sigx/terminal */
import { component, defineApp, signal, Confirm } from '@sigx/terminal';
const App = component(() => {
const overwrite = signal(false);
return () => (
<box border="single" label="Confirm">
<Confirm
model={() => overwrite}
label="Overwrite the existing file?"
activeLabel="Yes"
inactiveLabel="No"
autofocus
onSubmit={(v) => console.log('decided:', v)}
/>
</box>
);
});
defineApp(<App />).mount({ clearConsole: true });
Props
| Prop | Type | Notes |
|---|---|---|
model | Model<boolean> | two-way bound choice |
label | string | the question |
activeLabel | string | label for true |
inactiveLabel | string | label for false |
autofocus | boolean | grab focus on mount |
Events
| Event | Payload | When |
|---|---|---|
change | boolean | the selection flips |
submit | boolean | Enter |
See also
- confirm() prompt — the imperative wizard form.
- Checkbox — a plain boolean toggle.
