Skip to main content

ns-cta

Introduction#

A CTA (call-to-action) allows users to take action once they are ready for it.

Users can perform certain actions through the use of ns-cta. An example of these actions could be to submit a form through an event (i.e. click event) or navigate with a hyperlink.

There is no distinciton between a hyperlink or an action through the design of ns-cta. Use the text content to convey the intent of the CTA to the user.

Content guidance#

CTA Direct#

CTA - Direct

CTA Text#

CTA - Text

KeyField typeGuidelines
ATextKeep the text 'short, relevant, and actionable'. It should not exceed more than 24 characters.
BIconThis is a decoration. It is intended to imply direction such as moving forwards and backwards in a journey. The specification table has a list of options.

Differences between direct and text types#

The direct and text types of ns-cta are there to offer hierarchical structure to the page.

The direct type has a more emphasised affordance, therefore it can be used as the main action for that page. As it's the main action, it should be used sparingly.

The text type supports the direct type and helps build hierarchy. It can be used for actions that are not the main reason for the page and can accommodate longer text content.

For example, on the Energy Hub Page the main purpose is for customers to get a quote. This action would be a direct CTA supplementary information such as Seeing all tariffs, Energy guides or Learning about smart meters would be the text type. We recommend when grouping actions through a set of cards they all use the same CTA type.

How to identify when to use the text type#

For example, if the content starts with:

  • Learn more...
  • Find out...
  • Look up...
  • See our...
  • Discover...

These are all supporting actions and our recommendation is to use the text type.

If there is a group of more than three actions it would be preferable to make all these CTAs the text type. Or to find the main action in this group and place it in an alternative, more suitable component such as ns-lockup or ns-standout to establish hierarchy.

When to use submit and reset types#

The submit and reset types of ns-cta are there to facilitate ns-form to do submit and reset actions respectively.

The submit type is to be used in a page with ns-form to perform a native-like submit action. Upon submission it automatically validates the elements in ns-form and reports any warnings or will submit ns-form.

The reset type is to be used in a page with ns-form to perform a native-like reset action. It will reset the elements back to their default or initial value.

Button vs link#

There is no visual distinction between a button and a link when using ns-cta. It's recommended not to use a native <button> element, but to use the CTA with the required events.

The distinction for a user on either a navigation or an event is not based on the appearance but on the text content. It needs to be clear based on the text content that the user is either going to the next step in a journey / page, or that they are doing an action, such as submitting a form.

Decorative vs functional#

The ns-cta is a standalone component that can serve an action whether it is a link or an event. However, if required it can be used as a decoration and be wrapped within an <a> element or another routing component (such as for specific frameworks). This means that those functionalities will still look like the ns-cta even though the functional task is being done outside of it.

States#

Loading#

The ns-cta is capable of handling a loading interaction using the loading and loading-message attributes, these can be found in the specification table below.

This loading state is used to provide the user with feedback that their action is being handled. It also reassures the user that action may take a number of seconds to be completed.

We recommend only to use this loading state for a maximum of 5 seconds. If it's known that the action is likely to take longer than 5 seconds, present the user with a Roadblock page type.

If the action fails, don't leave the CTA in its Loading state. Present the user with clear feedback with the alert component highlighter varient.

Your loading message should be contextual to the action of the text of the CTA. E.g. "Get a quote" becomes "Getting your quote...".

CTA - Loading state

You can see the live example of the loading state on Storybook.

Disabled#

We do not offer a disabled state, every CTA should have an action even if that is to an unhappy path. Such as, when in a form, a submit CTA will go to the highest invalid inputter to help the user to complete the form. It allows us to track the experience better when the user can interact with it.

If we use a disabled state in this example, it will infuriate the user as they wouldn't know what their next action is. This may force them to take an undesirable action, such as trying to call the call centre.

The only time we present a disabled state is during the Loading state. This ensures no accidental additional clicks are performed whilst the action is in progress.

Best practice#

๐Ÿ’š Do's๐Ÿ’” Dont's
Make it short and actionableMake it vague
Only use loading on an action that will take between 1 and 5 secondsMake it overly wordy
Relate the action to the content it sits besideChange the icon for the sake of it
Use direct type for the most important action on the pageUse more than 24 characters
Use text type to support the direct actionHave CTAs within a paragraph
Use instead of a native buttonRepeat the CTA copy within the same page
Use submit type in a form for form submissionUse for downloads. Use the ns-download component instead
Use reset type in a form for form reset action

Considerations of best practice#

  • It should always be clear to the user what the CTA's action is through its text.
  • To be aware of the distinct roles of the CTA's types direct and text and that they don't always act as a primary and secondary button.
  • Try not to have multiple CTA's next to each other.
  • Don't make the main purpose of the page to have a group of CTAs.
  • Don't overload the page with the same type of CTA or too many CTAs.
  • The loading message should be the action of the text of the CTA. E.g. "Get a quote" becomes "Getting your quote...".

Usage#

View example on Storybook

Component placement#

The ns-cta component can be used in the following components:

Specification#

AttributePropertyTypeDefaultOptionsDescription
typetypestringdirectdirect, text, submit, resetDifferent variants of the CTA.
hrefhrefstringNavigating using a hyperlink.
iconiconstringarrow-rightarrow-left, arrow-right See ns-icon componentThe icon inside the CTA.
loadingloadingbooleanfalsetrue, falseChange the state of the CTA to loading.
loading-messageloadingMessagestringLoading...Overwrites the CTA anonymous slot for the loading state.
SlotsType
AnonymoustextNode

Specification notes#

Icons#

  • They are decorative, not descriptive, and are there to supplement the text.

Href#

  • Can be used instead of having a wrapping <a> element.
  • This shouldn't be used if a click event is added.

Feedback#

  • Do you have insights or concerns to share? You can raise an issue via Github bugs.
  • See all the issues already raised via Github issues.

๐Ÿ’ฉ ๐ŸŽ‰ ๐Ÿฆ„ If you have any questions, contact us on Microsoft Teams in the Nucleus Design System channels.

Related links#