Buttons are one of the most common and generally applicable form components and should be used inside forms to manage data, as links to other pages or actions, or to prompt state or informational changes.
Default button
The default button uses a white fill with a thin gray border and slightly rounded corners. It’s been designed to visually get out of the way and should be the main button you use, particularly when the screen has a lot of buttons.
Create a default button by adding .hc-button .hc-button--primary to a <button> element (or most other elements).
Button states
Various states can be applied as classes depending on the context for the button.
Primary - Primary action. Avoid using more than one primary button at a time in a given component/section.
Secondary - Actions with lower priority; creates a hierarchy between the primary and the secondary options.
Tertiary - Low priority actions, not meant to be used for primary or “submit” actions. Note that default tertiary buttons have a transparent background and will operate like text.
Disabled - Indicates the button cannot be used. Preferably a tooltip will appear on hover indicting the reason of the disabled state.
Button sizes
There are three button sizes, two of which require class name modifiers. The default size should be used in the majority of cases, except when a limited exception or design need dictates otherwise.
Size
Class
Use case
Base
--
Default button size, used for normal actions, CTAs, and common use cases
Small
.button--sm
Tables with many repeated actions, many buttons in a small area
Large
.button--lg
More critical CTAs that require focus, larger UI element requires a larger button
Adding icons
Add an icon to either the left or right of the text label for automatic icon placement. No additional classes are needed, just add an .hc-icon to the left and/or right of the button’s label. Note that for filled buttons, the icon will switch to a solid style.
Adding the .hc-button--icon to a <button> element will produce a square button intended to hold only an icon.
Brand variations
Apply an app’s brand color to primary, secondary, and tertiary buttons to further promote them. These are great for CTAs or when you want to add some of the app’s color.
There are two ways to create these branded buttons:
Theme: The preferred method as of v0.2.22 is to use the data-hc-theme data attribute on the <body> element. Simply add the app name as the value for this attribute, like this: <body data-hc-theme="boost">. For each button that you’d like to use the brand variation, simply append .hc-is--brand and it will inherit the body’s app/theme.
Direct class name: The previous way, and the method to force a specific brand color on a button regardless of what theme the body element has, is to add the brand class directly to the button: .hc-button--primary .hc-button--boost.
Theme approach
Setting a data attribute on the <body> element called data-hc-theme to be one of the app names will change the branding theme to that app, affecting branded buttons (among other components). Read more about this on the Themes documentation page.
Simply append .hc-is--brand to any button alongside a primary, secondary, or tertiary class and the theming will be handled automatically.
Important Note
Previously the theme was applied with the component-specific class, .hc-button--brand. This has been replaced as of v0.3.0 to standardize brand variations with .hc-is--brand.
Direct class name
Alternatively, you can create a branded button by directly applying a class name to any button state. For instance, adding .hc-button--boost will force the Boost theme onto that button.
Note that this will override any theme that may be operating on the screen so please use this intentionally.
Semantic variants
Semantic buttons are similar to branded buttons but use the semantic color schemes to indicate success, information, warning, or danger. Use these when you need to indicate this type of semantic state, like the positive creation of something or the negative destruction of an item.
Create a semantic button by appending .hc-button--success, .hc-button--info, .hc-button--warning, or .hc-button--danger to a primary, secondary, or tertiary button.
Split button
Split buttons offer a primary button on the left with a secondary button, often a chevron to open a dropdown, on the right. They’re separated by a small line to indicate that there are two separate actions present.
Create a split button by placing buttons inside of an element with class .hc-button-split. The inner buttons can use any of the existing button classes but it’s recommended to keep them similar (i.e., don’t place primary and secondary buttons next to each other).
Segment buttons
Segment buttons present the user with a number of options as buttons, with one taking a selected state. These are similar in a way to a radio group where only one choice may be selected a time and conveying the user’s choice.
Buttons must be placed within a block-level element with class .hc-button-segment. They can take any button variant class as well, but again should be uniform.