NextButton
Automatic navigation button for progressing to the next step in multi-step forms. NextButton is automatically added to forms when using multi-step workflows created with the run()
function. It handles forward navigation between form steps without requiring manual implementation. The button is automatically labeled with internationalized "Next" text that adapts to the user's language settings.
Automatic Behavior
- Auto-added: NextButton appears automatically on each step of a multi-step form (you don't need to import or create it)
- Smart positioning: Only shows when there are more steps ahead
- Internationalized: Button text automatically translates based on user locale
- State preservation: User input is preserved when navigating between steps
When to Use NextButton is ideal for:
- Linear workflows: Step-by-step data collection processes
- Wizards: Multi-step onboarding or configuration flows
- Progressive forms: Breaking long forms into manageable sections
- Data collection pipelines: Structured information gathering processes Unlike custom Button widgets, NextButton doesn't require state management or conditional logic - it's handled automatically by the form system.
Examples
Automatic Next Button
NextButton is automatically added to forms for navigation. This example shows a multi-step form where NextButton handles progression automatically
Example Code
from abstra.forms import EmailInput, TextInput, run
def step_1(state):
return [
TextInput("Enter your first name:", key="first_name"),
TextInput("Enter your last name:", key="last_name"),
]
def step_2(state):
return [
EmailInput("Enter your email:", key="email"),
TextInput("Enter your phone number:", key="phone"),
]
def step_3(state):
return [
TextInput(
f"Thank you {state.get('first_name', '')}! Any additional comments?",
key="comments",
)
]
# Run multi-step form - NextButton appears automatically on each step
result = run([step_1, step_2, step_3])
# Print the result
print(result)