-
-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Add Custom Button Text for each Step #89
Comments
Hi @digitalbridge - I like the idea but at this point in time its not possible, I'll flag this as a Horrible workaround would be to use JavaScript to inject custom text into the buttons after page load... (sorry...) |
I've successfully worked around this limitation by passing a component to class NextButtonText extends Component {
constructor(props: {}) {
super(props);
this.state = { text: 'Continue', }
}
render() {
return(this.state.text);
}
} class MySteps extends Component {
constructor(props: {}) {
super(props);
this.setNextButtonText = this.setNextButtonText.bind(this);
this.state = {
steps: [
{ name: 'StepOne', component: <StepOne setNextButtonText={ this.setNextButtonText } /> },
{ name: 'StepTwo', component: <StepTwo setNextButtonText={ this.setNextButtonText } /> },
]
};
}
setNextButtonText(value) {
if (this.nextButtonText) {
this.nextButtonText.setState({ text: value });
}
}
render() {
return (
<StepZilla
nextButtonText={<NextButtonText ref={(nbt) => { this.nextButtonText = nbt; }} />}
steps={this.state.steps} />
);
}
} |
@logankoester thats very smart, good job! I'll close this off for now. If someone else has the same request I'll reopen and activate the "Upvotes" tag. |
Another approach to this is to utilize the
|
Is it possible to somehow have different text on buttons on every step rather than the same throughout all steps? Would be great if you could, for example, have 'nextButtonText' value inside the definition of each component.
The text was updated successfully, but these errors were encountered: