Big Buttons
How to add big buttons to your application to improve navigation

The JS
Add this constant before the Single Sign On JS code. This will typically be on the first line of the custom JS in your Knack web application unless you are importing any JS libraries or scripts.
You must use backtick temporal literals (not single quotes) for the constant and the URL. You can read about temporal literals in the MDN documentation for more information.

For the bigButton() function, put it before the handlers.
For the handler, incorporate the constant with the JS below if you are redirecting to the same Knack application. This is so that if you have to copy the app for testing, the big button will redirect to the copied app URL.
The CSS
Big Buttons have shadow to show elevation and provide a 3D effect. They are also display: block so we can set width without clickable area extending the width of the page. We create a pointer hover and color effect when enabled and an opacity and cursor effect when disabled. These CSS classes only need to placed once on the CSS page and any buttons can use them. They can be called via JS or HTML.
Add these CSS classes if not already present. If we have a disable button it allows us to change the mouse pointer and set the Font Awesome icons throughout the app to the middle of the line vertically.
How to Implement Big Button code
Add Custom JS
When placing the JS, the function only needs to be placed once but you will need a new handler for each Rich Text view + Big Button that you have.
Things to change in JavaScript
Change the Button ID in the first set of parentheses to whatever is appropriate to name your button;
Change the View ID to match the corresponding Rich Text view where the big button will live;
Change the URL to the corresponding page that the button will redirect to. Make sure this uses back ticks.
Change the Font Awesome icon to match the theme of the button. Knack currently supports FA version 4 icons. You can also read more about FA icons here.
Change the Button Label of the button to the text that will be visible;
Add the
trueargument if you would like the button to open in a new tab;Add the
trueargument after the newTab argument if you would like the button to be disabled
Last updated
Was this helpful?

