Workday Canvas

Number Input

Number Inputs allow users to enter numeric data.

Sources
Figma

Anatomy

the basic elements of a number input

  1. Label: Title of the Number Input.
  2. Input Container: Rectangular container that houses placeholder and input text.
  3. Placeholder/Input Text: Placeholder text is optional and shows an example of how to format the text for the input required.
  4. Percent Symbol: (Optional) Only used to provide context around the intent of the input. These elements are not editable by the user.

Usage Guidance

When to Use

  • When numeric data needs to be entered, such as: quantities, counts, zip codes, percentages, decimals, etc.

An image of a number input with a percentage value

Do

Numeric data containing decimals or percentages are ideal for the number input

An image of a number input with a date

Don't

Don't use the number input for dates or time.

When to Consider Something Else

  • Use a Text Input when the intended user input is all or partially text based.
  • Use a Text Area when you need to let users enter an amount of text that’s longer than a single line.
  • Use a Rich Text Editor if styling is needed, such as for configuring email messages.
  • Consider using a Prompt, Radio or Checkboxes if there is predetermined data that a user should not input themselves
  • When entering phone numbers use the dedicated Phone Number input, which provides additional controls and formatting specific to this type of data.
  • Monetary data should use the Currency Input, which provides additional controls and formatting specific to this type of data.
  • Date Inputs/pickers should be used for all date based data. These inputs are built for easier data entry and come with specific date formatting.
  • Time Inputs/pickers should be used for all time based data. These inputs are built for easier data entry and come with specific time based formatting.
  • For more information about different types of inputs, review the Form pattern.

Behaviors

Number Inputs follow all the same interaction and notifications state as our Text Input.

Keyboards

Mobile devices utilize on-screen keyboards. Typically it is up to the designer to specify the keyboard-type in their designs, however the number input will always default to the native number pad.

a number input alongside a number pad

Screen Size Differences

Typically, inputs on mobile should stretch to the full width of the screen. However, there are some exceptions when providing smaller inputs to better set expectations for the input, such as providing a smaller input for entering a ZIP code. For larger mobile devices, inputs should have a maximum width of 600 pts to retain proper readability.

Examples

Number

The standard number input for most all numeric data. This supports decimals, and positive/negative numbers.

a number input showing a quantity

Percentage

The percentage variant appends a percent symbol (%) to the trailing end of the number string to provide additional meaning and context to the user. This also supports decimals, and positive/negative numbers.

a number input showing a percentage

API Guidelines

Methods

Class name: LabelledNumberInput Module name: UIComponentsPlugin

public init( featureData: FeatureMetricsData, input: Binding<String>, unformattedOutput: Binding<String>, allowNegative: Bool, allowDecimal: Bool, maxIntegerDigits: Int, maxFractionDigits: Int, isPercentageInput: Bool, label: String, helperText: String?, context: Binding<SemanticContext>, locale: Locale, localizer: LocalizationAdapting, onFocusChanged: ((Bool) -> Void)? = nil, onSubmission: (() -> Void)? = nil )

Parameters

NameDescription
featureDatathe feature name/context and the screen ID in which the component appears.
inputNumber string input. Normally start with empty string but can be any numeric string. This is what appears in the field.
unformattedOutputUnformatted number string output i.e no group separators included.
allowNegativeAllow to input negative numbers.
allowDecimalAllow to input decimal number.
maxIntegerDigitsMaximum number of digits for integer part.
maxFractionDigitsMaximum number of digits for fractional part.
isPercentageInputAccepting input as percentage value.
labelLabel to be positioned above field, already localized.
helperTextHelper text below field. Helper text will be prefixed with “Error:”/“Warning:” as part of this init.
contextSemanticContext of the field.
localeLocale of the field to format the number.
localizerlocalizer for the field.
onFocusChangedOptional closure which allows you to listen to focus changes from the TextField. Default is nil.
onSubmissionOptional closure which allows you to listen to the onSubmit or Done button action from the TextField. Default is nil.

Accessibility Guidelines

  • Coming soon…

Content Guidelines

  • Labels for Number Inputs are written in title case.
  • Use helper text to instruct the user what the proper input may be.
  • Use placeholder text only to provide examples of proper inputs. Never use placeholder text to help instruct users.
  • For additional numeric content guidance review the Numbers section.

Can't Find What You Need?

Check out our FAQ section which may help you find the information you're looking for. For further information, contact the #ask-canvas-design or #ask-canvas-kitchannels on Slack.

On this Page: