Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@spectrum-css/textfield

adobe24.3kApache-2.08.1.1

The Spectrum CSS textfield component

design-system, spectrum, spectrum-css, adobe, adobe-spectrum, component, css

readme

GitHub Actions build status on main
GitHub Actions build status on spectrum-two

Spectrum CSS

A CSS-implementation of the Spectrum design language

Features

  • 📖 Robust documentation: Spectrum CSS is designed to be used in partnership with Spectrum's detailed usage guidelines.
  • 🎨 Flexible: Our CSS is customizable, powerful, and designed to work with any JavaScript framework.
  • 🧪 Rigorously tested: These individually-versioned components have been vetted to be accessible and inclusive of global audiences.
  • 📱 Multi-platform support: We support evergreen browsers for scalability and flexibility.

      

Using Spectrum CSS

The preferred method of using Spectrum CSS relies on custom properties to swap out variables for different themes and contexts. This results in the lowest bundle sizes and is one of the simpler approaches.

Want to get a component up and running as soon as possible? Check out the quick start guide.

Functionality

Spectrum CSS is CSS-only, implementing only the interactivity that can be done with pure CSS. We do include some lightweight JS-based interaction for demonstration purposes only in our Storybook. Spectrum CSS should only be used by implementations of Spectrum, or very simple applications that only need things like typography, checkboxes, text fields, etc.

Adobe maintains separate libraries written with web components and React that work in partnership with Spectrum CSS to create fully interactive Spectrum components.

The Spectrum Web Components library directly imports Spectrum CSS and optimizes it for use with web components.

Installing components

Each component is released on npm as a separate, individually versioned package inside of the @spectrum-css org.

To incorporate Spectrum CSS into your project, you install the components you need along with any peer dependencies you need for your implementation. Most peer dependencies are optional and can bring additional features when installed along with a component. For example a button can be rendered with or without an icon; so if your use-case leverages an icon with your button, you'll want to install icon as a peer dependency.

yarn add -DW @spectrum-css/tokens @spectrum-css/typography @spectrum-css/page @spectrum-css/icon @spectrum-css/button

Installed components will be available in the node_modules/@spectrum-css/ folder of your project.

All components in this library have a peer dependency on @spectrum-css/tokens, which is a local package that serves up the Spectrum design tokens as CSS custom properties (via Style dictionary). These custom properties are leveraged in all components to create a cohesive visual language and to allow for easy theming. If you choose not to use the provided @spectrum-css/tokens package, you must define your own custom properties or your components will render with a significant number of missing styles. When overriding certain styles is necessary, modifying styles is supported through the use of component-specific --mod prefixed properties. More on this below.

Using components in your project

Spectrum CSS components have build output that is designed to be used in a variety of ways:

  • index.css - Preferred and most commonly used to incorporate Spectrum CSS into a project. This file includes the component's styles and variable definitions. In this version, token-driven CSS properties1 are mapped to empty --mod prefixed variables (for customization) with a fallback to variables prefixed with --spectrum (sourced from the design tokens).

    • This file loads the .spectrum, .spectrum--legacy, and .spectrum--express contexts which are used to toggle components between different visual styles. The .spectrum context is the default.
  • index-base.css: This file mimics the index.css output, but does not include the .spectrum or .spectrum--express contexts.

    • If your product only requires the .spectrum context, you can use index-base.css plus themes/spectrum-two.css from the themes directory to render the default Spectrum visual language.
      • The .spectrum--legacy context represents the previous version of Spectrum (also known as Spectrum 1). This means if you only want to use the legacy context, you should load themes/spectrum.css. deprecated
      • The .spectrum--express context represents the subtheme of Spectrum 1 called Express . This means if you only want to use the Express context, you should load themes/express.css. deprecated
    • This approach can also be used when you have defined and written your own visual language and only need the base component styles from Spectrum CSS. To wire up your own visual language, you would need to define your own custom properties that match those defined in the themes/spectrum-two.css assets.
  • index-theme.css: This file provides only the visual language for a component. It is used in conjunction with index-base.css and when loaded together, provides the same result as using index.css by itself.

1: Token-driven CSS properties are properties whose values are mapped to a value in the @spectrum-css/tokens package. These values represent design-language and are meant to be used across platforms. In contrast, properties specific to web-based implementations will not have a token value assigned, so not all CSS properties will use custom properties.

Including assets

Start by including the base set of variables:

/* Include tokens */
@import "node_modules/@spectrum-css/tokens/dist/index.css";

/*
  For components with no other contexts available, load the
  index.css file from the component's package. These are components
  that do not have a spectrum or express context available.
*/
@import "node_modules/@spectrum-css/page/dist/index.css";
@import "node_modules/@spectrum-css/typography/dist/index.css";
@import "node_modules/@spectrum-css/icon/dist/index.css";

/*
  Recommended: For components with multiple contexts available, if you
  want access to all contexts, load the index.css file, which includes
  all contexts and component variables.
*/
@import "node_modules/@spectrum-css/button/dist/index.css";

/*
  If you only need the spectrum visual context: For components with
  multiple contexts available, load only the spectrum context by sourcing
  index-base.css and the spectrum theme from the themes directory.
*/
@import "node_modules/@spectrum-css/button/dist/index-base.css";
@import "node_modules/@spectrum-css/button/dist/themes/spectrum.css";

Tokens values are mapped to context-specific classes which can be applied to the <html> element or any place in your DOM where you wish to encapsulate or alter the visual language of your Spectrum components.

All contexts you want to use must be defined in order to load all the appropriate custom properties for the components you are using.

Global variables

Visual language
  • .spectrum - The default visual language for Spectrum CSS; represents the Spectrum 2 foundations visual language.
  • .spectrum--legacy - The legacy Spectrum 1 visual language. This visual language will be deprecated in Spectrum 2.
  • .spectrum--express - A variant of the standard visual language. This visual language will be deprecated in Spectrum 2.
Scales

Scales represent the browsing context of the user. They are used to adjust the size of components to improve readability and usability on different devices.

  • .spectrum--medium - The default scale for Spectrum CSS, used for desktop and tablet devices
  • .spectrum--large - A larger scale for Spectrum CSS, used for mobile devices and other small screens to create a more touch-friendly experience
Themes (colorstops)

Themes represent the color scheme of the user's browsing context. They are used to adjust the color of components to improve readability and usability in different environments.

  • .spectrum--light - The default theme for Spectrum CSS, used for light mode
  • .spectrum--dark - A darker theme for Spectrum CSS, used for dark mode

Other themes are available but are in the process of being deprecated and should not be used in new projects.

Context example

Put together, we would define the context for our application in the following way:

<html class="spectrum spectrum--medium spectrum--light"></html>

To switch to Express, add the .spectrum--express class to the <html> element:

<html
    class="spectrum spectrum--medium spectrum--light spectrum--express"
></html>

Note the spectrum--legacy or spectrum--express class is added to the existing classes; spectrum should always be present to ensure the correct visual language is loaded.

Because CSS custom properties honor the cascading nature of CSS, you can infinitely nest different contexts. For example, you could have a .spectrum--dark context inside of a .spectrum--light context, and components will honor the innermost context.

Modifying components

You can override variables and modify Spectrum CSS' look and feel by re-defining the custom properties in context. Look for the Custom Property API section in each component to determine which custom properties you can override. See Action Button for a complete example.

Importing UI icons

Some components require certain "UI icons" to render. These icons are released within the @spectrum-css/ui-icons package and are used by components like @spectrum-css/icon and @spectrum-css/actionbutton.

Based on which scales you'll be using, you can choose to load different files:

  • spectrum-css-icons.svg - Both medium and large icons for responsive UIs that support both .spectrum--medium and .spectrum--large

  • spectrum-css-icons-medium.svg - Medium icons only, supports .spectrum--medium only

  • spectrum-css-icons-large.svg - Large icons only, supports .spectrum--large only

Note: If you're using spectrum-css-icons.svg, be sure to add .spectrum--medium or .spectrum--large to the <html> element, or you'll see both medium and large icons at once.

Importing workflow icons

If your app has any level of complexity, you'll need "workflow" icons to indicate actions. These icons are not required to render the base components, and instead are used within buttons or menu items for actions like share, play, justify, save, etc.

These icons are released within the @adobe/spectrum-css-workflow-icons package. Visit the Spectrum workflow icon list and click on any icon to get the SVG markup.

Language support

To take advantage of locale specific changes such as placeholders not italicizing Japanese, your application should specify a Content-Language response header or set the lang attribute.

In addition, you should set the dir attribute for components to render correctly.

For English, a left-to-right language:

<html lang="en" dir="ltr"></html>

For Arabic, a right-to-left language:

<html lang="ar" dir="rtl"></html>

Browser support

We maintain a modern codebase that supports the latest two versions of evergreen web browsers. The current list of browsers officially supported by Spectrum CSS can be found in the browserslist section of the project's package.json file. This setting is used by the build tools when the source files are built. If you require additional browser support for your project, the CSS can be processed further with your chosen tools.

  • latest 2 Edge versions
  • latest 2 Chrome versions
  • latest 2 Firefox versions
  • latest 2 Safari versions
  • latest 2 iOS versions

Optimizing Spectrum CSS

Spectrum CSS is designed to be as modern and flexible as possible, and as such, leaves room for consumers to optimize in their own way. There are many tools and techniques you can use to optimize CSS for your project such as tree shaking, purging, and minification. If you are loading the entire set of @spectrum-css/tokens for example, you can safely tree shake the tokens to only include the variables you are using, often leading to a significant reduction in file size.

Contributing

A very special thank you to all of our contributors without whom this project would not be possible.

Want to join the team? Check out the contributing guidelines to get started.

Tasks

The following tasks are available:

Command Description Examples
clean Cleans all output files for the project and all components yarn clean
build Performs a build of all components yarn build
bundle Creates a bundled asset for use in demos or development environments yarn bundle
start Performs a local development build of Storybook yarn start
compare This compares the current version of components with the previous versions published to NPM and output a list of all the changes that have been made. This is useful for reviewing changes before a release. The information is provided in the command-line output as well as in a simple web page that is opened in your default browser upon completion. The web page includes links to the visual diffs for each component when the file sizes have changed.
  • Components with no changes are not included in the output.
  • To run comparisons on one or multiple components, compare accepts a list of components as arguments. For example, yarn compare button will compare the current version of the button component with the previous version published to NPM. yarn compare button checkbox will compare the current version of the button and checkbox components with the previous versions published to NPM.
  • Named components should be space-separated.
  • Running compare with no inputs will automatically run against all packages.
yarn compare
yarn compare accordion
yarn compare accordion actionbutton
lint Provides helpful updates and warnings for a component's package.json file. This helps keep all components in alignment. Use format to automatically fix any issues that are found. To run on a single component, use yarn linter accordion (where accordion is the name of the component or components you want to lint). yarn lint
yarn linter accordion
yarn linter accordion actionbutton
format Provides helpful updates and warnings for a component's package.json file. This helps keep all components in alignment. To run on a single component, use yarn formatter accordion (where accordion is the name of the component or components you want to lint). yarn format
yarn formatter accordion
yarn formatter accordion actionbutton
refresh:env This copies values for the project's .env file (an asset never committed to the repo as it contains login secrets) by using the .env.example file as a template. This script is useful when you need to update the .env file with new values from the .env.example file or when you checkout or clean the repo and need to restore the .env file. yarn refresh:env
yarn constraints This command will list out any changes suggested by the settings defined in yarn.config.cjs. The goal of this tool is to more easily allow us to add, update, or remove properties to/from all package assets. Add the fix flag to apply the suggested changes. yarn constraints or yarn constraints --fix

Troubleshooting

As of February of 2024, the Spectrum CSS project has moved to a new tokens system (@spectrum-css/tokens instead of @spectrum-css/vars). If you are using Spectrum CSS and see that your styles are off, or not applying at all, ensure that you are using the correct tokens package for the component.

changelog

Change log

8.1.1

Patch Changes

  • #3575 2e17d10 Thanks @TarunAdobe! - updated border color on keyboard focus state for textfield in spectrum-two theme

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

8.1.0

Minor Changes

  • 205182b Thanks @castastrophe! - ## New feature

    Minified and gzipped outputs available for all compiled CSS assets.

Patch Changes

8.0.1

Patch Changes

  • #3534 68e0057 Thanks @castastrophe! - Fixes a bug in the content of the dist/index-theme.css file.

    Expected index-theme.css to include the component selectors with component-level custom properties mapped to the --system prefixed ones in order to allow a component to support various contexts.

    Expected output example for the index-theme.css:

    .spectrum-ActionButton {
     --spectrum-actionbutton-background-color-default: var(--system-action-button-background-color-default);
     --spectrum-actionbutton-background-color-hover: var(--system-action-button-background-color-hover);
  • Updated dependencies [68e0057]:

8.0.0

Major Changes

  • #2786 6c19fcf Thanks @pfulton! - ## Breaking change

    This major update creates a bridge between the Spectrum 1 (S1) and Spectrum 2 (S2) designs, dubbed "Spectrum 2 Foundations". These do NOT reflect a fully migrated S2 component. This approach allows consumers to swap the appearance of their components between S1, Express, and S2 by leveraging a "system" layer that remaps the necessary component-level tokens to the appropriate token dataset.

    For these components to appear S2, you must load the assets with the @spectrum-css/tokens at v16 or higher.

    For S1 or Express, load assets with the @spectrum-css/tokens at v14.x or v15.x.

    If you are looking to implement a fully S2 design, please explore the next tag releases instead of using this foundations release. This release is used in Spectrum Web Components 1.x.

    Deprecations

    The metadata folder containing the mods.md and metadata.json assets has been removed from source. To find information about the components including what selectors, modifiers, and passthroughs are used, please see the dist/metadata.json asset shipped with every component containing CSS.

    The index-vars.css asset has been removed in this release as it was previously deprecated and is no longer maintained. Please use the index.css or index-base.css

    File usage

    If you are rendering components and need only the S2 Foundations styles, you can make use of the index.css asset which contains all the base styles plus the system mappings for S2 Foundations.

    If you are using this version to publish only an S1 or Express component, you can use the index-base.css plus the desired themes/(spectrum|express).css file.

    To render a component that can be easily swapped between the S2 Foundations, S1, or Express contexts, load index-base.css with the index-theme.css file and leverage the appropriate context classes (.spectrum--legacy for S1 and .spectrum--express for Express).

Patch Changes

7.4.1

Patch Changes

7.4.0

Minor Changes

  • #3502 562396e Thanks @castastrophe! - Simplify how the --system properties are mapped. By updating the logic in the postcss-add-theming-layer, we are now shipping cleaner, more readable --system property names. These custom properties are documented as NOT a part of the component API so although these result in a change to the custom property names, it does not impact the properties that are in the API and so do not constitute a breaking change. Expect to see no change to how component theming works or any visual regressions as a result of this change.

Patch Changes

7.3.0

Minor Changes

Patch Changes

7.2.3

Patch Changes

7.2.2

Patch Changes

  • #3012 78c98bf Thanks @cdransf!
  • Modify the stepper and textfield css to allow the .is-disabled state and class to properly disable the border behavior that would occur when a disabled stepper was hovered. It also leverages the outline state for focused components to align with the state currently used by button components.

7.2.1

Patch Changes

7.2.0

Minor Changes

  • #2771 81e86b1 Thanks @jawinn!
  • Removes some legacy vendor prefixes that are no longer necessary, including some that were for older browsers that are no longer in browser support list for Spectrum CSS. Such as Microsoft Edge before version 79. Includes some cleanup around some of the related normalization styles in the Text field component and the Commons %spectrum-BaseButton (used for multiple button components).

7.1.3

Patch Changes

7.1.2

Patch Changes

  • #2761 d945c05 Thanks @mdt2!
  • Fixes an issue in the Quiet variant where hovering over the focus pseudo element was firing pointer events that weren't meant to be seen unless the user hovered over the input element itself.

7.1.1

Patch Changes

  • #2759 9652981 Thanks @castastrophe!
  • fix: when whitespace normalization is done before stylelint fixes, a few selector optimizations were uncovered.

7.1.0

Minor Changes

Build optmizations to support minification

Output for all component CSS files is now being run through a lightweight optimizer (cssnano) which significantly reduces unnecessary whitespace. These changes reduce file size but should not have any impact on the rendering of the component. By removing unnecessary whitespace from var functions, we are making it easier to effectively minify our provided CSS assets.

Patch Changes

  • Updated peerDependencies [7f45ea9]:
    • @spectrum-css/helptext@>=5
    • @spectrum-css/tokens@>=14

7.0.0

🗓 2024-04-18 • 📝 Commits

✨ Features

🛑 BREAKING CHANGES

  • Removes component-builder & component-builder-simple for script leveraging postcss

  • Imports added to index.css and themes/express.css

6.1.6

🗓 2024-03-07 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.1.5

🗓 2024-02-26 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.1.4

🗓 2024-02-20 • 📝 Commits

🐛 Bug fixes

  • textfield:icon positioning with field label (#2380)(468b426)* textfield:remove extra padding on nested label and help (#2519)(0250d0e)

6.1.3

🗓 2024-02-15 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.1.2

🗓 2024-02-12 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.1.1

🗓 2024-02-06

Note: Version bump only for package @spectrum-css/textfield

6.1.0

🗓 2024-02-05 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.31

🗓 2024-01-16 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.30

🗓 2023-12-12 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.29

🗓 2023-12-04 • 📝 Commits

🐛 Bug fixes

  • textfield:focus outline only on keyboard focus(e919679)

6.0.28

🗓 2023-11-15 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.27

🗓 2023-11-13 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.26

🗓 2023-11-09 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.25

🗓 2023-10-13 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.24

🗓 2023-09-26 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

  • name="6.0.23">

6.0.23

🗓 2023-09-18 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

🛑 BREAKING CHANGESits](https://github.com/adobe/spectrum-css/compare/@spectrum-css/textfield@6.0.21...@spectrum-css/textfield@6.0.22)

Note: Version bump only for package @spectrum-css/textfield

6.0.21

🗓 2023-09-13 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.20

🗓 2023-09-07 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.19

🗓 2023-08-31 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.18

🗓 2023-08-31 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.17

🗓 2023-08-29 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.16

🗓 2023-08-25 • 📝 Commits

🐛 Bug fixes

  • textfield:add line-height to prevent missing diacritics (#2123)(e44e4f4)

🔙 Reverts

6.0.15

🗓 2023-08-22 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.14

🗓 2023-08-22 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.13

🗓 2023-08-18 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.12

🗓 2023-08-16 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.11

🗓 2023-08-10 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.10

🗓 2023-08-07 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.9

🗓 2023-08-03 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.8

🗓 2023-07-24 • 📝 Commits

🐛 Bug fixes

6.0.7

🗓 2023-07-17 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.6

🗓 2023-07-14 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.5

🗓 2023-07-11 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.4

🗓 2023-06-29 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.3

🗓 2023-06-21 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.2

🗓 2023-06-15 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

6.0.1

🗓 2023-06-12 • 📝 Commits

🐛 Bug fixes

  • restore files to pre-formatted state(491dbcb)

6.0.0

🗓 2023-06-02 • 📝 Commits

  • chore(search)!: core tokens migration (#1761)(b54d8ef), closes#1761

🛑 BREAKING CHANGES

        *
        migrates Search to use `@adobe/spectrum-tokens`

5.1.11

🗓 2023-06-01 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

5.1.10

🗓 2023-05-30 • 📝 Commits

🐛 Bug fixes

  • textfield: mod name for keyboard focus color (4d7f170)
  • textfield: valid in storybook - display correct icon size (37ca676)

5.1.9

🗓 2023-05-23 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

5.1.8

🗓 2023-05-22 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

5.1.7

🗓 2023-05-18 • 📝 Commits

Features

Icons

Icons are now added as SVGs, with svg.spectrum-Textfield-validationIcon used for the UI icons that can indicate valid or invalid input.

🐛 Bug fixes

  • textfield, stepper: button padding and focus indicator (#1863) (7963b85)

5.1.6

🗓 2023-05-18 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

5.1.5

🗓 2023-05-17 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

5.1.4

🗓 2023-05-11 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

5.1.3

🗓 2023-05-10 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

5.1.2

🗓 2023-05-10 • 📝 Commits

🐛 Bug fixes

  • stepper: fix stepper button padding and borders (#1856) (55f2b08)

5.1.1

🗓 2023-05-08 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

5.1.0

🗓 2023-05-04 • 📝 Commits

✨ Features

5.0.0

🗓 2023-05-02 • 📝 Commits

  • fix(textfield, combobox)!: adjust padding calculations (#1803) (09c1bdc), closes #1803

🛑 BREAKING CHANGES

  • removes --mod-combobox-icon-size, --mod-combobox-spacing-block-start-to-border, --mod-combobox-spacing-inline-start-to-textfield, --mod-combobox-spacing-block-start-edge-to-textfield, --mod-combobox-spacing-block-end-edge-to-textfield, and --mod-combobox-spacing-inline-start-edge-to-textfield.

Additionally:

  • fix: exclude border width from padding with text inputs + more fixes

  • Textfield and Combobox: exclude border width from padding calculations because most of the to-edge tokens include the border, and the values were 1px larger than they should have been.

  • Textfield and Combobox: fix corner radius of focus indicator when using a larger border radius (e.g. try setting a --mod border width of 5px; the calculation adding the border width was incorrect)
  • Combobox: adjust styles so custom property for border width is correctly overriding everything from its sub-components. Previously using --mod-combobox-border-width had no effect.
  • Combobox: simplify/remove some custom properties related to those fixes and quiet variant.

  • fix(combobox): border-radius should not increase for t-shirt sizes

Per design feedback, the border-radius value should not be increasing for these t-shirt sizes.

  • fix(combobox): calculate the button x-offset on quiet

Use a corrected calculation of the x-offset for the picker button on the quiet variant. Based on design feedback for the component: "The point is to line up the chevron icon with the end of the component so those elements are flushed".

  • fix(combobox): mods update after changes

Regenerate mods after fixes that have removed and renamed some properties.

  • feat(textfield): add 'size' control to storybook

Add "t-shirt" size control to Textfield stories. The arg was already there, but it was missing a control for testing.

4.1.15

🗓 2023-04-26 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.14

🗓 2023-04-25 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.13

🗓 2023-04-25 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.12

🗓 2023-04-25 • 📝 Commits

🐛 Bug fixes

  • textfield: fix WHCM focus color (3b23557)
  • textfield: update WHCM focus border colors (392c16e)

4.1.11

🗓 2023-04-25 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.10

🗓 2023-04-21 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.9

🗓 2023-04-20 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.8

🗓 2023-04-17 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.7

🗓 2023-04-17 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.6

🗓 2023-04-14 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.5

🗓 2023-04-06 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.4

🗓 2023-04-04 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.3

🗓 2023-04-03 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.2

🗓 2023-03-31 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.1

🗓 2023-03-30 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.1.0

🗓 2023-03-28 • 📝 Commits

✨ Features

  • textfield: remove custom search icon styles (cc72eca)

4.0.3

🗓 2023-03-28 • 📝 Commits

🐛 Bug fixes

4.0.2

🗓 2023-03-27 • 📝 Commits

🐛 Bug fixes

  • textfield: quiet focus indicator on click (#1685) (51263fb)

4.0.1

🗓 2023-03-21 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

4.0.0

🗓 2023-03-21 • 📝 Commits

  • refactor(textfield)!: migrate spectrum tokens (#1544) (1723f01), closes #1544

🛑 BREAKING CHANGES

  • migrates textfield to spectrum tokens

  • Updates to latest tokens package

  • WHCM added
  • Focus state and dependency fixes
  • Leveraging CSS grid for help text placement and character count

  • removes placeholder from stepper inputs

  • feat(stepper): add hideStepper control to fix border styling issue

  • refactor(stepper): adding native pseudo class styles
  • refactor(stepper): add support for invalid textfield styling

4.0.0-beta.7

🗓 2023-03-16 • 📝 Commits

✨ Features

  • add TextArea story and grows control (c5ba477)
  • textarea: auto resize solution (47e4ff6)
  • textarea: implemented tokens for text area (d9cfec0)
  • textarea: quiet variant height WIP (41cf1f6)
  • textarea: update text area yml (882ddfd)
  • textarea: wip token migration (4a4ba7a)
  • textfield: add aria markup for character count (beed486)
  • textfield: add default icon alignment for search icon (e17cca4)
  • textfield: corrections and markup updates (c06e899)
  • textfield: final tokens populated (a1a6d5b)
  • textfield: focus and dependency corrections (9a5ecab)
  • textfield: focus hover state (ac96ce6)
  • textfield: focus indicator (4c07923)
  • textfield: grid layout (ba6b689)
  • textfield: organizing variants (68f9b5e)
  • textfield: refactor for readability of variants (43014e9)
  • textfield: refinement of focus states (0cec4c8)
  • textfield: reorganizing states and variants (f440bf5)
  • textfield: resolving errors (9f53dc7)
  • textfield: rework focus states and nesting (bca4ac2)
  • textfield: rework markup and focus indicator WIP (142a7f9)
  • textfield: token migration WIP (3b67a12)
  • textfield: WHCM and tidying (fe3ac52)
  • textfield: WHCM setup WIP (feb62af)
  • textfield: windows high contrast mode (e30149c)

Migration guide

T-shirt sizes

As of token migration, textfield now has t-shirt sizes. Medium is the default size if no size variant is applied. Icon sizes must match each t-shirt size.

Label

As of token migration, textfield must always have a label. Label placement is top or on the side (start).

Character Count

As of token migration, textfield now has an optional character count. The character count moves to the side (end) when the label position is on the side (start). This count needs to be read by a screen reader but we cannot just use a live region as that will result in an overly verbose experience Adjust the markup of the character count for optimal accessibility for each API.

Help Text

As of token migration, Help text is optional and has only one position below the textfield input. Help text aligns with the input in both standard and side label layouts.

Composition

As of spectrum tokens migration, Textfield uses grid to align the label, character count, helptext, and focus indicator in both the default and side label layouts.

Any application using Textarea Grows (Textarea input which automatically resizes vertically to accommodate content that is entered) will need to place the sizer element within the same grid area as the input and focus indicator.

Indicating validity and focus

Valid Icon

Validation icons are as follows. Small spectrum-Icon spectrum-UIIcon-Checkmark75 spectrum-Textfield-validationIcon

Medium spectrum-Icon spectrum-UIIcon-Checkmark100 spectrum-Textfield-validationIcon

Large spectrum-Icon spectrum-UIIcon-Checkmark200 spectrum-Textfield-validationIcon

Extra Large spectrum-Icon spectrum-UIIcon-Checkmark7300 spectrum-Textfield-validationIcon

Invalid Icon

Uses #spectrum-icon-18-Alert

Small spectrum-Icon spectrum-Icon--sizeS spectrum-Textfield-validationIcon

Medium spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-validationIcon

Large spectrum-Icon spectrum-Icon--sizeL spectrum-Textfield-validationIcon

Extra Large spectrum-Icon spectrum-Icon--sizeXL spectrum-Textfield-validationIcon

Removal of :valid, :invalid, and ::placeholder

Textfield no longer supports the CSS pseudo selectors :invalid and :value.

The CSS pseudo-element ::placeholder has been deprecated due to accessibility. The styling remains for backwards compatibility but it is advised to stop utilizing placeholders moving forward.

🐛 Bug fixes

  • stepper, textfield: revert use of has (c26c64f)
  • textarea: simplified multiline t-shirt styles and markup (5e63c63)
  • textfield: add spacing around label and character count (65acf5c)
  • textfield: add style to prevent search icon from breaking (954125f)
  • textfield: add width to input (56d7c0e)
  • textfield: added missing WHCM refs to token stacks (820ac89)
  • textfield: apply width to parent instead of input wrapper (645127c)
  • textfield: changed icon margins to inset (957b42e)
  • textfield: cleanup placeholder tokens for clarity (ee30c04)
  • textfield: correct input patterns (38a14cb)
  • textfield: correct invisible focus indicator (bbd6f57)
  • textfield: correct WHCM focus indicator reference (ded46d4)
  • textfield: default placeholder font size (943d9d0)
  • textfield: disabled safari value text color (323f434)
  • textfield: ensure long side label does not impact helptext (fbce894)
  • textfield: ensure placeholder has correct font styles (39a5ca7)
  • textfield: ensure stepper inherits correct border styles (91b5dfa)
  • textfield: establish textfield animation token (102d6af)
  • textfield: fix focus and grows for textfield and textarea (6f02a4d)
  • textfield: fix issue with readonly styles not working (740b1b1)
  • textfield: fix storybook keyboard focused typo (ba471d3)
  • textfield: focus border invalid correction (6ff801d)
  • textfield: focus hover colors (ffe9415)
  • textfield: grid adjustments for label and character count (1c6cc9e)
  • textfield: icon class name (3e5bad7)
  • textfield: icon color defaults (3b21957)
  • textfield: mitigate search icon misalignment in swc (a88e152)
  • textfield: mitigate validation icon within combobox (d7fb96e)
  • textfield: mitigation of search icon alignment issues (7adb664)
  • textfield: point placeholder font token to existing custom token (bbc1b2c)
  • textfield: quiet and quiet focus corrections (c0a6bb8)
  • textfield: quiet focus indicator position correction (d0fff11)
  • textfield: quiet textarea no resize (e2782fa)
  • textfield: refactor to avoid additional markup (062019f)
  • textfield: remove skin.css import from storyfile (c268381)
  • textfield: restored font placeholder tokens (f59a3c0)
  • textfield: search icon align and text overflow (f292fc8)
  • textfield: textarea inherits resize (86691cb)
  • textfield: tokens and express border (160452a)
  • textfield: update example text to match helptext (ee9e4d2)
  • textfield: update express border width per design update (2b726b8)
  • textfield: WHCM corrections (df1577f)
  • textfield: WHCM corrections - focus states (9a1d627)
  • textfield: whcm decouple input color and placeholder text color (8e16a5b)

  • feat(textfield)!: initial migration with placeholder tokens (b8bb223)

🛑 BREAKING CHANGES

  • migrates textfield to spectrum tokens

3.2.16

🗓 2023-03-13 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.15

🗓 2023-03-09 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.14

🗓 2023-02-21 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.13

🗓 2023-02-06 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.12

🗓 2023-02-01 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.11

🗓 2023-02-01 • 📝 Commits

🐛 Bug fixes

3.2.10

🗓 2023-01-27 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.9

🗓 2023-01-25 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.8

🗓 2023-01-18 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.7

🗓 2023-01-13 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.6

🗓 2022-11-11 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.5

🗓 2022-11-10 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.4

🗓 2022-06-16 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.3

🗓 2022-06-07 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.2

🗓 2022-05-09 • 📝 Commits

🐛 Bug fixes

3.2.1

🗓 2022-04-28 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.2.0

🗓 2022-04-08 • 📝 Commits

✨ Features

  • textfield: add read-only state (f7d0ac3)

3.1.10

🗓 2022-03-22 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.9

🗓 2022-03-17 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.8

🗓 2022-03-07 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.7

🗓 2022-03-07 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.6

🗓 2022-02-23 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.5

🗓 2022-02-16 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.4

🗓 2022-01-26 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.3

🗓 2022-01-05 • 📝 Commits

🐛 Bug fixes

  • update peer dependencies (97810cf)

3.1.2

🗓 2022-01-05 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.2-beta.0

🗓 2021-12-14 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.1

🗓 2021-12-06 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.1.0

🗓 2021-11-16 • 📝 Commits

✨ Features

  • make textfield support a halo focus ring for Express (d2c57b7)

3.0.7

🗓 2021-11-10 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.6

🗓 2021-11-09 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.5

🗓 2021-11-08 • 📝 Commits

🐛 Bug fixes

  • updating version number on vars (f535b49)
  • used correct token for textfield quiet underline; closes #1273 (17a21ef)

3.0.4

🗓 2021-10-25 • 📝 Commits

🐛 Bug fixes

  • updating version number on vars (f535b49)
  • used correct token for textfield quiet underline; closes #1273 (17a21ef)

3.0.3

🗓 2021-09-29 • 📝 Commits

🐛 Bug fixes

  • updating version number on vars (f535b49)

3.0.3-alpha.5

🗓 2021-08-16 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.3-alpha.4

🗓 2021-08-04 • 📝 Commits

🐛 Bug fixes

  • removed placeholder token values, updated spectrum-tokens beta (0d76eeb)

3.0.3-alpha.3

🗓 2021-07-19 • 📝 Commits

🐛 Bug fixes

  • missing validation icon (613e849)

3.0.3-alpha.2

🗓 2021-06-17 • 📝 Commits

🐛 Bug fixes

  • use renamed aliases (91f6c04)
  • textfield: prevent pointer-events on icons over the form element (f900265)
  • adjusted left padding in textinput (47d38db)
  • picked the correct invalid icon color for disabled (56fcb4c)

3.0.3-alpha.1

🗓 2021-05-12 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.3-alpha.0

🗓 2021-04-27 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.2

🗓 2021-04-15 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.1

🗓 2021-03-10 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.0

🗓 2021-02-02 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.0-beta.6

🗓 2020-12-04 • 📝 Commits

🐛 Bug fixes

  • correct quiet Textfield left padding (0145378)
  • correct Textarea padding (8fb6ed2)
  • make Textfield/Textarea work again (a0ca861)
  • remove Textfield padding hack (51b4049)
  • update main, resolved conflicts (d7880a2)

3.0.0-beta.5

🗓 2020-10-20 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.0-beta.4

🗓 2020-09-23 • 📝 Commits

🐛 Bug fixes

  • adjusted textfield icon placement with updated tokens. closes #860 (03e2cde)
  • wip (32120c5)
  • wip fix more components (b74dbb8)

3.0.0-beta.3

🗓 2020-05-14 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.0-beta.2

🗓 2020-03-12 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

3.0.0-beta.1

🗓 2020-03-12 • 📝 Commits

✨ Features

  • refactor Textfield to be decorated, closes #142 (d34be59)

Migration guide

Notes below apply to both text field and text area.

Composition

As of 3.0.0, Textfield is now composed the same way a DecoratedTextfield was previously. That is, the outer element div.spectrum-Textfield contains a input.spectrum-Textfield-input.

Icons

The <svg> element should appear before the <input> element.

Indicating validity and focus

Validity and focus must be bubbled up to the parent so adjacent siblings can be styled.

Thus, implementations must add the following classes in the following situations:

  • .spectrum-Textfield.is-focused - when the input is focused with the mouse
  • .spectrum-Textfield.is-keyboardFocused - when the input is focused with the keyboard
  • .spectrum-Textfield.is-valid - when the input has an explicit valid state
  • .spectrum-Textfield.is-invalid - when the input has an explicit invalid state

Removal of :valid, :invalid, and ::placeholder

Textfield no longer supports the CSS pseudo selectors :invalid and :value.

Using these selectors is an anti-pattern that complicates form validation techniques by making inputs appear invalid immediately, not after use interaction. Please apply .is-valid and .is-invalid to the outer div.spectrum-Textfield element instead.

Variants

Variants must be applied to the parent element, i.e. .spectrum-Textfield.spectrum-Textfield--quiet or .spectrum-Textfield.spectrum-Textfield--multiline. The <input> will be styled appropriately.

🛑 BREAKING CHANGES

  • remove support for .is-focused on .spectrum-Textfield-input
  • remove support for .is-invalid/.is-valid on .spectrum-Textfield-input (must go on parent)
  • remove support for .is-disabled on .spectrum-Textfield-input (must go on parent)
  • markup changed completely, see migration guide

Co-authored-by: Daniel Lu dlu@livefyre.com

3.0.0-beta.0

🗓 2020-03-09 • 📝 Commits

✨ Features

  • make Textfield support RTL (b846aec)

2.0.6

🗓 2020-03-06 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

2.0.5

🗓 2020-02-10 • 📝 Commits

🐛 Bug fixes

  • alignment of icon in DecoratedTextfield and Textfield, closes #494 (#499) (dcf8587)

2.0.4

🗓 2020-01-23 • 📝 Commits

🐛 Bug fixes

  • correct bottom padding to text alignment issues (6e782ed)
  • correct Textfield and Textarea padding, fixes #454, fixes #489 (120e502)

2.0.3

🗓 2019-12-14 • 📝 Commits

🐛 Bug fixes

2.0.2

🗓 2019-11-08 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

2.0.1

🗓 2019-11-07 • 📝 Commits

Note: Version bump only for package @spectrum-css/textfield

2.0.0

🗓 2019-10-08

✨ Features

🐛 Bug fixes

  • use correct token for Textfield border-radius (ca9c315)