From 2afad86ea1825dd6a586853ec47a795ae418a6e6 Mon Sep 17 00:00:00 2001 From: James Taylor <146064280+TaylorJ76@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:28:29 +0000 Subject: [PATCH] chore(docs): select page new format (VIV-2124) (#1965) * chore: updates select component docs * chore: updates button eg * chore: fixes ui tests * chore formatting * chore: removes unused vars * chore: addresses pr comments * chore: formatting --- apps/docs/content/_data/components.json | 9 +- .../monthly-updates/september-2024.md | 16 +- libs/components/src/lib/button/README.md | 12 +- libs/components/src/lib/icon/ACCESSIBILITY.md | 1 + libs/components/src/lib/icon/README.md | 5 +- libs/components/src/lib/icon/VARIATIONS.md | 2 + .../src/lib/select/ACCESSIBILITY.md | 8 + libs/components/src/lib/select/GUIDELINES.md | 180 ++++++ libs/components/src/lib/select/README.md | 553 ++++++------------ libs/components/src/lib/select/USE-CASES.md | 169 ++++++ libs/components/src/lib/select/VARIATIONS.md | 340 +++++++++++ libs/components/src/lib/select/ui.test.ts | 321 +++++++++- libs/components/src/lib/text-field/README.md | 6 +- .../src/lib/text-field/USE-CASES.md | 2 +- .../src/lib/text-field/VARIATIONS.md | 4 +- 15 files changed, 1213 insertions(+), 415 deletions(-) create mode 100644 libs/components/src/lib/select/ACCESSIBILITY.md create mode 100644 libs/components/src/lib/select/GUIDELINES.md create mode 100644 libs/components/src/lib/select/USE-CASES.md create mode 100644 libs/components/src/lib/select/VARIATIONS.md diff --git a/apps/docs/content/_data/components.json b/apps/docs/content/_data/components.json index 140fe3ed98..92d3f95db1 100644 --- a/apps/docs/content/_data/components.json +++ b/apps/docs/content/_data/components.json @@ -77,7 +77,6 @@ "description": "Displays icons from the Vivid Icons Library using predefined colors and sizes.", "variations": "./libs/components/src/lib/icon/VARIATIONS.md", "guidelines": "./libs/components/src/lib/icon/GUIDELINES.md", - "hideGuidelines": "true", "code": "./libs/components/src/lib/icon/README.md", "accessibility": "./libs/components/src/lib/icon/ACCESSIBILITY.md" }, @@ -272,8 +271,12 @@ }, { "title": "Select", - "page": "legacy", - "markdown": "./libs/components/src/lib/select/README.md" + "description": "Select lets users choose one option from an options menu. Consider using select when you have 4 or more options to choose from.", + "variations": "./libs/components/src/lib/select/VARIATIONS.md", + "guidelines": "./libs/components/src/lib/select/GUIDELINES.md", + "code": "./libs/components/src/lib/select/README.md", + "accessibility": "./libs/components/src/lib/select/ACCESSIBILITY.md", + "useCases": "./libs/components/src/lib/select/USE-CASES.md" }, { "title": "Data Grid", diff --git a/apps/docs/content/whats-new/monthly-updates/september-2024.md b/apps/docs/content/whats-new/monthly-updates/september-2024.md index ab6e8ff859..f551e90016 100644 --- a/apps/docs/content/whats-new/monthly-updates/september-2024.md +++ b/apps/docs/content/whats-new/monthly-updates/september-2024.md @@ -22,36 +22,36 @@ See the [Office Hours minutes](https://docs.google.com/document/d/1E0yvyGUzBoQFH - An enhancement request was made for the date /range picker to include the option for an integrate time picker. This would bring it inline with a Volta version of this component - It was agreed that we would add this request to the backlog for Q4 -## Searchable Select component released to alpha +## Searchable Select Component Released to Alpha **Announcing the new [Searchable select](/components/searchable-select) component.** Searchable Select allows users to select one or multiple items from a list of options. It provides a search input field to filter the options. -## Data-grid: sort icon placement change +## Data-grid: Sort Icon Placement Change The [sort icon in the header](/components/data-grid/#columndefinitions) of data-grid are now aligned closer to the header text. -## FAB: adds condensed size +## FAB: Adds Condensed Size We have added a [condensed size](/components/fab/#size) to the FAB component. -## Icon: adds warning connotation +## Icon: Adds Warning Connotation We have added a [warning connotation](/components/icon/#connotation) to the Icon component. -## Tabs: adds shadow to tabs list when they scroll +## Tabs: Adds Shadow to Tabs List When They Scroll We have added a shadow to the tab list container when the number/size of tab items creates a scroll. Previously, it could be hard to see that there were more items. -## Tab: adds removable feature +## Tab: Adds Removable Feature Adds a close button to the [tab component](/components/tab/#removable) to enable removable tabs. -## Form components: adds a condensed variation +## Form Components: Adds a Condensed Variation Adds condensed size to [Text field](/components/text-field/#scale), [Number field](/components/number-field/#scale) and [Select](/components/select/#scale) components. -## Menu: adds position-strategy +## Menu: Adds Position Strategy When the menu is within a container that has properties such as `transform`, `perspective`, or `container-type`, which modify its containing block, it messes with the default `fixed` position. This can be remedied by setting the `position-strategy` to `absolute`. diff --git a/libs/components/src/lib/button/README.md b/libs/components/src/lib/button/README.md index 709eb30390..943de7e7c5 100644 --- a/libs/components/src/lib/button/README.md +++ b/libs/components/src/lib/button/README.md @@ -134,23 +134,23 @@ If center is needed, set `--button-content-alignment: center;`. ```html preview diff --git a/libs/components/src/lib/icon/ACCESSIBILITY.md b/libs/components/src/lib/icon/ACCESSIBILITY.md index 797a30596f..958bb35ee2 100644 --- a/libs/components/src/lib/icon/ACCESSIBILITY.md +++ b/libs/components/src/lib/icon/ACCESSIBILITY.md @@ -25,6 +25,7 @@ You must set the `aria-label` attribute on informative icons to provide an acces
0123 456 7890
+ diff --git a/libs/components/src/lib/icon/VARIATIONS.md b/libs/components/src/lib/icon/VARIATIONS.md index 6f7aad921b..8842619c7f 100644 --- a/libs/components/src/lib/icon/VARIATIONS.md +++ b/libs/components/src/lib/icon/VARIATIONS.md @@ -127,6 +127,7 @@ Use the `size` attribute to select the icon's size from a set of predefined valu + +``` + + + + +```html preview example 320px +
+ + + + + + + + + + We use this information in to help inform our marketing strategy + +
+ + +``` + +Tooltips / Toggletips disappear, so instructions or other directly actionable information, like field requirements, shouldn’t be in a them.
[Tooltip guidelines](https://www.nngroup.com/articles/tooltip-guidelines/#toc-tooltip-usage-guidelines-3) + +
+ + +## Scale + + + +
+ +The `condensed` Text Field is useful when used inside other components (inside [data-grid-cell](/components/data-grid/#cell) or [action-group](/components/action-group/) for a [toolbar](/components/button/use-cases/#toolbars)) as they take up less space. + +
+ + +```html preview example 270px +
+ + + Marketing + + + + + + + + + + + + + + + + + +
+ + +``` + +
+
+ +## Related Components + +- [Searchable Select](/components/searchable-select/) +- [Text Field](/components/text-field/) +- [Combobox](/components/combobox/) diff --git a/libs/components/src/lib/select/README.md b/libs/components/src/lib/select/README.md index 6524753b15..a34efc2fc9 100644 --- a/libs/components/src/lib/select/README.md +++ b/libs/components/src/lib/select/README.md @@ -1,296 +1,188 @@ -# Select +## Usage -Represents a select custom element. + + + ```js - +import '@vonage/vivid/select'; ``` -## Members +or, if you need to use a unique prefix: -### Label - -Add a `label` attribute to add label to the Select. If aria-label is not set, setting the label automatically adds aria-label to the element. - -- Type: `string` | `undefined` -- Default: `undefined` - -```html preview 230px - - - - - - -``` - -#### Option Label - -You can add a `label` attribute to the [vwc-option](/components/option/) to set a custom display value for the selected option. +```js +import { registerSelect } from '@vonage/vivid'; -```html preview 230px - - - - - +registerSelect('your-prefix'); ``` -### Icon - -Add an `icon` attribute to add an icon to the Select. -Check out our [use cases example](#use-cases) for a practical example. - -- Type: `string` | `undefined` -- Default: `undefined` +```html preview 270px + -```html preview 230px - - - - - - + + + + + + ``` -### Multiple - -Set the `mulitple` attribute to allow multiple selection. Note that in multiple state, the options will always be visible. + + + -- Type: `boolean` -- Default: `false` +```html + -```html preview 230px - - - - - - + ``` -### Appearance + + -Set the `appearance` attribute to change the Select appearance. +## Custom Width -- Type: `'fieldset'` | `'ghost'` -- Default: `'fieldset'` +By default, the Select's `width` is `fit-content` and the same goes for the listbox containing the options. -(`'ghost'` is typically used within a composition such as action group / toolbar). +You can specify the `width` of the Select using CSS. -```html preview 200px - - - +```html preview 230px + + + + -``` - -### Scale -Use the `scale` attribute to change the select's size. - -- Type: `'condensed'` | `'normal'` -- Default: `'normal'` - -```html preview blocks 250px - - - - - - - - -``` - -### Shape - -Use the `shape` attribute to change the Select edges. - -- Type: `'rounded'` | `'pill'` -- Default: `'rounded'` - -```html preview 200px - - - - ``` -### Helper text +## Fixed Dropdown -Add the `helper-text` to add some helper text below the select. If you need to add HTML to the helper text, use the `helper-text` slot. +The `fixed-dropdown` attribute is useful for cases in which the dropdown is obstructed by other elements. -- Type: `string` | `undefined` -- Default: `undefined` +In the example below, if `fixed-dropdown` was not set on the Select, the select dropdown would be cut off where the Dialog ends. +Also, see [the Grid Select example](/components/data-grid/#select-in-a-grid)). -```html preview 230px - - - - - - -``` - -### Success text - -Add the `success-text` to add some success text below the select. -If provided, `success-text` will take precedence over errors. - -- Type: `string` | `undefined` -- Default: `undefined` +```html preview 320px + + + + + + + + + + + + + -```html preview 230px - - - - - - + ``` -### Error text - -It is possible to force the select error state by setting the `error-text` attribute to a custom error message. -Note that any current error state will be overridden by `error-text` (and, if applicable, restored once it is removed). +## Open -- Type: `string` -- Default: `undefined` +The `open` attribute allows the Select to be openned programmatically. -```html preview 230px - - - - - +```html preview 270px + + + + + ``` -### Disabled - -Add the `disabled` attribute to disable the Select. - -- Type: `boolean` -- Default: `false` - -```html preview - - - -``` +

-### Open + -_Select_ internally uses _popup_ to display an element and its descendants above the rest of the document. - -`open` property from _popup_ propagate through _select_ and sets its open state. +Document elements display precedence is formed by the imaginary z-axis [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context), commonly by order of which elements are rendered and special properties (e.g. _z-index_). -- Type: `boolean` -- Default: `false` +Select component is a low level element, unaware of its document context, but is, in most cases, required to overlay on top of all elements. If needed a `z-index` value can be set on the host. -```html preview 230px - - - - - -``` + -### Fixed-Dropdown +## Slots -Add the `fixed-dropdown` attribute to set its popup to open as fixed. -This is useful for cases in which the dropdown is obstructed by other elements (see [the grid select example](/components/data-grid/#select-in-a-grid)). +### Default Slot -- Type: `boolean` -- Default: `false` +This is where you place the [Option](/components/option/) components to provide the option list. -```html preview 200px - - - +```html preview 270px + + + + + ``` -### Placeholder +### Meta Slot -Add the `placeholder` attribute to add a placeholder to the Select. +Set the `meta` slot to show meta information after the selected option label. ```html preview 230px - - + + -``` - -## Slots - -### Default - -Read more about [vwc-option](/components/option/). - -```html preview 230px - - + + 00:00:00 -``` - -### Meta -Set the `meta` slot to show meta information after the selected option label. - -```html preview 230px - - - - - - - - - - - - - 00:00:00 - ``` -### Icon +### Icon Slot Set the `icon` slot to show an icon before the selected option text. If set, the `icon` attribute is ignored. ```html preview 230px - - + + + ``` -### Helper-Text +### Helper Text Slot The `helper-text` slot allows you to use rich content as the select's helper text. ```html preview 230px + + Please select the type of your business. + - Please select the type of your business. ``` -## Dimensions - -### Height (CSS Variable) +## CSS Variables -Use `--select-height` to set the max-height of the dropdown. +### Dropdown Height -- Default: `408px` +Use `--select-height` to customize the `max-height` of the dropdown. -```html preview 300px - - +```html preview 230px + @@ -376,135 +248,58 @@ Use `--select-height` to set the max-height of the dropdown. -``` -### Width - -By default, the select width is `fit-content` and the same goes for the listbox containing the options. - -You can specify width on the `vwc-select` if required (the listbox will not be affected by this setting). - -```html preview 230px - - - - - ``` -## Properties +## API Reference + +### Properties
-| Name | Type | Default | Description | -| ----------------- | ---------- | ----------- | ---------------------------------------------------------------- | -| `options` | `Option[]` | `[]` | A read-only list of options. | -| `selectedOptions` | `Option[]` | `[]` | A read-only collection of the selected options. | -| `selectedIndex` | `number` | `undefined` | The index of the selected option or -1 if no option is selected. | +| Name | Type | Description | +| ------------------ | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | +| **appearance** | `fieldset` (default), `ghost` | Sets the element's appearance | +| **disabled** | `boolean` | Sets the element's disabled state. A disabled element will not be included during form submission. | +| **error-text** | `string` | Sets the element's error text | +| **fixed-dropdown** | `boolean` | Sets the position strategy of the dropdown to fixed | +| **helper-text** | `string` | Sets the element's helper text | +| **icon** | _Enum_:
`[icon-name]` | A decorative icon for the element. See the [Vivid Icon Gallery](/icons/icons-gallery/) for available icons and `icon-name`s | +| **label** | `string` | Sets the element's label | +| **multiple** | `boolean` | Sets the element to allow multiple selections | +| **open** | `boolean` | Sets the element's menu to be open | +| **placeholder** | `string` | Sets the text to be displayed when no option is selected | +| **scale** | `normal` (default), `condensed` | Sets the display size of the input element | +| **shape** | `rounded` (default), `pill` | Sets the shape of the select element | +| **success-text** | `string` | Sets the element's success text |
-## Events +### Events
-| Name | Type | Bubbles | Composed | Description | -| -------- | -------------------------- | ------- | -------- | ----------------------------- | -| `input` | `CustomEvent` | Yes | Yes | Fired when the menu is opened | -| `change` | `CustomEvent` | Yes | No | Fired when the menu is closed | +| Name | Type | Bubbles | Composed | Description | +| ---------- | ------------------------ | ------- | -------- | ----------------------------------------------- | +| **input** | `CustomEvent` | No | Yes | Fired when an option is selected or unselected. | +| **change** | `CustomEvent` | No | Yes | Fired when an option is selected or unselected. |
-## Caveat - -Document elements display precedence is formed by the imaginary z-axis [stacking context](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context), commonly by order of which elements are rendered and special properties (e.g. _z-index_). -Select component is a low level element, unaware of its document context, but is, in most cases, required to overlay on top of all elements. -If needed a `z-index` value can be set on the host - -## Accessibility - -### Aria Label - -A select requires a label to be set for screen readers to be able to describe the component. -If label is set, it is used as the `aria-label` attribute value on the host element. -If label is not set, please make sure to add an `aria-label` attribute to the host element. +### Slots -## Use Cases - -### Country Code - -```html preview 250px - - - - - - - -``` - -### Call Status - -```html preview 250px - - - - 00:00:00 - - - - - - - - - - - - - -``` + diff --git a/libs/components/src/lib/select/USE-CASES.md b/libs/components/src/lib/select/USE-CASES.md new file mode 100644 index 0000000000..29c04cfa28 --- /dev/null +++ b/libs/components/src/lib/select/USE-CASES.md @@ -0,0 +1,169 @@ +## Validation + +### In a Form + +When a Select is placed inside a `form` element and validation logic is set on the Select component, the Select is validated when the `form` is submitted (as per a native `select` element). + +Below, the "Title" field Select is marked as required and is validated when the `form` is submitted. + +```html preview 360px +
+ + + + + + + + + +
+ + +
+
+
+ + +``` + +### Single Field + +The Select component can be validated like the native `select` element. + +Below, the Select is `required` but it has no selected option. The `checkedValidity()` method is called on the Select to validate it. + +```html preview + + + + + + + + +``` + +## International Phone Number + +The Select component is used in the example below as the dialing code part of an international phone number input field. + +```html preview 240px + + + + + + + + + + + + +``` + +## Call Status + +```html preview 250px + + + 00:00:00 + + + + + + + + + + + + + + + +``` diff --git a/libs/components/src/lib/select/VARIATIONS.md b/libs/components/src/lib/select/VARIATIONS.md new file mode 100644 index 0000000000..b02f5f6883 --- /dev/null +++ b/libs/components/src/lib/select/VARIATIONS.md @@ -0,0 +1,340 @@ +## Labelling + +### Label Text + +The `label` attribute provides a short description of the purpose of the Select. + +```html preview 270px + + + + + + +``` + + +

If you can not use the visible label, provide it using the aria-label attribute.

+

It will be announced by screen readers so that those users will know the purpose of the Select.

+
+ +### Helper Text + +The `helper-text` attribute provides additional information about the purpose of the Select. + +To add HTML to the helper text, use the [helper-text slot](/components/select/code/#helper-text-slot). + +```html preview 320px + + + + + + + + + +``` + +### Placeholder Text + +The `placeholder` attribute provides some text to be displayed when no option has been selected. + +```html preview 270px + + + + + + +``` + + +

Using placeholder text to label the Select harms accessibility and user experience. The label text is visually and programmatically associated with its corresponding form control.

+
+ +## Selected Option + +To provide a selected option, use the `selected` attribute on the selected [Option](/components/option/#selected). + +```html preview 270px + + + + + + +``` + +### Selected Option Label + +Use the `label` attribute on the [Option](/components/option/#label) component to proviode a different label to be displayed when the option is selected. + +In the example below, the state code is displayed when selected but the full state name is displayed in the option list. + +```html preview 320px + + + + + + + + + +``` + +## Validation Feedback + +### Error Text + +The `error-text` attribute provides a custom error message. Any current error state will be overridden by `error-text`. + +```html preview 270px + + + + + + + + +``` + +### Success Text + +The `success-text` attribute provides a custom success message. Any current error state will be overridden by `success-text`. + +```html preview 270px + + + + + + + + +``` + +## Icon + +The `icon` attribute displays an icon from the [icon library](/icons/icons-gallery), which prefixes the Select element. + +To add custom icons, use the `icon` [slot](/components/select/code/#icon-slot) provided. + +```html preview 270px + + + + + + + + + + +``` + +## Scale + +The `scale` attribute controls the select element display size. +Use `condensed` in situations when space is limited, for example, inside a Data Grid cell. + +```html preview 270px +
+ + + + + + + + + + + + + +
+ + +``` + + +

The reason for using scale for form elements and not size (as used in other components such as Button), is that size is a HTML attribute that can be used on input elements (and also Text Field) to control the width of the input.

+
+ +## Shape + +The `shape` attribute controls the border radius of the Select input element. + +```html preview 270px +
+ + + + + + + + + + + + + +
+ + +``` + +## Appearance + +The `appearance` attribute controls the style of the select element.
+Use `ghost` in combination with a containing element which provides a border, for example when used inside the [leading action items slot of Text Field](/components/text-field/code/#leading-action-items-slot). + +```html preview 270px +
+ + + + + + + + + + + + + +
+ + +``` + +## Multiple + +The `multiple` attribute allows the user to select more than one option. When in the multiple selection state, the options will always be visible. + +For a better user experience, consider using a [Checkbox](/components/checkbox/) list or the [Searchable Select](/components/searchable-select/) if there are many options to pick from. + +```html preview 230px + + + + + + + + +``` + +## Disabled + +The `disabled` attribute disables the select element. + +```html preview 270px + + + + + + +``` diff --git a/libs/components/src/lib/select/ui.test.ts b/libs/components/src/lib/select/ui.test.ts index 69b1b5277d..3e692d81a7 100644 --- a/libs/components/src/lib/select/ui.test.ts +++ b/libs/components/src/lib/select/ui.test.ts @@ -1,8 +1,6 @@ -import * as path from 'path'; import { expect, test } from '@playwright/test'; import type { Page } from '@playwright/test'; import { - extractHTMLBlocksFromReadme, loadComponents, loadTemplate, } from '../../visual-tests/visual-tests-utils.js'; @@ -67,8 +65,7 @@ async function testScaleOptions({ page }: { page: Page }) { } test('should show the component', async ({ page }: { page: Page }) => { - const template = - ` + const template = ` ` + - extractHTMLBlocksFromReadme( - path.join(new URL('.', import.meta.url).pathname, 'README.md') - ).reduce( - (htmlString: string, block: string) => - `${htmlString}
${block}
`, - '' - ); + #wrapper > div { + margin: 5px; + } + +
+ + + + + + +
+
+ + + + + +
+
+ + + + + + +
+
+ + + + + + +
+
+ + + + +
+
+ + + + + + + + + +
+
+ + + + +
+
+ + + + + + +
+
+ + + + + + +
+
+ + + + + + +
+
+ + + +
+
+ + + + + +
+
+ + + + +
+
+ + + + + + +
+
+ + + + + + +
+
+ + + + + + + + + + + + + + 00:00:00 + +
+
+ + + + + + + +
+
+ + + + + Please select the type of your business. + +
+
+ + + + + + + + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ + + + 00:00:00 + + + + + + + + + + + + + +
+ `; await page.setViewportSize({ width: 2300, height: 720 }); diff --git a/libs/components/src/lib/text-field/README.md b/libs/components/src/lib/text-field/README.md index f320f947d1..27f24b57ee 100644 --- a/libs/components/src/lib/text-field/README.md +++ b/libs/components/src/lib/text-field/README.md @@ -180,12 +180,13 @@ The `helper-text` slot allows you to use rich content as the text-field's helper | Name | Type | Description | | -------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | -| `appearance` | `fieldset`, `ghost` | Sets the input element's appearance | +| `appearance` | `fieldset` (default), `ghost` | Sets the input element's appearance | | `autocomplete` | `off`, `on`, `` | Hint for form autofill feature | | `autofocus` | `boolean` | Indicates that an element should be focused on page load, or when the Dialog that it is part of is displayed | | `char-count` | `boolean` | Use in combination with `maxlength` to display a character count | | `disabled` | `boolean` | Whether the input element is disabled | | `inputmode` | enum: `none`, `text`, `decimal` `numeric`, `tel`, `search`, `email`, `url` | Allows a browser to display an appropriate virtual keyboard | +| `label` | `string` | Label of the Text Field | | `list` | `string` | Value of the id attribute of the `` of autocomplete options | | `maxlength` | `string` | Maximum length (number of characters) of `value` | | `minlength` | `string` | Minimum length (number of characters) of `value` | @@ -193,7 +194,8 @@ The `helper-text` slot allows you to use rich content as the text-field's helper | `placeholder` | `string` | Text that appears in the input element when it has no value set | | `readonly` | `boolean` | The `value` is not editable | | `required` | `boolean` | A value is required for the form to be submittable | -| `size` | `string` | Size of the input element | +| `size` | `string` | Size (in chars) of the input element | +| `scale` | `normal` (default), `condensed` | Sets the display size of the input element | | `shape` | `rounded`, `pill` | Sets the shape of the input element | | `type` | enum: `text`, `email`, `password`, `search`, `tel`, `url` | Type of input element | | `value` | `string` | The value of the input element. When specified in the HTML, corresponds to the initial value | diff --git a/libs/components/src/lib/text-field/USE-CASES.md b/libs/components/src/lib/text-field/USE-CASES.md index 6d613c19ae..28867b19ae 100644 --- a/libs/components/src/lib/text-field/USE-CASES.md +++ b/libs/components/src/lib/text-field/USE-CASES.md @@ -51,7 +51,7 @@ Below, the Text Field is `required` but it has no `value`. The `checkedValidity( ``` -### Numeric input +## Numeric input When collecting input which is made up of digits, but not a number in the mathematical sense, use the Text Field with `inputmode="numeric"` and `pattern="[0-9]*"`. diff --git a/libs/components/src/lib/text-field/VARIATIONS.md b/libs/components/src/lib/text-field/VARIATIONS.md index 2008890bf9..998723b926 100644 --- a/libs/components/src/lib/text-field/VARIATIONS.md +++ b/libs/components/src/lib/text-field/VARIATIONS.md @@ -2,7 +2,7 @@ ### Label Text -The `label` attribute provides a short description of purpose of the Text Field. +The `label` attribute provides a short description of the purpose of the Text Field. ```html preview @@ -17,7 +17,7 @@ The `label` attribute provides a short description of purpose of the Text Field. The `helper-text` attribute provides additional information to help the user enter the correct informaton. -To adds HTML to the helper text, use the [helper-text slot](/components/text-field/code/#helper-text-slot). +To add HTML to the helper text, use the [helper-text slot](/components/text-field/code/#helper-text-slot). ```html preview