ExitButton
Navigation button that terminates the form process immediately via sys.exit(0).
When pressed, ExitButton ends the entire Python process. No further code executes
after the form's run() call. This is useful for "Cancel" or "Exit" workflows where
the user wants to abandon the form entirely.
Unlike EndPageStep (which shows a final page with no buttons), ExitButton kills the process immediately from any page without showing additional content.
How It Works
- When the user clicks ExitButton, the form process is terminated via
sys.exit(0) - No validation is performed on the current page (the user explicitly chose to exit)
- Any code after
run()will NOT execute if ExitButton was clicked
Usage Pattern
ExitButton is returned alongside other buttons from a page function:
If the user clicks "Cancel", the process terminates immediately.
If the user clicks "Next", the form proceeds normally to next_page.
Common Use Cases
- Cancel flows: Allow users to abandon a form at any point
- Early exit: Let users leave when they decide the form isn't relevant
- Optional workflows: Provide an escape hatch for non-mandatory processes
Examples:
Add a cancel button to a multi-step form:
Parameters
| Name | Description | Type | Default |
|---|---|---|---|
| label | The text displayed on the button. Defaults to internationalized "Exit" text. | str | 'i18n_exit_action' |