Button
A Button should be used if you want the user to be able to perform an action, for example: opening or closing dialogs, creating, editing or deleting an item, starting or stopping a process. You can use Buttons in a variety of formats and colors depending on the priority and type of the action.
Default
Copy Pug Copy HTML Open in playground Show code Hide code.e-btn
<button class="e-btn">
Button Button
</button>
<input class="e-btn" type="submit" value="Submit">
<input class="e-btn" type="button" value="Button">
<a class="e-btn" href="#">
Link Button
</a><button class="e-btn">
Button Button
</button>
<input class="e-btn" type="submit" value="Submit">
<input class="e-btn" type="button" value="Button">
<a class="e-btn" href="#">
Link Button
</a>Variations
Dropdown Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-dropdown
<div class="e-btn e-btn-dropdown">
Button with Dropdown
</div><div class="e-btn e-btn-dropdown">
Button with Dropdown
</div>Only icon Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-onlyicon
<div class="e-btn e-btn-onlyicon">
<e-icon icon="cog"></e-icon>
</div><div class="e-btn e-btn-onlyicon">
<e-icon icon="cog"></e-icon>
</div>On overlay Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-on_overlay
<div class="e-btn e-btn-on_overlay e-btn-onlyicon">
<e-icon icon="cog"></e-icon>
</div><div class="e-btn e-btn-on_overlay e-btn-onlyicon">
<e-icon icon="cog"></e-icon>
</div>Loading with icon Copy Pug Copy HTML Open in playground Show code Hide code.e-btn__loading
<div class="e-btn" id="button-loading-has-icon">
<div class="e-btn__loading">
<e-spinner data-size="small"></e-spinner>
<e-icon icon="cog"></e-icon>
</div>
Edit Selected
</div><div class="e-btn" id="button-loading-has-icon">
<div class="e-btn__loading">
<e-spinner data-size="small"></e-spinner>
<e-icon icon="cog"></e-icon>
</div>
Edit Selected
</div>document.getElementById('button-loading-has-icon').addEventListener('click', toggleLoading);
Loading only icon Copy Pug Copy HTML Open in playground Show code Hide code.e-btn__loading
<div class="e-btn e-btn-onlyicon" id="button-loading-only-icon">
<div class="e-btn__loading">
<e-spinner data-size="small"></e-spinner>
<e-icon icon="cog"></e-icon>
</div>
</div><div class="e-btn e-btn-onlyicon" id="button-loading-only-icon">
<div class="e-btn__loading">
<e-spinner data-size="small"></e-spinner>
<e-icon icon="cog"></e-icon>
</div>
</div>document.getElementById('button-loading-only-icon').addEventListener('click', toggleLoading);
Loading without icon Copy Pug Copy HTML Open in playground Show code Hide code.e-btn__loading
<div class="e-btn" id="button-loading-without-icon">
<div class="e-btn__loading">
<e-spinner data-size="small"></e-spinner>
</div>
Edit Selected
</div><div class="e-btn" id="button-loading-without-icon">
<div class="e-btn__loading">
<e-spinner data-size="small"></e-spinner>
</div>
Edit Selected
</div>document.getElementById('button-loading-without-icon').addEventListener('click', toggleLoading);
Loading overlay Copy Pug Copy HTML Open in playground Show code Hide code.e-btn__loading
<div class="e-btn e-btn-primary e-btn-has_overlay" id="button-loading-overlay">
<div class="e-btn__loading">
<e-spinner data-size="small"></e-spinner>
</div>
Edit Selected
</div><div class="e-btn e-btn-primary e-btn-has_overlay" id="button-loading-overlay">
<div class="e-btn__loading">
<e-spinner data-size="small"></e-spinner>
</div>
Edit Selected
</div>document.getElementById('button-loading-overlay').addEventListener('click', toggleLoading);
Size variations
Small Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-small
<div class="e-btn e-btn-small">
Small Button
</div><div class="e-btn e-btn-small">
Small Button
</div>Large Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-large
<div class="e-btn e-btn-large">
Large Button
</div><div class="e-btn e-btn-large">
Large Button
</div>Large extended Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-large.e-btn-extended
<button class="e-btn e-btn-large e-btn-extended">
Extended Button
<small>
Second Row
</small>
</button><button class="e-btn e-btn-large e-btn-extended">
Extended Button
<small>
Second Row
</small>
</button>Narrow Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-narrow
<button class="e-btn e-btn-narrow">
Extended Button
</button><button class="e-btn e-btn-narrow">
Extended Button
</button>Narrow with icon Copy Pug Copy HTML Open in playground Show code Hide codee.btn-onlyicon.e-btn-narrow
<div class="e-btn e-btn-onlyicon e-btn-narrow">
<e-icon icon="e-caret-right"></e-icon>
</div><div class="e-btn e-btn-onlyicon e-btn-narrow">
<e-icon icon="e-caret-right"></e-icon>
</div>Color variations
Primary Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-primary
<div class="e-btn e-btn-primary">
Primary action
</div><div class="e-btn e-btn-primary">
Primary action
</div>Secondary Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-secondary
<div class="e-btn e-btn-secondary">
Secondary action
</div><div class="e-btn e-btn-secondary">
Secondary action
</div>Borderless Copy Pug Copy HTML Open in playground Show code Hide code.e-btn-borderless
<div class="e-btn e-btn-borderless">
Borderless Button
</div><div class="e-btn e-btn-borderless">
Borderless Button
</div>Related components
Button GroupTogglePaginationHeadingDropdownButton
Structure
Buttons should only ever be located in the upper right or lower right of the screen.
- Upper right, outside the frame: for navigation, or to initiate actions that relate to the family of items involved, e.g. create a new item.
- Upper right, inside the frame: to initiate actions that relate to the selected item.
- Lower right, inside the frame: to finish actions that relate to the selected item, such as Save, Launch, etc.
- Make the size of the button flexible and place it so that a longer text will not make it look ugly.
- Always assume that a translation make be up to twice as long as the English!
Design
Buttons come in three colours:
- Green: the primary action. Each page should ideally have one green button, which is the action that we expect and want the user to perform next in the workflow. Primary actions can be upper or lower right. In some cases there may be more than one, if the workflow has two equally valid paths at this point.
- Blue: secondary actions which are also available as a normal part of the workflow.
- White: all other buttons.
Behaviour
Buttons have five possible functions:
- Initiate a workflow
- This starts a process that must be completed. It can be small, such as creating a new field, or large, such as creating a new program.
- Ideally, nothing should be created or saved in the DB until this process have been completed - the initiation by itself should not save anything.
- Finish a workflow
- This saves the changes and updates/creates the item in question.
- Ideally, this should also close the dialog or page and return to the list overview page, or wherever the user was when they opened the workflow.
- Open a new sub-page or dialog
- While working with an item, some buttons will open drill-down pages for more detailed analysis.
- Sub-pages should always have a clear "Back" button to return to the main page.
- Dialogs just need a "Close" button.
- Navigate to a different page
- Navigation to a separate feature or functionality set should just be a one-way trip.
- Perform an action
- Some actions are also one-off, such as "Refresh".
When a button is unavailable, it should be shown as such, but should always have a tooltip explaining why. There is nothing so frustrating as not knowing why the software won't help you. Except perhaps not seeing a button today that you know was there yesterday. Therefore always show it, but be faithful to the status of the button.
Examples of such tooltips:
- "There are no changes to be saved."
- "You do not have permission to perform this action."
- "Your previews are all up to date."
Content
Buttons are governed by the following text rules:
- All Words Capitalised. Always.
- Less is more. If you need more than 3 words on a button, rethink the whole functionality.
- Use the right word type:
- For objects use nouns, e.g. "Detailed View".
- For actions use imperative verbs, e.g. "Refresh", "Save".
- Be accurate. Say what the button does.
- Never break a button over two lines.
If you need help, ask doc_Loc — they'll gladly help you out!